GSSContext Creation
GSSManager has three methods for creating a context, one for use by the context initiator, one by the acceptor, and one for recreating a previously exported context. An initiator context cannot be used for context acceptance and vice-versa. Each of the first two methods requires a credential as input, but null can be specified for the default credential to be used.
To create a context, valid for the default period, with which "foo"
can initiate a context with its peer "superSecureServer" running on
the host "securityCentral":
GSSName serverName = manager.createName("superSecureServer@securityCentral", GSSName.NT_HOSTBASED_SERVICE, krb5Mech);
GSSContext fooContext = manager.createContext(serverName, krb5Mech, fooCreds, GSSCredential.DEFAULT_LIFETIME);To create a context for "superSecureServer" to accept contexts
initiated by any peer,
GSSContext serverAcceptorContext = manager.createContext(serverCreds);Note: The name of the acceptor context created for the server.
It indicates that a server can simultaneously possess and use both
an acceptor and an initiator context.