Add access token as property
This commit is contained in:
parent
45523bf437
commit
0e2aba2b05
|
@ -9,6 +9,7 @@ public class Properties {
|
||||||
private OIDC oidc = new OIDC();
|
private OIDC oidc = new OIDC();
|
||||||
private String domain;
|
private String domain;
|
||||||
private String session;
|
private String session;
|
||||||
|
private String accessToken;
|
||||||
private String redirect;
|
private String redirect;
|
||||||
private String authoritiesMapper;
|
private String authoritiesMapper;
|
||||||
|
|
||||||
|
@ -47,6 +48,14 @@ public class Properties {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAccessToken() {
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccessToken(String accessToken) {
|
||||||
|
this.accessToken = accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
public String getRedirect() {
|
public String getRedirect() {
|
||||||
return redirect;
|
return redirect;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class OpenAIREAuthenticationSuccessHandler implements AuthenticationSucce
|
||||||
String redirect = (String) session.getAttribute("redirect");
|
String redirect = (String) session.getAttribute("redirect");
|
||||||
session.setAttribute(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, token.getUserInfo().getSub());
|
session.setAttribute(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, token.getUserInfo().getSub());
|
||||||
try {
|
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-_.+=]*)$";
|
String regex = "^([A-Za-z0-9-_=]+)\\.([A-Za-z0-9-_=]+)\\.?([A-Za-z0-9-_.+=]*)$";
|
||||||
Matcher matcher = Pattern.compile(regex).matcher(token.getAccessTokenValue());
|
Matcher matcher = Pattern.compile(regex).matcher(token.getAccessTokenValue());
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ authentication.oidc.scope=openid,profile,email,eduperson_entitlement
|
||||||
authentication.oidc.id=id
|
authentication.oidc.id=id
|
||||||
authentication.oidc.secret=secret
|
authentication.oidc.secret=secret
|
||||||
authentication.session=openAIRESession
|
authentication.session=openAIRESession
|
||||||
|
authentication.accessToken=accessToken
|
||||||
authentication.redirect=http://mpagasas.di.uoa.gr:4600/reload
|
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.
|
# Currently, this is the only available mapper, set to null or anything else will ignore this.
|
||||||
authentication.authorities-mapper=openAIREMapper
|
authentication.authorities-mapper=openAIREMapper
|
Loading…
Reference in New Issue