0

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.

Aymeric
  • 1,324
  • 3
  • 15
  • 33

2 Answers2

2

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

Grant Cermak
  • 1,808
  • 1
  • 19
  • 23
0

If you look at this document:

Generic Security Service API Version 2 : Java Bindings

This document explains a lot about GSS and gives a couple examples. One section of the document explains which interfaces implement functionality of the GSS-API routines you mentioned above.

gss_import_name : implemented by the GSSManager class.

gss_init_sec_context: implemented by the GSSContext interface.

Kevin S
  • 2,713
  • 24
  • 31