I'm creating a small application(for now) that needs to generate a Token with Kerberos library. The two methods equivalent I'm searching for are the gss_import_name and gss_init_sec_context methods. I have found several examples in other languages: C,C++ and C#, but none in Java. I'm not even sure of which library to import in my application. If someone has an answer to my question it would be very helpful to me.
Cordially, Ephismen.
解决方案
The package you want to use is sun.security.jgss. In that package you will find you can do the following:
byte[] kerberosTicket;
GSSContext context = GSSManager.getInstance().createContext((GSSCredential);
context.initSecContext(kerberosTicket, 0, kerberosTicket.length);
String user = context.getSrcName().toString();
context.dispose();
return user;
The only implementation of GSSContext is GSSContextImpl which is also in the same package.
Grant