three fields in log-in and race card reordering
This commit is contained in:
parent
8e9f84a2cf
commit
4c23c00df7
@ -1,4 +1,4 @@
|
|||||||
package com.example.cezenBTC.DTO.user;
|
package com.example.cezenBTC.DTO.user;
|
||||||
|
|
||||||
public record UserDataDTO(String userIdNumber, String userName) {
|
public record UserDataDTO(String userIdNumber, String userName, String btId) {
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,9 @@ public class CezenCustomAuthenticationProviderForBTC implements AuthenticationPr
|
|||||||
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
||||||
|
|
||||||
//get credentials from login form
|
//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();
|
String pwd = authentication.getCredentials().toString();
|
||||||
|
|
||||||
System.out.println("user Id " + userStringId + " password " + pwd);
|
System.out.println("user Id " + userStringId + " password " + pwd);
|
||||||
@ -84,7 +86,7 @@ public class CezenCustomAuthenticationProviderForBTC implements AuthenticationPr
|
|||||||
}
|
}
|
||||||
System.out.println("Auth DONE");
|
System.out.println("Auth DONE");
|
||||||
|
|
||||||
return new UsernamePasswordAuthenticationToken(user.getUserIdNumber(), pwd, authorities);
|
return new UsernamePasswordAuthenticationToken(user.getUserIdNumber()+","+btId, pwd, authorities);
|
||||||
} else {
|
} else {
|
||||||
throw new BadCredentialsException("Invalid password!");
|
throw new BadCredentialsException("Invalid password!");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,6 +73,8 @@ public class CezenRoutsSecurityChain {
|
|||||||
"http://172.16.11.60:4200",
|
"http://172.16.11.60:4200",
|
||||||
"http://192.168.0.103:4200",
|
"http://192.168.0.103:4200",
|
||||||
"http://192.168.1.110:4200",
|
"http://192.168.1.110:4200",
|
||||||
|
"http://10.74.231.61:4200",
|
||||||
|
"http://192.168.0.103:4200",
|
||||||
dbIpAddress
|
dbIpAddress
|
||||||
));
|
));
|
||||||
//config.setAllowedOrigins(Collections.singletonList("*"));
|
//config.setAllowedOrigins(Collections.singletonList("*"));
|
||||||
@ -88,13 +90,13 @@ public class CezenRoutsSecurityChain {
|
|||||||
|
|
||||||
|
|
||||||
//temporarily disabling cross sight resource forgery
|
//temporarily disabling cross sight resource forgery
|
||||||
//.csrf(AbstractHttpConfigurer::disable)
|
//.csrf(AbstractHttpConfigurer::disable)
|
||||||
.csrf((csrf) ->
|
.csrf((csrf) ->
|
||||||
csrf.csrfTokenRequestHandler(requestHandler).
|
csrf.csrfTokenRequestHandler(requestHandler).
|
||||||
ignoringRequestMatchers("/open/signup","/user/getXSRfToken","/user/ping")
|
ignoringRequestMatchers("/open/signup","/user/getXSRfToken","/user/ping")
|
||||||
//.csrfTokenRepository(new CookieCsrfTokenRepository())
|
//.csrfTokenRepository(new CookieCsrfTokenRepository())
|
||||||
.csrfTokenRepository(cookieCsrfTokenRepo)
|
.csrfTokenRepository(cookieCsrfTokenRepo)
|
||||||
)
|
)
|
||||||
//.addFilterAfter(new CsrfCookieFilter(), BasicAuthenticationFilter.class)
|
//.addFilterAfter(new CsrfCookieFilter(), BasicAuthenticationFilter.class)
|
||||||
|
|
||||||
//token generation after BasicAuthenticationFilter.class
|
//token generation after BasicAuthenticationFilter.class
|
||||||
|
|||||||
@ -35,11 +35,14 @@ public class SignUpController {
|
|||||||
|
|
||||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
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]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -89,8 +89,12 @@ public class BtcRaceService {
|
|||||||
//create race numbers
|
//create race numbers
|
||||||
Set<Integer> races1 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,10));
|
Set<Integer> races1 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,10));
|
||||||
Set<Integer> races2 = new LinkedHashSet<>(List.of(2,4,6,8,10,12));
|
Set<Integer> races2 = new LinkedHashSet<>(List.of(2,4,6,8,10,12));
|
||||||
Set<Integer> races3 = new LinkedHashSet<>(List.of(1,2,3,5,7,8,9,10,11));
|
Set<Integer> races3 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,9,10,11,12));
|
||||||
Set<Integer> races4 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,10,12,13));
|
Set<Integer> races4 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,10,12,13));
|
||||||
|
Set<Integer> races5 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,10,11,12));
|
||||||
|
Set<Integer> races6 = new LinkedHashSet<>(List.of(2,4,6,8,10,12,13));
|
||||||
|
Set<Integer> races7 = new LinkedHashSet<>(List.of(1,2,3,5,7,8,9,10,11));
|
||||||
|
Set<Integer> races8 = new LinkedHashSet<>(List.of(1,2,3,4,5));
|
||||||
|
|
||||||
// create a Venue
|
// create a Venue
|
||||||
Set<Set<Integer>> mysRaces = new LinkedHashSet<>();
|
Set<Set<Integer>> mysRaces = new LinkedHashSet<>();
|
||||||
@ -98,16 +102,24 @@ public class BtcRaceService {
|
|||||||
mysRaces.add(races2);
|
mysRaces.add(races2);
|
||||||
mysRaces.add(races3);
|
mysRaces.add(races3);
|
||||||
mysRaces.add(races4);
|
mysRaces.add(races4);
|
||||||
|
mysRaces.add(races5);
|
||||||
|
mysRaces.add(races6);
|
||||||
|
mysRaces.add(races7);
|
||||||
|
mysRaces.add(races8);
|
||||||
RaceVenueRaces raceVenueMYS = new RaceVenueRaces(mysRaces);
|
RaceVenueRaces raceVenueMYS = new RaceVenueRaces(mysRaces);
|
||||||
|
|
||||||
//create a Pool combination
|
//create a Pool combination
|
||||||
Set<Integer> pool1 = new LinkedHashSet<>(List.of(5, 6, 7));
|
Set<Integer> pool1 = new LinkedHashSet<>(List.of(5, 6, 7));
|
||||||
Set<Integer> pool2 = new LinkedHashSet<>(List.of(1, 2, 3));
|
Set<Integer> pool2 = new LinkedHashSet<>(List.of(1, 2, 3, 4));
|
||||||
|
Set<Integer> pool3 = new LinkedHashSet<>(List.of(2, 3, 4));
|
||||||
|
Set<Integer> pool4 = new LinkedHashSet<>(List.of(3, 4, 5, 6, 7));
|
||||||
|
|
||||||
// pole id to pool combo
|
// pole id to pool combo
|
||||||
Map<String, Set<Integer>> mysPools = new LinkedHashMap<>();
|
Map<String, Set<Integer>> mysPools = new LinkedHashMap<>();
|
||||||
|
mysPools.put("TRB1", pool3);
|
||||||
mysPools.put("TRB2", pool1);
|
mysPools.put("TRB2", pool1);
|
||||||
mysPools.put("MJP1", pool2);
|
mysPools.put("MJP1", pool2);
|
||||||
|
mysPools.put("JPPI", pool4);
|
||||||
Pools mysPool = new Pools(mysPools);
|
Pools mysPool = new Pools(mysPools);
|
||||||
|
|
||||||
RaceCard raceCard = new RaceCard("MYS", date, raceVenueMYS, mysPool);
|
RaceCard raceCard = new RaceCard("MYS", date, raceVenueMYS, mysPool);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user