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 TypeMethodDescriptionbooleanAlways 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"}booleancheckAuthorizationHeaders(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 clientstatic WsNoAuthenticationHandlerinstance()Gets a handler instancevoidInvalidates 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:
checkAuthorizationin interfaceWsAuthenticationHandler- Parameters:
ctx- TheChannelHandlerContextof the sessionreq- TheWebSocketFrameof the request- Returns:
-
invalidateAuthorization
Description copied from interface:WsAuthenticationHandlerInvalidates the authentication of the specifiedChannelHandlerContext, if supported by the authentication handler- Specified by:
invalidateAuthorizationin interfaceWsAuthenticationHandler- Parameters:
ctx- TheChannelHandlerContextof the sessionframe- TheWebSocketFrame
-
checkAuthorizationHeaders
Description copied from interface:WsAuthenticationHandlerChecks 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- Specified by:
checkAuthorizationHeadersin interfaceWsAuthenticationHandler- Parameters:
ctx- TheChannelHandlerContextof the sessionheaders- TheHttpHeadersto check- Returns:
trueif authorized
-