Interface ExtendedGSSContext
- All Superinterfaces:
GSSContext
org.ietf.jgss.GSSContext,
such as querying context-specific attributes.- Since:
- 1.7
-
Field Summary
Fields declared in interface GSSContext
DEFAULT_LIFETIME, INDEFINITE_LIFETIMEModifier and TypeFieldDescriptionstatic final intA lifetime constant representing the default context lifetime.static final intA lifetime constant representing indefinite context lifetime. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the delegation policy response.inquireSecContext(InquireType type) Return the mechanism-specific attribute associated withtype.voidrequestDelegPolicy(boolean state) Requests that the delegation policy be respected.Methods declared in interface GSSContext
acceptSecContext, acceptSecContext, dispose, export, getAnonymityState, getConfState, getCredDelegState, getDelegCred, getIntegState, getLifetime, getMech, getMIC, getMIC, getMutualAuthState, getReplayDetState, getSequenceDetState, getSrcName, getTargName, getWrapSizeLimit, initSecContext, initSecContext, isEstablished, isInitiator, isProtReady, isTransferable, requestAnonymity, requestConf, requestCredDeleg, requestInteg, requestLifetime, requestMutualAuth, requestReplayDet, requestSequenceDet, setChannelBinding, unwrap, unwrap, verifyMIC, verifyMIC, wrap, wrapModifier and TypeMethodDescriptionbyte[]acceptSecContext(byte[] inToken, int offset, int len) Called by the context acceptor upon receiving a token from the peer.voidacceptSecContext(InputStream inStream, OutputStream outStream) Deprecated.The stream-based methods have been removed from RFC 8353.voiddispose()Releases any system resources and cryptographic information stored in the context object and invalidates the context.byte[]export()Exports this context so that another process may import it.booleanDetermines if the context initiator is anonymously authenticated to the context acceptor.booleanDetermines if data confidentiality is available over the context.booleanDetermines if credential delegation is enabled on this context.Obtains the credentials delegated by the context initiator to the context acceptor.booleanDetermines if data integrity is available over the context.intDetermines what the remaining lifetime for this context is.getMech()Determines what mechanism is being used for this context.byte[]getMIC(byte[] inMsg, int offset, int len, MessageProp msgProp) Returns a token containing a cryptographic Message Integrity Code (MIC) for the supplied message, for transfer to the peer application.voidgetMIC(InputStream inStream, OutputStream outStream, MessageProp msgProp) Deprecated.The stream-based methods have been removed from RFC 8353.booleanDetermines if mutual authentication is enabled on this context.booleanDetermines if replay detection is enabled for the per-message security services from this context.booleanDetermines if sequence checking is enabled for the per-message security services from this context.Returns the name of the context initiator.Returns the name of the context acceptor.intgetWrapSizeLimit(int qop, boolean confReq, int maxTokenSize) Used to determine limits on the size of the message that can be passed towrap.byte[]initSecContext(byte[] inputBuf, int offset, int len) Called by the context initiator to start the context creation phase and process any tokens generated by the peer'sacceptSecContextmethod.intinitSecContext(InputStream inStream, OutputStream outStream) Deprecated.The stream-based methods have been removed from RFC 8353.booleanUsed during context establishment to determine the state of the context.booleanDetermines if this is the context initiator.booleanDetermines if the context is ready for per message operations to be used over it.booleanDetermines if the context is transferable to other processes through the use of theexportmethod.voidrequestAnonymity(boolean state) Requests that the initiator's identity not be disclosed to the acceptor.voidrequestConf(boolean state) Requests that data confidentiality be enabled for thewrapmethod.voidrequestCredDeleg(boolean state) Requests that the initiator's credentials be delegated to the acceptor during context establishment.voidrequestInteg(boolean state) Requests that data integrity be enabled for thewrapandgetMICmethods.voidrequestLifetime(int lifetime) Requests a lifetime in seconds for the context.voidrequestMutualAuth(boolean state) Requests that mutual authentication be done during context establishment.voidrequestReplayDet(boolean state) Requests that replay detection be enabled for the per-message security services after context establishment.voidrequestSequenceDet(boolean state) Requests that sequence checking be enabled for the per-message security services after context establishment.voidSets the channel bindings to be used during context establishment.byte[]unwrap(byte[] inBuf, int offset, int len, MessageProp msgProp) Used to process tokens generated by thewrapmethod on the other side of the context.voidunwrap(InputStream inStream, OutputStream outStream, MessageProp msgProp) Deprecated.The stream-based methods have been removed from RFC 8353.voidverifyMIC(byte[] inToken, int tokOffset, int tokLen, byte[] inMsg, int msgOffset, int msgLen, MessageProp msgProp) Verifies the cryptographic MIC, contained in the token parameter, over the supplied message.voidverifyMIC(InputStream tokStream, InputStream msgStream, MessageProp msgProp) Deprecated.The stream-based methods have been removed from RFC 8353.byte[]wrap(byte[] inBuf, int offset, int len, MessageProp msgProp) Applies per-message security services over the established security context.voidwrap(InputStream inStream, OutputStream outStream, MessageProp msgProp) Deprecated.The stream-based methods have been removed from RFC 8353.
-
Method Details
-
inquireSecContext
Return the mechanism-specific attribute associated withtype.Example:
GSSContext ctxt = m.createContext(...) // Establishing the context if (ctxt instanceof ExtendedGSSContext) { ExtendedGSSContext ex = (ExtendedGSSContext)ctxt; try { Key key = (key)ex.inquireSecContext( InquireType.KRB5_GET_SESSION_KEY); // read key info } catch (GSSException gsse) { // deal with exception } }- Parameters:
type- the type of the attribute requested- Returns:
- the attribute, see the method documentation for details.
- Throws:
GSSException- containing the following major error codes:GSSException.BAD_MECHif the mechanism does not support this method,GSSException.UNAVAILABLEif the type specified is not supported,GSSException.NO_CONTEXTif the security context is invalid,GSSException.FAILUREfor other unspecified failures.- See Also:
-
requestDelegPolicy
Requests that the delegation policy be respected. When a true value is requested, the underlying context would use the delegation policy defined by the environment as a hint to determine whether credentials delegation should be performed. This request can only be made on the context initiator's side and it has to be done prior to the first call toinitSecContext.When this flag is false, delegation will only be tried when the
credentials delegation flagis true.When this flag is true but the
credentials delegation flagis false, delegation will be only tried if the delegation policy permits delegation.When both this flag and the
credentials delegation flagare true, delegation will be always tried. However, if the delegation policy does not permit delegation, the value ofgetDelegPolicyState()will be false, even if delegation is performed successfully.In any case, if the delegation is not successful, the value returned by
GSSContext.getCredDelegState()is false, and the value returned bygetDelegPolicyState()is also false.Not all mechanisms support delegation policy. Therefore, the application should check to see if the request was honored with the
getDelegPolicyStatemethod. When delegation policy is not supported,requestDelegPolicyshould return silently without throwing an exception.Note: for the Kerberos 5 mechanism, the delegation policy is expressed through the OK-AS-DELEGATE flag in the service ticket. When it's true, the KDC permits delegation to the target server. In a cross-realm environment, in order for delegation be permitted, all cross-realm TGTs on the authentication path must also have the OK-AS-DELAGATE flags set.
- Parameters:
state- true if the policy should be respected- Throws:
GSSException- containing the following major error codes:GSSException.FAILURE
-
getDelegPolicyState
boolean getDelegPolicyState()Returns the delegation policy response. Called after a security context is established. This method can be only called on the initiator's side. SeerequestDelegPolicy(boolean).- Returns:
- the delegation policy response
-