mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-11 03:53:07 +00:00
85276: Store and retrieve the Authentication method in the JWT
This commit is contained in:
@@ -128,6 +128,8 @@ public class X509Authentication implements AuthenticationMethod {
|
||||
protected ConfigurationService configurationService =
|
||||
DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||
|
||||
private static final String X509_AUTHENTICATED = "x509.authenticated";
|
||||
|
||||
|
||||
/**
|
||||
* Initialization: Set caPublicKey and/or keystore. This loads the
|
||||
@@ -544,6 +546,7 @@ public class X509Authentication implements AuthenticationMethod {
|
||||
context.dispatchEvents();
|
||||
context.restoreAuthSystemState();
|
||||
context.setCurrentUser(eperson);
|
||||
request.getSession().setAttribute(X509_AUTHENTICATED, true);
|
||||
setSpecialGroupsFlag(request, email);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
@@ -563,6 +566,7 @@ public class X509Authentication implements AuthenticationMethod {
|
||||
log.info(LogHelper.getHeader(context, "login",
|
||||
"type=x509certificate"));
|
||||
context.setCurrentUser(eperson);
|
||||
request.getSession().setAttribute(X509_AUTHENTICATED, true);
|
||||
setSpecialGroupsFlag(request, email);
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -594,4 +598,14 @@ public class X509Authentication implements AuthenticationMethod {
|
||||
public String getName() {
|
||||
return "x509";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsed(final Context context, final HttpServletRequest request) {
|
||||
if (request != null &&
|
||||
context.getCurrentUser() != null &&
|
||||
request.getSession().getAttribute(X509_AUTHENTICATED) != null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user