mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 13:33:08 +00:00
Add missing isUsed override to OidcAuthentication code.
This commit is contained in:
@@ -29,6 +29,8 @@ public class OidcAuthentication implements AuthenticationMethod {
|
||||
|
||||
private final ServiceManager serviceManager = new DSpace().getServiceManager();
|
||||
|
||||
private static final String OIDC_AUTHENTICATED = "oidc.authenticated";
|
||||
|
||||
@Override
|
||||
public boolean canSelfRegister(Context context, HttpServletRequest request, String username) throws SQLException {
|
||||
return getOidcAuthentication().canSelfRegister(context, request, username);
|
||||
@@ -74,4 +76,14 @@ public class OidcAuthentication implements AuthenticationMethod {
|
||||
return serviceManager.getServiceByName("oidcAuthentication", OidcAuthenticationBean.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsed(final Context context, final HttpServletRequest request) {
|
||||
if (request != null &&
|
||||
context.getCurrentUser() != null &&
|
||||
request.getAttribute(OIDC_AUTHENTICATED) != null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -51,6 +51,8 @@ public class OidcAuthenticationBean implements AuthenticationMethod {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(OidcAuthenticationBean.class);
|
||||
|
||||
private static final String OIDC_AUTHENTICATED = "oidc.authenticated";
|
||||
|
||||
@Autowired
|
||||
private ConfigurationService configurationService;
|
||||
|
||||
@@ -129,6 +131,7 @@ public class OidcAuthenticationBean implements AuthenticationMethod {
|
||||
|
||||
EPerson ePerson = ePersonService.findByEmail(context, email);
|
||||
if (ePerson != null) {
|
||||
request.setAttribute(OIDC_AUTHENTICATED, true);
|
||||
return ePerson.canLogIn() ? logInEPerson(context, ePerson) : BAD_ARGS;
|
||||
}
|
||||
|
||||
@@ -256,4 +259,14 @@ public class OidcAuthenticationBean implements AuthenticationMethod {
|
||||
this.oidcClient = oidcClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsed(final Context context, final HttpServletRequest request) {
|
||||
if (request != null &&
|
||||
context.getCurrentUser() != null &&
|
||||
request.getAttribute(OIDC_AUTHENTICATED) != null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user