Add access token as property

egi-login-service
parent 45523bf437
commit 0e2aba2b05

@ -9,6 +9,7 @@ public class Properties {
private OIDC oidc = new OIDC();
private String domain;
private String session;
private String accessToken;
private String redirect;
private String authoritiesMapper;
@ -47,6 +48,14 @@ public class Properties {
this.session = session;
}
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public String getRedirect() {
return redirect;
}

@ -39,7 +39,7 @@ public class OpenAIREAuthenticationSuccessHandler implements AuthenticationSucce
String redirect = (String) session.getAttribute("redirect");
session.setAttribute(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, token.getUserInfo().getSub());
try {
Cookie accessToken = new Cookie("AccessToken", token.getAccessTokenValue());
Cookie accessToken = new Cookie(properties.getAccessToken(), token.getAccessTokenValue());
String regex = "^([A-Za-z0-9-_=]+)\\.([A-Za-z0-9-_=]+)\\.?([A-Za-z0-9-_.+=]*)$";
Matcher matcher = Pattern.compile(regex).matcher(token.getAccessTokenValue());
if (matcher.find()) {

@ -6,6 +6,7 @@ authentication.oidc.scope=openid,profile,email,eduperson_entitlement
authentication.oidc.id=id
authentication.oidc.secret=secret
authentication.session=openAIRESession
authentication.accessToken=accessToken
authentication.redirect=http://mpagasas.di.uoa.gr:4600/reload
# Currently, this is the only available mapper, set to null or anything else will ignore this.
authentication.authorities-mapper=openAIREMapper
Loading…
Cancel
Save