Package com.gmt2001.httpwsserver.auth
Interface WsAuthenticationHandler
- All Known Implementing Classes:
WsNoAuthenticationHandler,WsSharedRWTokenAuthenticationHandler
public interface WsAuthenticationHandler
Represents an Authentication Handler for a
WsHandler- Author:
- gmt2001
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AttributeKey<Boolean>Represents theATTR_AUTHENTICATEDattributestatic final AttributeKey<Boolean>Represents theattrSentAuthReplyattribute -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckAuthorization(ChannelHandlerContext ctx, WebSocketFrame frame) Checks if the givenWebSocketFrameis a valid authentication frame, or if the underlyingChannelhas already been authenticated When returningfalse, this method MUST also send anAuthentication Requiredframe back to the clientbooleancheckAuthorizationHeaders(ChannelHandlerContext ctx, HttpHeaders headers) Checks if the givenHttpHeaderscontains a valid authorization, or if the underlyingChannelhas already been authenticated When returningfalse, this method MUST NOT send any frames back to the clientvoidInvalidates the authentication of the specifiedChannelHandlerContext, if supported by the authentication handler
-
Field Details
-
ATTR_AUTHENTICATED
Represents theATTR_AUTHENTICATEDattribute -
ATTR_SENT_AUTH_REPLY
Represents theattrSentAuthReplyattribute
-
-
Method Details
-
checkAuthorization
Checks if the givenWebSocketFrameis a valid authentication frame, or if the underlyingChannelhas already been authenticated When returningfalse, this method MUST also send anAuthentication Requiredframe back to the client- Parameters:
ctx- TheChannelHandlerContextof the sessionframe- TheWebSocketFrameto check- Returns:
trueif authorized
-
checkAuthorizationHeaders
Checks if the givenHttpHeaderscontains a valid authorization, or if the underlyingChannelhas already been authenticated When returningfalse, this method MUST NOT send any frames back to the client- Parameters:
ctx- TheChannelHandlerContextof the sessionheaders- TheHttpHeadersto check- Returns:
trueif authorized
-
invalidateAuthorization
Invalidates the authentication of the specifiedChannelHandlerContext, if supported by the authentication handler- Parameters:
ctx- TheChannelHandlerContextof the sessionframe- TheWebSocketFrame- Throws:
UnsupportedOperationException- Thrown if the selected authentication handler does not support this operation
-