Interface SaslContext
- All Known Subinterfaces:
SaslClientContext
,SaslServerContext
public interface SaslContext
The basic SASL context APIs common to both client and server sides of the SASL exchange.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Indicates the role that this SASL context plays either server or client. -
Method Summary
Modifier and TypeMethodDescriptionReturns a mutable context that the application layer can use to store meaningful data for itself in relation to this specific SASL context object.Returns the mechanism that was sent to the server to select the SASL mechanism to use for negotiations.The DNS name of the host (either fully qualified or relative) that was sent to the server which define the host the sending peer is connecting to.<T> T
<T> T
getLinkedResource
(Class<T> typeClass) Gets the linked resource (if set) and returns it using the type information provided to cast the returned value.getRole()
Return the Role of the context implementation.Provides a low level outcome value for the SASL authentication process.Returns a SaslState that indicates the current operating state of the SASL negotiation process or conversely if no SASL layer is configured this method should return the no-SASL state.Symbol[]
After the server has sent its supported mechanisms this method will return a copy of that list for review by the server event handler.default boolean
isClient()
boolean
isDone()
default boolean
isServer()
setLinkedResource
(Object resource) Links a given resource to thisSaslContext
.
-
Method Details
-
setLinkedResource
Links a given resource to thisSaslContext
.- Parameters:
resource
- The resource to link to thisSaslContext
.- Returns:
- this
SaslContext
instance.
-
getLinkedResource
<T> T getLinkedResource()- Type Parameters:
T
- The type that the linked resource should be cast to on return.- Returns:
- the user set linked resource for this
SaslContext
instance.
-
getLinkedResource
Gets the linked resource (if set) and returns it using the type information provided to cast the returned value.- Type Parameters:
T
- The type to cast the linked resource to if one is set.- Parameters:
typeClass
- the type's Class which is used for casting the returned value.- Returns:
- the user set linked resource for this Context instance.
- Throws:
ClassCastException
- if the linked resource cannot be cast to the type requested.
-
getAttachments
Attachments getAttachments()Returns a mutable context that the application layer can use to store meaningful data for itself in relation to this specific SASL context object.- Returns:
- the
Attachments
instance that is associated with thisSaslContext
-
getRole
SaslContext.Role getRole()Return the Role of the context implementation.- Returns:
- the Role of this SASL Context
-
isDone
boolean isDone()- Returns:
- true if SASL authentication has completed
-
isServer
default boolean isServer()- Returns:
- true if this is a SASL server context.
-
isClient
default boolean isClient()- Returns:
- true if this is a SASL client context.
-
getSaslOutcome
SaslOutcome getSaslOutcome()Provides a low level outcome value for the SASL authentication process.If the SASL exchange is ongoing or the SASL layer was skipped because a particular engine configuration allows such behavior then this method should return null to indicate no SASL outcome is available.
- Returns:
- the SASL outcome code that results from authentication
-
getSaslState
EngineSaslDriver.SaslState getSaslState()Returns a SaslState that indicates the current operating state of the SASL negotiation process or conversely if no SASL layer is configured this method should return the no-SASL state. This method must never return a null result.- Returns:
- the current state of SASL Authentication.
-
getServerMechanisms
Symbol[] getServerMechanisms()After the server has sent its supported mechanisms this method will return a copy of that list for review by the server event handler. If called before the server has sent the mechanisms list this method will return null.- Returns:
- the mechanisms that the server offered to the client.
-
getChosenMechanism
Symbol getChosenMechanism()Returns the mechanism that was sent to the server to select the SASL mechanism to use for negotiations. If called before the client has sent its chosen mechanism this method returns null.- Returns:
- the SASL mechanism that the client selected to use for negotiation.
-
getHostname
String getHostname()The DNS name of the host (either fully qualified or relative) that was sent to the server which define the host the sending peer is connecting to. If called before the client sent the host name information to the server this method returns null.- Returns:
- the host name the client has requested to connect to.
-