public class X509Authentication extends Object implements AuthenticationMethod
See the AuthenticationMethod interface for more details.
Configuration:
x509.keystore.path = path to Java keystore file keystore.password = password to access the keystore ca.cert = path to certificate file for CA whose client certs to accept. autoregister = "true" if E-Person is created automatically for unknown new users. groups = comma-delimited list of special groups to add user to if authenticated. emaildomain = email address domain (after the 'at' symbol) to match before allowing membership in special groups.Only one of the "
keystore.path" or "ca.cert"
options is required. If you supply a keystore, then all of the "trusted"
certificates in the keystore represent CAs whose client certificates will be
accepted. The ca.cert option only allows a single CA to be
named.
You can configure both a keystore and a CA cert, and both will be used.
The autoregister configuration parameter determines what the
canSelfRegister() method returns. It also allows an EPerson
record to be created automatically when the presented certificate is
acceptable but there is no corresponding EPerson.
| Modifier and Type | Field and Description |
|---|---|
protected AuthenticationService |
authenticationService |
protected ConfigurationService |
configurationService |
protected EPersonService |
ePersonService |
protected GroupService |
groupService |
BAD_ARGS, BAD_CREDENTIALS, CERT_REQUIRED, NO_SUCH_USER, SUCCESS| Constructor and Description |
|---|
X509Authentication() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowSetPassword(Context context,
javax.servlet.http.HttpServletRequest request,
String username)
We don't use EPerson password so there is no reason to change it.
|
int |
authenticate(Context context,
String username,
String password,
String realm,
javax.servlet.http.HttpServletRequest request)
X509 certificate authentication.
|
boolean |
canSelfRegister(Context context,
javax.servlet.http.HttpServletRequest request,
String username)
Predicate, can new user automatically create EPerson.
|
List<Group> |
getSpecialGroups(Context context,
javax.servlet.http.HttpServletRequest request)
Return special groups configured in dspace.cfg for X509 certificate
authentication.
|
void |
initEPerson(Context context,
javax.servlet.http.HttpServletRequest request,
EPerson eperson)
Nothing extra to initialize.
|
boolean |
isImplicit()
Returns true, this is an implicit method.
|
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.
|
protected AuthenticationService authenticationService
protected EPersonService ePersonService
protected GroupService groupService
protected ConfigurationService configurationService
public boolean canSelfRegister(Context context, javax.servlet.http.HttpServletRequest request, String username) throws SQLException
canSelfRegister in interface AuthenticationMethodcontext - DSpace contextrequest - HTTP request, in case it's needed. May be null.username - Username, if available. May be null.SQLException - if database errorpublic 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 - if database errorpublic 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.SQLException - if database errorpublic boolean isImplicit()
isImplicit in interface AuthenticationMethodpublic List<Group> getSpecialGroups(Context context, javax.servlet.http.HttpServletRequest request) throws SQLException
getSpecialGroups in interface AuthenticationMethodcontext - contextrequest - object potentially containing the certSQLException - if database errorpublic int authenticate(Context context, String username, String password, String realm, javax.servlet.http.HttpServletRequest request) throws SQLException
ServletRequest object.
"authentication.x509.autoregister" configuration
parameter is checked (via canSelfRegister())
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.SQLException - if database errorpublic 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.Copyright © 2017 DuraSpace. All rights reserved.