public interface AuthenticationService
This class initializes the "stack" from the DSpace configuration, and then invokes methods in the appropriate order on behalf of clients.
See the AuthenticationMethod interface for details about what each function does.
Configuration
The stack of authentication methods is defined by one property in the DSpace configuration:
plugin.sequence.org.dspace.eperson.AuthenticationMethod = a list of method class names
e.g.
plugin.sequence.org.dspace.eperson.AuthenticationMethod = \
org.dspace.eperson.X509Authentication, \
org.dspace.eperson.PasswordAuthentication
The "stack" is always traversed in order, with the methods specified first (in the configuration) thus getting highest priority.
AuthenticationMethod| Modifier and Type | Method and Description |
|---|---|
boolean |
allowSetPassword(Context context,
javax.servlet.http.HttpServletRequest request,
String username)
Predicate, can user set EPerson password.
|
int |
authenticate(Context context,
String username,
String password,
String realm,
javax.servlet.http.HttpServletRequest request)
Test credentials for authenticity.
|
int |
authenticateImplicit(Context context,
String username,
String password,
String realm,
javax.servlet.http.HttpServletRequest request)
Test credentials for authenticity, using only Implicit methods.
|
Iterator<AuthenticationMethod> |
authenticationMethodIterator()
Get stack of authentication methods.
|
boolean |
canSelfRegister(Context context,
javax.servlet.http.HttpServletRequest request,
String username)
Predicate, can a new EPerson be created.
|
List<Group> |
getSpecialGroups(Context context,
javax.servlet.http.HttpServletRequest request)
Get list of extra groups that user implicitly belongs to.
|
void |
initEPerson(Context context,
javax.servlet.http.HttpServletRequest request,
EPerson eperson) |
int authenticate(Context context, String username, String password, String realm, javax.servlet.http.HttpServletRequest request)
SUCCESS, or otherwise
returns the most favorable outcome from one of the methods.context - DSpace context, will be modified (ePerson set) upon success.username - Username (or email address) when method is explicit. Use null for
implicit method.password - Password for explicit auth, or null for implicit method.realm - Realm is an extra parameter used by some authentication methods, leave null if
not applicable.request - The HTTP request that started this operation, or null if not applicable.Meaning:
SUCCESS - authenticated OK.
BAD_CREDENTIALS - user exists, but credentials (e.g. password) don't match
CERT_REQUIRED - not allowed to login this way without X.509 cert.
NO_SUCH_USER - user not found using this method.
BAD_ARGS - user/password not appropriate for this method
int authenticateImplicit(Context context, String username, String password, String realm, javax.servlet.http.HttpServletRequest request)
authenticate(), except it only invokes the
implicit authentication methods the stack.context - DSpace context, will be modified (ePerson set) upon success.username - Username (or email address) when method is explicit. Use null for
implicit method.password - Password for explicit auth, or null for implicit method.realm - Realm is an extra parameter used by some authentication methods, leave null if
not applicable.request - The HTTP request that started this operation, or null if not applicable.Meaning:
SUCCESS - authenticated OK.
BAD_CREDENTIALS - user exists, but credentials (e.g. password) don't match
CERT_REQUIRED - not allowed to login this way without X.509 cert.
NO_SUCH_USER - user not found using this method.
BAD_ARGS - user/password not appropriate for this method
boolean canSelfRegister(Context context, javax.servlet.http.HttpServletRequest request, String username) throws SQLException
canSelfRegister() of every authentication
method in the stack, and returns true if any of them is true.context - DSpace contextrequest - HTTP request, in case it's needed. Can be null.username - Username, if available. Can be null.SQLExceptionboolean allowSetPassword(Context context, javax.servlet.http.HttpServletRequest request, String username) throws SQLException
allowSetPassword() method of any
member of the stack returns true.context - DSpace contextrequest - HTTP request, in case it's needed. Can be null.username - Username, if available. Can be null.SQLExceptionvoid initEPerson(Context context, javax.servlet.http.HttpServletRequest request, EPerson eperson) throws SQLException
SQLExceptionList<Group> getSpecialGroups(Context context, javax.servlet.http.HttpServletRequest request) throws SQLException
getSpecialGroups()
methods in the stack.context - A valid DSpace context.request - The request that started this operation, or null if not applicable.SQLExceptionIterator<AuthenticationMethod> authenticationMethodIterator()
Iterator that steps through each configured
authentication method, in order of precedence.Copyright © 2016 DuraSpace. All Rights Reserved.