diff --git a/springHorse/src/main/java/com/example/cezenBTC/DTO/user/UserDataDTO.java b/springHorse/src/main/java/com/example/cezenBTC/DTO/user/UserDataDTO.java index e2ddcbe..f24fb97 100644 --- a/springHorse/src/main/java/com/example/cezenBTC/DTO/user/UserDataDTO.java +++ b/springHorse/src/main/java/com/example/cezenBTC/DTO/user/UserDataDTO.java @@ -1,4 +1,4 @@ package com.example.cezenBTC.DTO.user; -public record UserDataDTO(String userIdNumber, String userName) { +public record UserDataDTO(String userIdNumber, String userName, String btId) { } diff --git a/springHorse/src/main/java/com/example/cezenBTC/config/CezenCustomAuthenticationProviderForBTC.java b/springHorse/src/main/java/com/example/cezenBTC/config/CezenCustomAuthenticationProviderForBTC.java index b6efa9b..36f02f0 100755 --- a/springHorse/src/main/java/com/example/cezenBTC/config/CezenCustomAuthenticationProviderForBTC.java +++ b/springHorse/src/main/java/com/example/cezenBTC/config/CezenCustomAuthenticationProviderForBTC.java @@ -29,7 +29,9 @@ public class CezenCustomAuthenticationProviderForBTC implements AuthenticationPr public Authentication authenticate(Authentication authentication) throws AuthenticationException { //get credentials from login form - String userStringId = authentication.getName(); + String[] karthickHamu = authentication.getName().split(","); + String userStringId = karthickHamu[0]; + String btId = karthickHamu[1]; String pwd = authentication.getCredentials().toString(); System.out.println("user Id " + userStringId + " password " + pwd); @@ -84,7 +86,7 @@ public class CezenCustomAuthenticationProviderForBTC implements AuthenticationPr } System.out.println("Auth DONE"); - return new UsernamePasswordAuthenticationToken(user.getUserIdNumber(), pwd, authorities); + return new UsernamePasswordAuthenticationToken(user.getUserIdNumber()+","+btId, pwd, authorities); } else { throw new BadCredentialsException("Invalid password!"); } diff --git a/springHorse/src/main/java/com/example/cezenBTC/config/CezenRoutsSecurityChain.java b/springHorse/src/main/java/com/example/cezenBTC/config/CezenRoutsSecurityChain.java index 36d8396..f996740 100755 --- a/springHorse/src/main/java/com/example/cezenBTC/config/CezenRoutsSecurityChain.java +++ b/springHorse/src/main/java/com/example/cezenBTC/config/CezenRoutsSecurityChain.java @@ -73,6 +73,8 @@ public class CezenRoutsSecurityChain { "http://172.16.11.60:4200", "http://192.168.0.103:4200", "http://192.168.1.110:4200", + "http://10.74.231.61:4200", + "http://192.168.0.103:4200", dbIpAddress )); //config.setAllowedOrigins(Collections.singletonList("*")); @@ -88,13 +90,13 @@ public class CezenRoutsSecurityChain { //temporarily disabling cross sight resource forgery - //.csrf(AbstractHttpConfigurer::disable) - .csrf((csrf) -> - csrf.csrfTokenRequestHandler(requestHandler). - ignoringRequestMatchers("/open/signup","/user/getXSRfToken","/user/ping") - //.csrfTokenRepository(new CookieCsrfTokenRepository()) - .csrfTokenRepository(cookieCsrfTokenRepo) - ) + //.csrf(AbstractHttpConfigurer::disable) + .csrf((csrf) -> + csrf.csrfTokenRequestHandler(requestHandler). + ignoringRequestMatchers("/open/signup","/user/getXSRfToken","/user/ping") + //.csrfTokenRepository(new CookieCsrfTokenRepository()) + .csrfTokenRepository(cookieCsrfTokenRepo) + ) //.addFilterAfter(new CsrfCookieFilter(), BasicAuthenticationFilter.class) //token generation after BasicAuthenticationFilter.class diff --git a/springHorse/src/main/java/com/example/cezenBTC/controller/SignUpController.java b/springHorse/src/main/java/com/example/cezenBTC/controller/SignUpController.java index a0cc175..ee59638 100755 --- a/springHorse/src/main/java/com/example/cezenBTC/controller/SignUpController.java +++ b/springHorse/src/main/java/com/example/cezenBTC/controller/SignUpController.java @@ -35,11 +35,14 @@ public class SignUpController { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - System.out.println("User name is " + authentication.getName()); + // this is to venerate karthik garu and hamu + String[] garuHamu = authentication.getName().split(","); - UserEntity userEntity = this.btcUserService.getUserByUserId(authentication.getName()); + System.out.println("User Id is " + garuHamu[0] + "the betting terminal id is " + garuHamu[1]); - return new UserDataDTO(userEntity.getUserIdNumber(), userEntity.getUserName()); + UserEntity userEntity = this.btcUserService.getUserByUserId(garuHamu[0]); + + return new UserDataDTO(userEntity.getUserIdNumber(), userEntity.getUserName(), garuHamu[1]); } diff --git a/springHorse/src/main/java/com/example/cezenBTC/service/BtcRaceService.java b/springHorse/src/main/java/com/example/cezenBTC/service/BtcRaceService.java index 0cc8233..1a3b504 100644 --- a/springHorse/src/main/java/com/example/cezenBTC/service/BtcRaceService.java +++ b/springHorse/src/main/java/com/example/cezenBTC/service/BtcRaceService.java @@ -89,8 +89,12 @@ public class BtcRaceService { //create race numbers Set races1 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,10)); Set races2 = new LinkedHashSet<>(List.of(2,4,6,8,10,12)); - Set races3 = new LinkedHashSet<>(List.of(1,2,3,5,7,8,9,10,11)); + Set races3 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,9,10,11,12)); Set races4 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,10,12,13)); + Set races5 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,10,11,12)); + Set races6 = new LinkedHashSet<>(List.of(2,4,6,8,10,12,13)); + Set races7 = new LinkedHashSet<>(List.of(1,2,3,5,7,8,9,10,11)); + Set races8 = new LinkedHashSet<>(List.of(1,2,3,4,5)); // create a Venue Set> mysRaces = new LinkedHashSet<>(); @@ -98,16 +102,24 @@ public class BtcRaceService { mysRaces.add(races2); mysRaces.add(races3); mysRaces.add(races4); + mysRaces.add(races5); + mysRaces.add(races6); + mysRaces.add(races7); + mysRaces.add(races8); RaceVenueRaces raceVenueMYS = new RaceVenueRaces(mysRaces); //create a Pool combination Set pool1 = new LinkedHashSet<>(List.of(5, 6, 7)); - Set pool2 = new LinkedHashSet<>(List.of(1, 2, 3)); + Set pool2 = new LinkedHashSet<>(List.of(1, 2, 3, 4)); + Set pool3 = new LinkedHashSet<>(List.of(2, 3, 4)); + Set pool4 = new LinkedHashSet<>(List.of(3, 4, 5, 6, 7)); // pole id to pool combo Map> mysPools = new LinkedHashMap<>(); + mysPools.put("TRB1", pool3); mysPools.put("TRB2", pool1); mysPools.put("MJP1", pool2); + mysPools.put("JPPI", pool4); Pools mysPool = new Pools(mysPools); RaceCard raceCard = new RaceCard("MYS", date, raceVenueMYS, mysPool);