|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dspace.authenticate.PasswordAuthentication
public class PasswordAuthentication
A stackable authentication method
based on the DSpace internal "EPerson" database.
See the AuthenticationMethod interface for more details.
The username is the E-Person's email address,
and and the password (given to the authenticate()
method) must match the EPerson password.
This is the default method for a new DSpace configuration. If you are implementing a new "explicit" authentication method, use this class as a model.
You can use this (or another explict) method in the stack to
implement HTTP Basic Authentication for servlets, by passing the
Basic Auth username and password to the AuthenticationManager.
| Field Summary |
|---|
| Fields inherited from interface org.dspace.authenticate.AuthenticationMethod |
|---|
BAD_ARGS, BAD_CREDENTIALS, CERT_REQUIRED, NO_SUCH_USER, SUCCESS |
| Constructor Summary | |
|---|---|
PasswordAuthentication()
|
|
| Method Summary | |
|---|---|
boolean |
allowSetPassword(Context context,
javax.servlet.http.HttpServletRequest request,
String username)
We always allow the user to change their password. |
int |
authenticate(Context context,
String username,
String password,
String realm,
javax.servlet.http.HttpServletRequest request)
Check credentials: username must match the email address of an EPerson record, and that EPerson must be allowed to login. |
boolean |
canSelfRegister(Context context,
javax.servlet.http.HttpServletRequest request,
String email)
Look to see if this email address is allowed to register. |
int[] |
getSpecialGroups(Context context,
javax.servlet.http.HttpServletRequest request)
Add authenticated users to the group defined in dspace.cfg by the password.login.specialgroup key. |
void |
initEPerson(Context context,
javax.servlet.http.HttpServletRequest request,
EPerson eperson)
Nothing extra to initialize. |
boolean |
isImplicit()
This is an explicit method, since it needs username and password from some source. |
String |
loginPageTitle(Context context)
Returns message key for title of the "login" page, to use in a menu showing the choice of multiple login methods. |
String |
loginPageURL(Context context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Returns URL of password-login servlet. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PasswordAuthentication()
| Method Detail |
|---|
public boolean canSelfRegister(Context context,
javax.servlet.http.HttpServletRequest request,
String email)
throws SQLException
The configuration key authentication.password.domain.valid is examined in dspace.cfg to see what doamins are valid.
Example - aber.ac.uk domains : @aber.ac.uk Example - MIT domain and all .ac.uk domains: @mit.edu, .ac.uk
canSelfRegister in interface AuthenticationMethodcontext - DSpace contextrequest - HTTP request, in case it's needed. May be null.email - Username, if available. May be null.
SQLException
public void initEPerson(Context context,
javax.servlet.http.HttpServletRequest request,
EPerson eperson)
throws SQLException
initEPerson in interface AuthenticationMethodcontext - DSpace contextrequest - HTTP request, in case it's needed. May be null.eperson - newly created EPerson record - email + information from the
registration form will have been filled out.
SQLException
public boolean allowSetPassword(Context context,
javax.servlet.http.HttpServletRequest request,
String username)
throws SQLException
allowSetPassword in interface AuthenticationMethodcontext - DSpace contextrequest - HTTP request, in case it's needed. May be null.username - Username, if available. May be null.
SQLExceptionpublic boolean isImplicit()
isImplicit in interface AuthenticationMethod
public int[] getSpecialGroups(Context context,
javax.servlet.http.HttpServletRequest request)
getSpecialGroups in interface AuthenticationMethodcontext - A valid DSpace context.request - The request that started this operation, or null if not applicable.
null.
public int authenticate(Context context,
String username,
String password,
String realm,
javax.servlet.http.HttpServletRequest request)
throws SQLException
CERT_REQUIRED if that is the case.
authenticate in interface AuthenticationMethodcontext - 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 assword doesn't match
CERT_REQUIRED - not allowed to login this way without X.509 cert.
NO_SUCH_USER - no EPerson with matching email address.
BAD_ARGS - missing username, or user matched but cannot login.
SQLException
public String loginPageURL(Context context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
loginPageURL in interface AuthenticationMethodcontext - DSpace context, will be modified (EPerson set) upon success.request - The HTTP request that started this operation, or null if not applicable.response - The HTTP response from the servlet method.
public String loginPageTitle(Context context)
loginPageTitle in interface AuthenticationMethodcontext - DSpace context, will be modified (EPerson set) upon success.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||