Note that there are some explanatory texts on larger screens.

plurals
  1. POPorting WebSphere code to get remote credentials to Tomcat
    primarykey
    data
    text
    <p>I have been asked to look into porting some code from a web app under IBM WAS 7 so that it will run under Tomcat 7.</p> <p>This is part of a larger SPNEGO/Kerberos SSO system but for purposes of discussion I have distilled the code down to the following that shows the dependencies on the two WebSphere classes AccessController and WSSubject:</p> <pre><code>GSSCredential clientCreds = (GSSCredential) com.ibm.ws.security.util.AccessController.doPrivileged(new java.security.PrivilegedAction() { public Object run() { javax.security.auth.Subject subject = com.ibm.websphere.security.auth.WSSubject.getCallerSubject(); GSSCredential clientCreds = (GSSCredential) subject.getPrivateCredentials(GSSCredential.class).iterator().next(); return clientCreds; } }); </code></pre> <p>I'd like to be able to do this in Tomcat.</p> <p>[edit] I think the distilled code above perhaps doesn't explain clearly what is needed. I don't need to configure Tomcat to control access to the web app, nor do I need to impersonate the remote user. What I actually need is the unencrypted Kerberos ticket so that I can pass it to another process that will complete the authentication. Here is a more complete snippet:</p> <pre><code>com.ibm.ws.security.util.AccessController.doPrivileged(new java.security.PrivilegedAction() { public Object run() { Oid krb5Mechanism = new Oid("1.2.840.113554.1.2.2"); Oid krb5PrincipalNameType = new Oid("1.2.840.113554.1.2.2.1"); GSSManager manager = GSSManager.getInstance(); GSSName serverName = manager.createName("HOST/my.host.org", krb5PrincipalNameType); javax.security.auth.Subject subject = com.ibm.websphere.security.auth.WSSubject.getCallerSubject(); GSSCredential clientCreds = (GSSCredential) subject.getPrivateCredentials(GSSCredential.class).iterator().next(); GSSContext secContext = manager.createContext(serverName, krb5Mechanism, clientCreds, GSSContext.DEFAULT_LIFETIME); // After this the Kerberos ticket is extracted from secContext, converted to a String and passed to the other process for authentication } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload