From: markt
- * TODO:
- *
- * TBDs:
- * Implementation of Realm that works with a directory
@@ -415,6 +416,14 @@ public class JNDIRealm extends RealmBase {
*/
protected int timeLimit = 0;
+
+ /**
+ * Should delegated credentials from the SPNEGO authenticator be used if
+ * available
+ */
+ protected boolean useDelegatedCredential = true;
+
+
// ------------------------------------------------------------- Properties
/**
@@ -950,6 +959,15 @@ public class JNDIRealm extends RealmBase {
}
+
+ public boolean isUseDelegatedCredential() {
+ return useDelegatedCredential;
+ }
+
+ public void setUseDelegatedCredential(boolean useDelegatedCredential) {
+ this.useDelegatedCredential = useDelegatedCredential;
+ }
+
/**
* Return descriptive information about this Realm implementation and
* the corresponding version number, in the format
@@ -1935,6 +1953,12 @@ public class JNDIRealm extends RealmBase {
*/
@Override
protected Principal getPrincipal(String username) {
+ return getPrincipal(username, null);
+ }
+
+ @Override
+ protected Principal getPrincipal(String username,
+ GSSCredential gssCredential) {
DirContext context = null;
Principal principal = null;
@@ -1949,7 +1973,7 @@ public class JNDIRealm extends RealmBase {
try {
// Authenticate the specified username if possible
- principal = getPrincipal(context, username);
+ principal = getPrincipal(context, username, gssCredential);
} catch (CommunicationException e) {
@@ -1964,7 +1988,7 @@ public class JNDIRealm extends RealmBase {
context = open();
// Try the authentication again.
- principal = getPrincipal(context, username);
+ principal = getPrincipal(context, username, gssCredential);
} catch (ServiceUnavailableException e) {
@@ -1979,7 +2003,7 @@ public class JNDIRealm extends RealmBase {
context = open();
// Try the authentication again.
- principal = getPrincipal(context, username);
+ principal = getPrincipal(context, username, gssCredential);
}
@@ -2012,14 +2036,52 @@ public class JNDIRealm extends RealmBase {
* Return the Principal associated with the given user name.
*/
protected synchronized Principal getPrincipal(DirContext context,
- String username)
+ String username, GSSCredential gssCredential)
throws NamingException {
- User user = getUser(context, username);
+ User user = null;
+ List When processing users authenticated via the GSS-API, this attribute
+ controls if any "@..." is removed from the end of the user
+ name. If not specified, the default is Name of the column, in the "users" table, which contains
the user's credentials (i.e. password(. If a value for the
@@ -224,6 +230,12 @@
a role name assigned to the corresponding user. When processing users authenticated via the GSS-API, this attribute
+ controls if any "@..." is removed from the end of the user
+ name. If not specified, the default is Name of the column, in the "users" table, which contains
the user's credentials (i.e. password(. If a value for the
@@ -420,7 +432,9 @@
user currently being authenticated? If false,
- *
- *
- *
*/
public class SpnegoAuthenticator extends AuthenticatorBase {
diff --git a/java/org/apache/catalina/realm/JNDIRealm.java b/java/org/apache/catalina/realm/JNDIRealm.java
index 430ad4811..a65802af4 100644
--- a/java/org/apache/catalina/realm/JNDIRealm.java
+++ b/java/org/apache/catalina/realm/JNDIRealm.java
@@ -56,6 +56,7 @@ import org.apache.catalina.LifecycleException;
import org.apache.catalina.util.Base64;
import org.apache.tomcat.util.buf.ByteChunk;
import org.apache.tomcat.util.buf.CharChunk;
+import org.ietf.jgss.GSSCredential;
/**
* true.true.connectionName} and connectionPassword will be
used if specified, else an anonymous. If not specified, the default
- value of false is used.false is used. Note that when accessing the
+ directory using delegated credentials, this attribute is always ignored
+ and the search is performed using the delegated credentials.
0 is used which indicates no limit.
When processing users authenticated via the GSS-API, this attribute
+ controls if any "@..." is removed from the end of the user
+ name. If not specified, the default is true.
Specifies the time (in milliseconds) to wait for records to be
returned when using the userSearch attribute. If not
@@ -444,6 +464,14 @@
limit.
When the JNIRealm is used with the SPNEGO authenticator, delegated
+ credentials for the user may be available. If such credentials are
+ present, this attribute controls whether are not they are used to
+ connect to the directory. If not specified, the default value of
+ true is used.
The base element for user searches performed using the
userSearch expression. Not used if you are using
@@ -471,7 +499,11 @@
actual username should be inserted. You can use this property
instead of userSearch, userSubtree
and userBase when the distinguished name contains
- the username and is otherwise the same for all users.
userSearch,
+ userSubtree and userBase are always
+ used instead.
conf/tomcat-users.xml.
When processing users authenticated via the GSS-API, this attribute
+ controls if any "@..." is removed from the end of the user
+ name. If not specified, the default is true.
The XML document referenced by the pathname attribute must
@@ -634,6 +672,12 @@
for your role Principals.
When processing users authenticated via the GSS-API, this attribute
+ controls if any "@..." is removed from the end of the user
+ name. If not specified, the default is true.
Instructs JAASRealm to use the context class loader for loading the
user-specified LoginModule class and associated
diff --git a/webapps/docs/windows-auth-howto.xml b/webapps/docs/windows-auth-howto.xml
index a954f5279..eff4771a3 100644
--- a/webapps/docs/windows-auth-howto.xml
+++ b/webapps/docs/windows-auth-howto.xml
@@ -51,10 +51,18 @@ sections.
This is a work in progress. This warning should be removed once the -various questions and TODOs (see the Javadoc and implementation class) have been -resolved. In particular, onwards delegation is not yet supported and -roles are not retrieved from the domain controller.
+This is a work in progress. There are a number of outstanding +questions that require further testing. These include: +
There are four components to the configuration of the built-in Tomcat support for Windows authentication. The domain controller, the server hosting Tomcat, the web application wishing to use Windows authentication and the client @@ -156,6 +164,10 @@ com.sun.security.jgss.krb5.accept { is automatically set to the required value of false if a web application is configured to use the SPNEGO authentication method.
+The SPNEGO authenticator will work with any + Realm but if used with the JNDI Realm, by default the JNDI Realm will use + the user's delegated credentials to connect to the Active Directory. +
The above steps have been tested on a Tomcat server running Windows Server 2008 R2 64-bit Standard with an Oracle 1.6.0_24 64-bit JDK.