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 TypeMethodDescriptionbooleanChecks if the givenFullHttpRequestis a valid authentication request, or if the underlyingChannelhas already been authenticated When returningfalse, this method MUST also send either an401 Unauthorized, aHeader Location, or an error page back to the clientvoidInvalidates the authentication of the specifiedChannelHandlerContext, if supported by the authentication handlerbooleanisAuthorized(ChannelHandlerContext ctx, FullHttpRequest req) Checks if the givenFullHttpRequestis a valid authentication request, or if the underlyingChannelhas already been authenticated When returningfalse, this method MUST NOT send a response to the clientbooleanisAuthorized(ChannelHandlerContext ctx, HttpHeaders headers) Checks if the givenHttpHeaderscontain a valid authorization, or if the underlyingChannelhas already been authenticated When returningfalse, this method MUST NOT send a response to the clientbooleanisAuthorized(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 givenFullHttpRequestis a valid authentication request, or if the underlyingChannelhas 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- TheChannelHandlerContextof the sessionreq- TheFullHttpRequestto check- Returns:
- otherwise
-
isAuthorized
Checks if the givenFullHttpRequestis a valid authentication request, or if the underlyingChannelhas already been authenticated When returningfalse, this method MUST NOT send a response to the client- Parameters:
ctx- TheChannelHandlerContextof the sessionreq- TheFullHttpRequestto check- Returns:
- otherwise
-
isAuthorized
Checks if the givenHttpHeaderscontain a valid authorization, or if the underlyingChannelhas already been authenticated When returningfalse, this method MUST NOT send a response to the client- Parameters:
ctx- TheChannelHandlerContextof the sessionheaders- TheHttpHeadersto 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- TheChannelHandlerContextof the sessionreq- TheFullHttpRequest- Throws:
UnsupportedOperationException- Thrown if the selected authentication handler does not support this operation
-