From bd69fd15bae710653f2b6b0573c16871bee93d24 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 4 Oct 2010 22:28:04 +0000 Subject: [PATCH] 326734 Configure Digest maxNonceAge with Security handler init param git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2317 7e9141cc-0065-0410-87d8-b60c137991c4 --- VERSION.txt | 2 +- .../eclipse/jetty/security/Authenticator.java | 15 ++++++++++++++- .../authentication/DigestAuthenticator.java | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 990acd6b2e0..7401e830b16 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,6 +1,6 @@ jetty-7.2.0.RC1-SNAPSHOT - + 289540 added javadoc into distribution + + 326734 Configure Digest maxNonceAge with Security handler init param jetty-7.2.0.RC0 1 Oct 2010 + 314087 Simplified SelectorManager diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/Authenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/Authenticator.java index ef18620371f..7d65c482484 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/Authenticator.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/Authenticator.java @@ -85,8 +85,21 @@ public interface Authenticator { String getAuthMethod(); String getRealmName(); - String getInitParameter(String key); + + /** Get a SecurityHandler init parameter + * @see SecurityHandler#getInitParameter(String) + * @param param parameter name + * @return Parameter value or null + */ + String getInitParameter(String param); + + /* ------------------------------------------------------------ */ + /** Get a SecurityHandler init parameter names + * @see SecurityHandler#getInitParameterNames() + * @return Set of parameter names + */ Set getInitParameterNames(); + LoginService getLoginService(); IdentityService getIdentityService(); boolean isSessionRenewedOnAuthentication(); diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java index ad5295f5385..b7756c5b16e 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DigestAuthenticator.java @@ -25,6 +25,8 @@ import org.eclipse.jetty.http.HttpHeaders; import org.eclipse.jetty.http.security.B64Code; import org.eclipse.jetty.http.security.Constraint; import org.eclipse.jetty.http.security.Credential; +import org.eclipse.jetty.security.Authenticator.AuthConfiguration; +import org.eclipse.jetty.security.SecurityHandler; import org.eclipse.jetty.security.ServerAuthException; import org.eclipse.jetty.security.UserAuthentication; import org.eclipse.jetty.server.Authentication; @@ -38,6 +40,9 @@ import org.eclipse.jetty.util.log.Log; /** * @version $Rev: 4793 $ $Date: 2009-03-19 00:00:01 +0100 (Thu, 19 Mar 2009) $ + * + * The nonce max age can be set with the {@link SecurityHandler#setInitParameter(String, String)} + * using the name "maxNonceAge" */ public class DigestAuthenticator extends LoginAuthenticator { @@ -50,6 +55,20 @@ public class DigestAuthenticator extends LoginAuthenticator super(); } + /* ------------------------------------------------------------ */ + /** + * @see org.eclipse.jetty.security.authentication.LoginAuthenticator#setConfiguration(org.eclipse.jetty.security.Authenticator.AuthConfiguration) + */ + @Override + public void setConfiguration(AuthConfiguration configuration) + { + super.setConfiguration(configuration); + + String mna=configuration.getInitParameter("maxNonceAge"); + if (mna!=null) + _maxNonceAge=Long.valueOf(mna); + } + public String getAuthMethod() { return Constraint.__DIGEST_AUTH;