public class ShibAuthentication extends java.lang.Object implements AuthenticationMethod
BAD_ARGS, BAD_CREDENTIALS, CERT_REQUIRED, NO_SUCH_USER, SUCCESS| Constructor and Description |
|---|
ShibAuthentication() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowSetPassword(Context context,
javax.servlet.http.HttpServletRequest request,
java.lang.String email)
Indicate whether or not a particular self-registering user can set
themselves a password in the profile info form.
|
int |
authenticate(Context context,
java.lang.String username,
java.lang.String password,
java.lang.String realm,
javax.servlet.http.HttpServletRequest request)
Authenticate the given or implicit credentials.
|
boolean |
canSelfRegister(Context context,
javax.servlet.http.HttpServletRequest request,
java.lang.String username)
Indicate whether or not a particular user can self-register, based on
e-mail address.
|
int[] |
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)
Initialize a new e-person record for a self-registered new user.
|
boolean |
isImplicit()
Predicate, is this an implicit authentication method.
|
java.lang.String |
loginPageTitle(Context context)
Get title of login page to which to redirect.
|
java.lang.String |
loginPageURL(Context context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Get login page to which to redirect.
|
protected int |
swordCompatibility(Context context,
java.lang.String username,
java.lang.String password,
javax.servlet.http.HttpServletRequest request)
Provide password-based authentication to enable sword compatibility.
|
public int authenticate(Context context, java.lang.String username, java.lang.String password, java.lang.String realm, javax.servlet.http.HttpServletRequest request) throws java.sql.SQLException
EPerson. If an EPerson is found it is set in
the Context that was passed.
DSpace supports authentication using NetID, or email address. A user's NetID
is a unique identifier from the IdP that identifies a particular user. The
NetID can be of almost any form such as a unique integer, string, or with
Shibboleth 2.0 you can use "targeted ids". You will need to coordinate with
your Shibboleth federation or identity provider. There are three ways to
supply identity information to DSpace:
1) NetID from Shibboleth Header (best)
The NetID-based method is superior because users may change their email
address with the identity provider. When this happens DSpace will not be
able to associate their new address with their old account.
2) Email address from Shibboleth Header (okay)
In the case where a NetID header is not available or not found DSpace
will fall back to identifying a user based-upon their email address.
3) Tomcat's Remote User (worst)
In the event that neither Shibboleth headers are found then as a last
resort DSpace will look at Tomcat's remote user field. This is the least
attractive option because Tomcat has no way to supply additional
attributes about a user. Because of this the autoregister option is not
supported if this method is used.
Identity Scheme Migration Strategies:
If you are currently using Email based authentication (either 1 or 2) and
want to upgrade to NetID based authentication then there is an easy path.
Simply enable Shibboleth to pass the NetID attribute and set the netid-header
below to the correct value. When a user attempts to log in to DSpace first
DSpace will look for an EPerson with the passed NetID, however when this
fails DSpace will fall back to email based authentication. Then DSpace will
update the user's EPerson account record to set their netid so all future
authentications for this user will be based upon netid. One thing to note
is that DSpace will prevent an account from switching NetIDs. If an account
already has a NetID set and then they try and authenticate with a
different NetID the authentication will fail.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 - Not used by Shibboleth-based authenticationrequest - The HTTP request that started this operation, or null if not
applicable.
Meaning:
SUCCESS - authenticated OK.
BAD_CREDENTIALS - user exists, but credentials (e.g. passwd)
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/pw not appropriate for this method
java.sql.SQLExceptionpublic 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 boolean allowSetPassword(Context context, javax.servlet.http.HttpServletRequest request, java.lang.String email) throws java.sql.SQLException
allowSetPassword in interface AuthenticationMethodcontext - DSpace contextrequest - HTTP request, in case anything in that is used to decideemail - e-mail address of user attempting to registerjava.sql.SQLExceptionpublic boolean isImplicit()
isImplicit in interface AuthenticationMethodpublic boolean canSelfRegister(Context context, javax.servlet.http.HttpServletRequest request, java.lang.String username) throws java.sql.SQLException
canSelfRegister in interface AuthenticationMethodcontext - DSpace contextrequest - HTTP request, in case anything in that is used to decideusername - e-mail address of user attempting to registerjava.sql.SQLExceptionpublic void initEPerson(Context context, javax.servlet.http.HttpServletRequest request, EPerson eperson) throws java.sql.SQLException
initEPerson in interface AuthenticationMethodcontext - DSpace contextrequest - HTTP request, in case it's neededeperson - newly created EPerson record - email + information from the
registration form will have been filled out.java.sql.SQLExceptionpublic java.lang.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 java.lang.String loginPageTitle(Context context)
loginPageTitle in interface AuthenticationMethodcontext - DSpace context, will be modified (ePerson set) upon success.protected int swordCompatibility(Context context, java.lang.String username, java.lang.String password, javax.servlet.http.HttpServletRequest request) throws java.sql.SQLException
context - The DSpace database contextusername - The usernamepassword - The passwordrequest - The HTTP Requestjava.sql.SQLExceptionCopyright © 2018 DuraSpace. All Rights Reserved.