Browse Source

steam auth 5

master
gsd 2 years ago
parent
commit
ce5432914d
  1. 11
      src/main/java/app/controllers/auth/AuthSteamController.java
  2. 6
      src/main/java/app/services/steam/SteamSignIn.java

11
src/main/java/app/controllers/auth/AuthSteamController.java

@ -37,8 +37,8 @@ public class AuthSteamController {
}
@GetMapping("login")
public ResponseEntity<Void> Login(){
return steamSignIn.ConstructURLAndRedirect();
public ResponseEntity<Void> Login(@RequestParam(value = "authentication_discord", required = false, defaultValue = "false") boolean authentication_discord){
return steamSignIn.ConstructURLAndRedirect(authentication_discord);
}
@GetMapping("logout")
@ -58,8 +58,8 @@ public class AuthSteamController {
.build();
}
@GetMapping("processlogin")
public ResponseEntity<?> ProcessLogin(@RequestParam Map<String, String> auth_result, HttpServletResponse response){
@GetMapping("processlogin/{after}")
public ResponseEntity<?> ProcessLogin(@RequestParam Map<String, String> auth_result, HttpServletResponse response, @PathVariable String after){
System.out.println(auth_result);
Long steam64 = steamSignIn.ValidateResults(auth_result);
if(steam64 == null){
@ -75,8 +75,9 @@ public class AuthSteamController {
cookie_steam64_secured.setDomain("tf2.pblr-nyk.pro");
response.addCookie(cookie_steam64_secured);
String move = after == "disco"?"/authentication_discord.html":"/";
return ResponseEntity.status(HttpStatus.FOUND).
header("Location", "/")
header("Location", move)
.build();
}

6
src/main/java/app/services/steam/SteamSignIn.java

@ -63,7 +63,7 @@ public class SteamSignIn {
}
}
public ResponseEntity<Void> ConstructURLAndRedirect(){
public ResponseEntity<Void> ConstructURLAndRedirect(boolean authentication_discord){
Matcher result = refinedScripts.matcher(responseURL);
if (!result.find() || result.group(0).isEmpty()){
responseURL = String.format("http://%s", responseURL);
@ -72,8 +72,8 @@ public class SteamSignIn {
HashMap<String, String> authParameters = new HashMap<>();
authParameters.put("openid.ns", "http://specs.openid.net/auth/2.0");
authParameters.put("openid.mode", "checkid_setup");
authParameters.put("openid.return_to", responseURL);
authParameters.put("openid.realm", responseURL);
authParameters.put("openid.return_to", responseURL + "/" + (authentication_discord?"disco":"root"));
authParameters.put("openid.realm", responseURL + "/" + (authentication_discord?"disco":"root"));
authParameters.put("openid.identity", "http://specs.openid.net/auth/2.0/identifier_select");
authParameters.put("openid.claimed_id", "http://specs.openid.net/auth/2.0/identifier_select");

Loading…
Cancel
Save