[DS-3662] DSpace 'logging in' without password or with non-existent e-mail using Shib and Password authentication (master port)

This commit is contained in:
Kim Shepherd
2018-04-13 12:07:14 +12:00
parent 8218b1ce24
commit 04181ef271

View File

@@ -1090,6 +1090,8 @@ public class ShibAuthentication implements AuthenticationMethod {
* *
* This method will not interpret the header value in any way. * This method will not interpret the header value in any way.
* *
* This method will return null if value is empty.
*
* @param request The HTTP request to look for values in. * @param request The HTTP request to look for values in.
* @param name The name of the attribute or header * @param name The name of the attribute or header
* @return The value of the attribute or header requested, or null if none found. * @return The value of the attribute or header requested, or null if none found.
@@ -1118,6 +1120,16 @@ public class ShibAuthentication implements AuthenticationMethod {
value = request.getHeader(name.toUpperCase()); value = request.getHeader(name.toUpperCase());
} }
// Added extra check for empty value of an attribute.
// In case that value is Empty, it should not be returned, return 'null' instead.
// This prevents passing empty value to other methods, stops the authentication process
// and prevents creation of 'empty' DSpace EPerson if autoregister == true and it subsequent
// authentication.
if (StringUtils.isEmpty(value)) {
log.debug("ShibAuthentication - attribute " + name + " is empty!");
return null;
}
boolean reconvertAttributes = boolean reconvertAttributes =
configurationService.getBooleanProperty( configurationService.getBooleanProperty(
"authentication-shibboleth.reconvert.attributes", "authentication-shibboleth.reconvert.attributes",