Package com.gmt2001.httpwsserver.auth
Interface HttpAuthenticationHandler
- All Known Implementing Classes:
HttpBasicAuthenticationHandler
,HttpNoAuthenticationHandler
,HttpSharedTokenOrPasswordAuthenticationHandler
public interface HttpAuthenticationHandler
Represents an Authentication Handler for an
HttpHandler
- Author:
- gmt2001
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if the givenFullHttpRequest
is a valid authentication request, or if the underlyingChannel
has already been authenticated When returningfalse
, this method MUST also send either an401 Unauthorized
, aHeader Location
, or an error page back to the clientvoid
Invalidates the authentication of the specifiedChannelHandlerContext
, if supported by the authentication handlerboolean
isAuthorized
(ChannelHandlerContext ctx, FullHttpRequest req) Checks if the givenFullHttpRequest
is a valid authentication request, or if the underlyingChannel
has already been authenticated When returningfalse
, this method MUST NOT send a response to the clientboolean
isAuthorized
(ChannelHandlerContext ctx, HttpHeaders headers) Checks if the givenHttpHeaders
contain a valid authorization, or if the underlyingChannel
has already been authenticated When returningfalse
, this method MUST NOT send a response to the clientboolean
isAuthorized
(String user, String pass) Checks if the given username and password is a valid When returningfalse
, this method MUST NOT send a response to the client
-
Method Details
-
checkAuthorization
Checks if the givenFullHttpRequest
is a valid authentication request, or if the underlyingChannel
has already been authenticated When returningfalse
, this method MUST also send either an401 Unauthorized
, aHeader Location
, or an error page back to the client- Parameters:
ctx
- TheChannelHandlerContext
of the sessionreq
- TheFullHttpRequest
to check- Returns:
- otherwise
-
isAuthorized
Checks if the givenFullHttpRequest
is a valid authentication request, or if the underlyingChannel
has already been authenticated When returningfalse
, this method MUST NOT send a response to the client- Parameters:
ctx
- TheChannelHandlerContext
of the sessionreq
- TheFullHttpRequest
to check- Returns:
- otherwise
-
isAuthorized
Checks if the givenHttpHeaders
contain a valid authorization, or if the underlyingChannel
has already been authenticated When returningfalse
, this method MUST NOT send a response to the client- Parameters:
ctx
- TheChannelHandlerContext
of the sessionheaders
- TheHttpHeaders
to check- Returns:
- otherwise
-
isAuthorized
Checks if the given username and password is a valid When returningfalse
, this method MUST NOT send a response to the client- Parameters:
user
- The usernamepass
- The password- Returns:
- otherwise
-
invalidateAuthorization
Invalidates the authentication of the specifiedChannelHandlerContext
, if supported by the authentication handler- Parameters:
ctx
- TheChannelHandlerContext
of the sessionreq
- TheFullHttpRequest
- Throws:
UnsupportedOperationException
- Thrown if the selected authentication handler does not support this operation
-