I am using kerberos protocol to authenticate users for Java Swing applications. I am able to successfully authenticate at the client side, but having problems when getting the user credentials and roles on the server side, I have got ejbs which require certain roles to create those ejbs.
jboss-app.xml looks like
<jboss-app>
<security-domain>java:/jaas/spnego-server</security-domain>
<loader-repository>paymenttracker:loader=paymenttracker.ear</loader-repository>
</jboss-app>
The client class calling Subject.doAs(s, lv); lv is a class which extends PrivilegedExceptionAction.
On the server side login-config.xml in jboss server got the following setting
<application-policy name="spnego-server"><authentication>
<login-module code="com.sun.security.auth.module.Krb5LoginModule" flag="required" >
<module-option name="storeKey">true</module-option>
<module-option name="debug">true</module-option>
<module-option name="useKeyTab">true</module-option>
<module-option name="keyTab">file://c:/ker/tem.keytab</module-option>
<module-option name="principal">HTTP/ws6421.ebrd.com</module-option>
<module-option name="doNotPrompt">true</module-option>
<module-option name="isInitiator">false</module-option>
</login-module></authentication>
</application-policy>
getting the following error :
16:09:28,990 INFO [STDOUT] Debug is true storeKey true useTicketCache false useKeyTab true doNotPrompt true
ticketCache is null isInitiator false KeyTab is file://c:/kerberos/ws6421.keytab refreshKrb5Config is false pr
incipal is HTTP/ws6421.my.com tryFirstPass is false useFirstPass is false storePass is false clearPass is fa
lse
16:09:29,087 INFO [STDOUT] principal's key obtained from the keytab
16:09:29,087 INFO [STDOUT] principal is HTTP/[email protected]
16:09:29,088 INFO [STDOUT] EncryptionKey: keyType=23 keyBytes (hex dump)=0000: A9 DD 6C AB C5 D3 A0 9D C8 4
4 18 52 78 3E AB 82 ..l......D.Rx>..
16:09:29,094 INFO [STDOUT] Added server's keyKerberos Principal HTTP/[email protected] Version 0key
EncryptionKey: keyType=23 keyBytes (hex dump)=
0000: A9 DD 6C AB C5 D3 A0 9D C8 44 18 52 78 3E AB 82 ..l......D.Rx>..
16:09:29,095 INFO [STDOUT] [Krb5LoginModule] added Krb5Principal HTTP/[email protected] t
o Subject
16:09:29,098 INFO [STDOUT] Commit Succeeded
16:09:29,135 ERROR [SecurityInterceptor] Error in Security Interceptor
java.lang.SecurityException: Denied: caller with subject=Subject:
Principal: HTTP/[email protected]
Private Credential: Kerberos Principal HTTP/[email protected] Version 0key EncryptionKey: ke
yType=23 keyBytes (hex dump)=
0000: A9 DD 6C AB C5 D3 A0 9D C8 44 18 52 78 3E AB 82 ..l......D.Rx>..
and security context post-mapping roles=null: ejbMethod=public abstract services.ejb.login.SBLogin services.e
jb.login.SBLoginHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException
at org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityContext(SecurityInterceptor.java:368)
at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:243)