GSSCredential Creation

GSSManager has two credential creation methods. The only difference between the two methods is that one returns credentials for a single mechanism whereas the other returns credentials for an array of mechanisms. Specifying a null mechanism will return credentials for the default mechanism. Specifying a null array of mechanisms will result in credentials for the default set of mechanisms. The only IBM JGSS default mechanism is the Kerberos V5 mechanism.

Only one of three credentials types (initiate, accept, initiate and accept) can be created at a time. A context initiator creates initiate credentials, the acceptor creates accept credentials, and an acceptor that will also behave as initiator creates initiate and accept credentials.

To obtain Kerberos V5 credentials for the initiator "foo" with the default validity period:
GSSCredential fooCreds = manager.createCredential(fooName, GSSCredential.DEFAULT_LIFETIME, krb5Mech,GSSCredential.INITIATE_ONLY);
To obtain an all-default acceptor credential:
GSSCredential serverCreds = manager.createCredential(null, GSSCredential.DEFAULT_LIFETIME, (Oid)null, GSSCredential.ACCEPT_ONLY);