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_AUTHENTICATED
attributestatic final AttributeKey<Boolean>
Represents theattrSentAuthReply
attribute -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkAuthorization
(ChannelHandlerContext ctx, WebSocketFrame frame) Checks if the givenWebSocketFrame
is a valid authentication frame, or if the underlyingChannel
has already been authenticated When returningfalse
, this method MUST also send anAuthentication Required
frame back to the clientboolean
checkAuthorizationHeaders
(ChannelHandlerContext ctx, HttpHeaders headers) Checks if the givenHttpHeaders
contains a valid authorization, or if the underlyingChannel
has already been authenticated When returningfalse
, this method MUST NOT send any frames back to the clientvoid
Invalidates the authentication of the specifiedChannelHandlerContext
, if supported by the authentication handler
-
Field Details
-
ATTR_AUTHENTICATED
Represents theATTR_AUTHENTICATED
attribute -
ATTR_SENT_AUTH_REPLY
Represents theattrSentAuthReply
attribute
-
-
Method Details
-
checkAuthorization
Checks if the givenWebSocketFrame
is a valid authentication frame, or if the underlyingChannel
has already been authenticated When returningfalse
, this method MUST also send anAuthentication Required
frame back to the client- Parameters:
ctx
- TheChannelHandlerContext
of the sessionframe
- TheWebSocketFrame
to check- Returns:
true
if authorized
-
checkAuthorizationHeaders
Checks if the givenHttpHeaders
contains a valid authorization, or if the underlyingChannel
has already been authenticated When returningfalse
, this method MUST NOT send any frames back to the client- Parameters:
ctx
- TheChannelHandlerContext
of the sessionheaders
- TheHttpHeaders
to check- Returns:
true
if authorized
-
invalidateAuthorization
Invalidates the authentication of the specifiedChannelHandlerContext
, if supported by the authentication handler- Parameters:
ctx
- TheChannelHandlerContext
of the sessionframe
- TheWebSocketFrame
- Throws:
UnsupportedOperationException
- Thrown if the selected authentication handler does not support this operation
-