Package com.gmt2001.httpwsserver.auth
Class WsNoAuthenticationHandler
java.lang.Object
com.gmt2001.httpwsserver.auth.WsNoAuthenticationHandler
- All Implemented Interfaces:
WsAuthenticationHandler
Provides a
WsAuthenticationHandler
that allows all requests- Author:
- gmt2001
-
Field Summary
Fields inherited from interface com.gmt2001.httpwsserver.auth.WsAuthenticationHandler
ATTR_AUTHENTICATED, ATTR_SENT_AUTH_REPLY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Always returnstrue
, since this handler is for No Authentication Sends a read-only authentication successful frame on the first received frame from the client, defined as{"authresult": string:"true", "authtype": string:"read"}
boolean
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 clientstatic WsNoAuthenticationHandler
instance()
Gets a handler instancevoid
Invalidates the authentication of the specifiedChannelHandlerContext
, if supported by the authentication handler
-
Constructor Details
-
WsNoAuthenticationHandler
public WsNoAuthenticationHandler()
-
-
Method Details
-
instance
Gets a handler instance- Returns:
- An instance of
WsNoAuthenticationHandler
-
checkAuthorization
Always returnstrue
, since this handler is for No Authentication Sends a read-only authentication successful frame on the first received frame from the client, defined as{"authresult": string:"true", "authtype": string:"read"}
- Specified by:
checkAuthorization
in interfaceWsAuthenticationHandler
- Parameters:
ctx
- TheChannelHandlerContext
of the sessionreq
- TheWebSocketFrame
of the request- Returns:
-
invalidateAuthorization
Description copied from interface:WsAuthenticationHandler
Invalidates the authentication of the specifiedChannelHandlerContext
, if supported by the authentication handler- Specified by:
invalidateAuthorization
in interfaceWsAuthenticationHandler
- Parameters:
ctx
- TheChannelHandlerContext
of the sessionframe
- TheWebSocketFrame
-
checkAuthorizationHeaders
Description copied from interface:WsAuthenticationHandler
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- Specified by:
checkAuthorizationHeaders
in interfaceWsAuthenticationHandler
- Parameters:
ctx
- TheChannelHandlerContext
of the sessionheaders
- TheHttpHeaders
to check- Returns:
true
if authorized
-