Using a different GSSCredential for JNDI GSSAPI login
I have a server program which authenticates to a kerberos server using the GSSAPI Mechanisem. When I connect to my LDAP server using GSSAPI, it uses it's own credential by default. But what I want is to use a different GSSCredential, forwarded by the client to the server.
I have tried creating a Subject whit this GSSCredential and using doAs... which resulted in a "can not find ticket" error.
I have also tried creating a SocketFactory, which uses the credential to establish a security context whit the ldap server. But I can not let JNDI pickup the socket correctly. It always does a simple bind, or other which kills the socket connection.
So how should I use a GSSCredential to authenticate whit my ldap server using JNDI?

