New modules/authentication-x509.cfg

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@6572 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Stuart Lewis
2011-08-19 04:29:33 +00:00
parent 8b0fab90ff
commit 2c7562afa4
3 changed files with 56 additions and 24 deletions

View File

@@ -51,27 +51,27 @@ import org.dspace.eperson.Group;
* <b>Configuration:</b> * <b>Configuration:</b>
* *
* <pre> * <pre>
* authentication.x509.keystore.path = * x509.keystore.path =
* <em> * <em>
* path to Java keystore file * path to Java keystore file
* </em> * </em>
* authentication.x509.keystore.password = * keystore.password =
* <em> * <em>
* password to access the keystore * password to access the keystore
* </em> * </em>
* authentication.x509.ca.cert = * ca.cert =
* <em> * <em>
* path to certificate file for CA whose client certs to accept. * path to certificate file for CA whose client certs to accept.
* </em> * </em>
* authentication.x509.autoregister = * autoregister =
* <em> * <em>
* &quot;true&quot; if E-Person is created automatically for unknown new users. * &quot;true&quot; if E-Person is created automatically for unknown new users.
* </em> * </em>
* authentication.x509.groups = * groups =
* <em> * <em>
* comma-delimited list of special groups to add user to if authenticated. * comma-delimited list of special groups to add user to if authenticated.
* </em> * </em>
* authentication.x509.emaildomain = * emaildomain =
* <em> * <em>
* email address domain (after the 'at' symbol) to match before allowing * email address domain (after the 'at' symbol) to match before allowing
* membership in special groups. * membership in special groups.
@@ -123,22 +123,16 @@ public class X509Authentication implements AuthenticationMethod
* authentication when selected by the user rather than implicitly. * authentication when selected by the user rather than implicitly.
*/ */
loginPageTitle = ConfigurationManager loginPageTitle = ConfigurationManager
.getProperty("authentication.x509.chooser.title.key"); .getProperty("authentication-x509", "chooser.title.key");
loginPageURL = ConfigurationManager loginPageURL = ConfigurationManager
.getProperty("authentication.x509.chooser.uri"); .getProperty("authentication-x509", "chooser.uri");
String keystorePath = ConfigurationManager String keystorePath = ConfigurationManager
.getProperty("authentication.x509.keystore.path"); .getProperty("authentication-x509", "keystore.path");
String keystorePassword = ConfigurationManager String keystorePassword = ConfigurationManager
.getProperty("authentication.x509.keystore.password"); .getProperty("authentication-x509", "keystore.password");
String caCertPath = ConfigurationManager String caCertPath = ConfigurationManager
.getProperty("authentication.x509.ca.cert"); .getProperty("authentication-x509", "ca.cert");
// backward-compatible kludge
if (caCertPath == null)
{
caCertPath = ConfigurationManager.getProperty("webui.cert.ca");
}
// First look for keystore full of trusted certs. // First look for keystore full of trusted certs.
if (keystorePath != null) if (keystorePath != null)
@@ -291,10 +285,10 @@ public class X509Authentication implements AuthenticationMethod
* Verify CERTIFICATE against KEY. Return true if and only if CERTIFICATE is * Verify CERTIFICATE against KEY. Return true if and only if CERTIFICATE is
* valid and can be verified against KEY. * valid and can be verified against KEY.
* *
* @param context
* The current DSpace context
* @param certificate - * @param certificate -
* An X509 certificate object * An X509 certificate object
* @param key -
* PublicKey to check the certificate against.
* @return - True if CERTIFICATE is valid and can be verified against KEY, * @return - True if CERTIFICATE is valid and can be verified against KEY,
* false otherwise. * false otherwise.
*/ */
@@ -383,7 +377,7 @@ public class X509Authentication implements AuthenticationMethod
String username) throws SQLException String username) throws SQLException
{ {
return ConfigurationManager return ConfigurationManager
.getBooleanProperty("authentication.x509.autoregister"); .getBooleanProperty("authentication-x509", "autoregister");
} }
/** /**
@@ -423,9 +417,9 @@ public class X509Authentication implements AuthenticationMethod
String x509GroupConfig = null; String x509GroupConfig = null;
x509GroupConfig = ConfigurationManager x509GroupConfig = ConfigurationManager
.getProperty("authentication.x509.groups"); .getProperty("authentication-x509", "groups");
if (null != x509GroupConfig && !x509GroupConfig.equals("")) if (null != x509GroupConfig && !"".equals(x509GroupConfig))
{ {
String[] groups = x509GroupConfig.split("\\s*,\\s*"); String[] groups = x509GroupConfig.split("\\s*,\\s*");
@@ -456,7 +450,7 @@ public class X509Authentication implements AuthenticationMethod
HttpSession session = request.getSession(true); HttpSession session = request.getSession(true);
if (null != emailDomain && !emailDomain.equals("")) if (null != emailDomain && !"".equals(emailDomain))
{ {
if (email.substring(email.length() - emailDomain.length()).equals( if (email.substring(email.length() - emailDomain.length()).equals(
emailDomain)) emailDomain))

View File

@@ -0,0 +1,19 @@
#### Example of configuring X.509 authentication
#### (to use add org.dspace.authenticate.X509Authentication to auth stack above)
## method 1, using keystore
#keystore.path = /tomcat/conf/keystore
#keystore.password = changeit
## method 2, using CA certificate
#ca.cert = ${dspace.dir}/config/MyClientCA.pem
## Create e-persons for unknown names in valid certificates?
#autoregister = true
## Allow Certificate auth to show as a choice in chooser
# Use Messages.properties key for title
#chooser.title.key=org.dspace.eperson.X509Authentication.title
#
# Identify the location of the Certificate Login Servlet.
#chooser.uri=/certificate-login

View File

@@ -0,0 +1,19 @@
#### Example of configuring X.509 authentication
#### (to use add org.dspace.authenticate.X509Authentication to auth stack above)
## method 1, using keystore
#keystore.path = /tomcat/conf/keystore
#keystore.password = changeit
## method 2, using CA certificate
#ca.cert = ${dspace.dir}/config/MyClientCA.pem
## Create e-persons for unknown names in valid certificates?
#autoregister = true
## Allow Certificate auth to show as a choice in chooser
# Use Messages.properties key for title
#chooser.title.key=org.dspace.eperson.X509Authentication.title
#
# Identify the location of the Certificate Login Servlet.
#chooser.uri=/certificate-login