Skip to content

Commit

Permalink
One Login url calls random uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-tco committed Jul 17, 2023
1 parent b4c9bc8 commit 145e7b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ public class OneLoginService {
@Value("${onelogin.private-key}")
public String privateKey;

private String nonce;

private String state;

private static final String SCOPE = "openid email";

private static final String VTR = "[\"Cl.Cm\"]";
Expand Down Expand Up @@ -153,13 +149,13 @@ public Optional<User> getUser(final String email, final String sub) {
}

public String generateNonce() {
nonce = UUID.randomUUID().toString();
return nonce;
return UUID.randomUUID().toString();

}

public String generateState() {
state = UUID.randomUUID().toString();
return state;
return UUID.randomUUID().toString();

}

public String getOneLoginAuthorizeUrl() {
Expand All @@ -168,9 +164,9 @@ public String getOneLoginAuthorizeUrl() {
"/authorize?response_type=code" +
"&scope=" + SCOPE +
"&client_id=" + clientId +
"&state=" + nonce +
"&state=" + generateState() +
"&redirect_uri=" + serviceRedirectUrl +
"&nonce=" + state +
"&nonce=" + generateNonce() +
"&vtr=" + VTR +
"&ui_locales=" + UI;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ public RedirectView login(final @RequestParam Optional<String> redirectUrl,
response.addCookie(redirectUrlCookie);

// TODO : Decide on where to set and evaluate nonce and state
final String nonce = oneLoginService.generateNonce();
final String state = oneLoginService.generateState();
return new RedirectView(NOTICE_PAGE_VIEW);
}

Expand Down

0 comments on commit 145e7b4

Please sign in to comment.