@Provider
@Priority(value=1000)
public abstract class AuthenticationFilter
extends java.lang.Object
implements javax.ws.rs.container.ContainerRequestFilter
AuthenticationFilter authenticates given tokens from request of users or
accounts. | Constructor and Description |
|---|
AuthenticationFilter() |
| Modifier and Type | Method and Description |
|---|---|
void |
filter(javax.ws.rs.container.ContainerRequestContext requestContext) |
protected boolean |
isSecured()
Checks if is the resourceClass is annotated with the annotation
Securable. |
protected boolean |
isSecureRequest(javax.servlet.http.HttpServletRequest request)
Checks if the current request is a secure request, means that the scheme is https
|
protected boolean |
isSigninPath(java.lang.String path)
Checks if the given path is a sign in path.
|
protected boolean |
isSigninRequest(javax.ws.rs.container.ContainerRequestContext requestContext)
Checks if the current request is a is a sign request.
|
protected java.lang.String |
newAuthenticationScheme()
Factory callback method for create a new authentication scheme for the header key
'WWW-Authenticate'.
|
protected javax.ws.rs.core.Response |
newFaultResponse()
Factory callback method for create a new
Response with a 401 status code |
protected java.lang.String |
newRealmValue()
Factory callback method for create a new realm value for the header key 'WWW-Authenticate'.
|
protected javax.ws.rs.core.SecurityContext |
newSecurityContext(java.lang.String username)
Factory method for create a new security context with the given user name.
|
protected abstract java.lang.String |
onValidateToken(java.lang.String token)
Abstract callback method that checks if the given token is valid.
|
public void filter(javax.ws.rs.container.ContainerRequestContext requestContext)
throws java.io.IOException
filter in interface javax.ws.rs.container.ContainerRequestFilterjava.io.IOExceptionprotected boolean isSecured()
Securable.Securable.protected boolean isSigninPath(java.lang.String path)
path - the sign in path to check.protected boolean isSigninRequest(javax.ws.rs.container.ContainerRequestContext requestContext)
throws java.lang.Exception
requestContext - the request contextjava.lang.Exception - occurs if some error like the scheme is not httpsprotected boolean isSecureRequest(javax.servlet.http.HttpServletRequest request)
request - the requestprotected java.lang.String newAuthenticationScheme()
protected javax.ws.rs.core.Response newFaultResponse()
Response with a 401 status codeResponse objectprotected java.lang.String newRealmValue()
protected javax.ws.rs.core.SecurityContext newSecurityContext(java.lang.String username)
username - the user nameprotected abstract java.lang.String onValidateToken(java.lang.String token)
throws java.lang.Exception
token - the tokenjava.lang.Exception - if the token is not valid