@Contract
@PerLookup
public interface Realm
| Modifier and Type | Field and Description |
|---|---|
static int |
AUTHENTICATE_NEEDED
Flag indicating authentication is needed for current request.
|
static int |
AUTHENTICATE_NOT_NEEDED
Flag indicating authentication is not needed for current request.
|
static int |
AUTHENTICATED_NOT_AUTHORIZED
Flag indicating the user has been authenticated but been denied access to the requested resource.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to this component.
|
Principal |
authenticate(javax.servlet.http.HttpServletRequest hreq)
Does digest authentication and returns the Principal associated with the username in the HTTP header.
|
Principal |
authenticate(String username,
char[] credentials)
Return the Principal associated with the specified username and credentials, if there is one; otherwise return
null. |
Principal |
authenticate(String username,
char[] digest,
String nonce,
String nc,
String cnonce,
String qop,
String realm,
char[] md5a2)
Return the Principal associated with the specified username, which matches the digest calculated using the given
parameters using the method described in RFC 2069; otherwise return
null. |
Principal |
authenticate(X509Certificate[] certs)
Return the Principal associated with the specified chain of X509 client certificates.
|
SecurityConstraint[] |
findSecurityConstraints(HttpRequest request,
Context context)
Return the SecurityConstraints configured to guard the request URI for this request, or
null if there is
no such constraint. |
SecurityConstraint[] |
findSecurityConstraints(String uri,
String method,
Context context)
Gets the security constraints configured by the given context for the given request URI and method.
|
String |
getAlternateAuthType(HttpRequest req)
Return an alternate auth type from the request if available.
|
Principal |
getAlternatePrincipal(HttpRequest req)
Return an alternate principal from the request if available.
|
Container |
getContainer()
Return the Container with which this Realm has been associated.
|
String |
getInfo()
Return descriptive information about this Realm implementation and the corresponding version number, in the format
<description>/<version>. |
String |
getRealmName()
Returns the name of the associated realm.
|
boolean |
hasResourcePermission(HttpRequest request,
HttpResponse response,
SecurityConstraint[] constraint,
Context context)
Perform access control based on the specified authorization constraint.
|
boolean |
hasRole(HttpRequest request,
HttpResponse response,
Principal principal,
String role)
Return
true if the specified Principal has the specified security role, within the context of this
Realm; otherwise return false. |
boolean |
hasRole(Principal principal,
String role)
Return
true if the specified Principal has the specified security role, within the context of this
Realm; otherwise return false. |
boolean |
hasUserDataPermission(HttpRequest request,
HttpResponse response,
SecurityConstraint[] constraint)
Enforce any user data constraint required by the security constraint guarding this request URI.
|
boolean |
hasUserDataPermission(HttpRequest request,
HttpResponse response,
SecurityConstraint[] constraints,
String uri,
String method)
Checks if the given request URI and method are the target of any user-data-constraint with a transport-guarantee of
CONFIDENTIAL, and whether any such constraint is already satisfied.
|
boolean |
invokeAuthenticateDelegate(HttpRequest request,
HttpResponse response,
Context context,
Authenticator authenticator,
boolean calledFromAuthenticate)
Authenticates the user making this request, based on the specified login configuration.
|
boolean |
invokePostAuthenticateDelegate(HttpRequest request,
HttpResponse response,
Context context)
Post authentication for given request and response.
|
boolean |
isSecurityExtensionEnabled(javax.servlet.ServletContext servletContext)
Returns whether the specified ServletContext indicates that security extension is enabled.
|
void |
logout(HttpRequest hreq)
Logs out.
|
int |
preAuthenticateCheck(HttpRequest request,
HttpResponse response,
SecurityConstraint[] constraints,
boolean disableProxyCaching,
boolean securePagesWithPragma,
boolean ssoEnabled)
Checks whether or not authentication is needed.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener from this component.
|
void |
setContainer(Container container)
Set the Container with which this Realm has been associated.
|
void |
setRealmName(String name,
String authMethod)
Set the name of the associated realm.
|
static final int AUTHENTICATE_NEEDED
static final int AUTHENTICATE_NOT_NEEDED
static final int AUTHENTICATED_NOT_AUTHORIZED
Container getContainer()
void setContainer(Container container)
container - The associated ContainerString getInfo()
<description>/<version>.void addPropertyChangeListener(PropertyChangeListener listener)
listener - The listener to addPrincipal authenticate(String username, char[] credentials)
null.username - Username of the Principal to look upcredentials - Password or other credentials to use in authenticating this usernamePrincipal authenticate(String username, char[] digest, String nonce, String nc, String cnonce, String qop, String realm, char[] md5a2)
null.username - Username of the Principal to look updigest - Digest which has been submitted by the clientnonce - Unique (or supposedly unique) token which has been used for this requestrealm - Realm namemd5a2 - Second MD5 digest used to calculate the digest : MD5(Method + ":" + uri)Principal authenticate(X509Certificate[] certs)
null.certs - Array of client certificates, with the first one in the array being the certificate of the client
itself.Principal authenticate(javax.servlet.http.HttpServletRequest hreq)
hreq - HTTP servlet request.SecurityConstraint[] findSecurityConstraints(HttpRequest request, Context context)
null if there is
no such constraint.request - Request we are processingSecurityConstraint[] findSecurityConstraints(String uri, String method, Context context)
uri - the request URImethod - the request methodcontext - the contextboolean hasResourcePermission(HttpRequest request, HttpResponse response, SecurityConstraint[] constraint, Context context) throws IOException
true if this constraint
is satisfied and processing should continue, or false otherwise.request - Request we are processingresponse - Response we are creatingconstraint - Security constraint we are enforcingcontext - Context to which client of this class is attached.IOException - if an input/output error occursboolean hasRole(Principal principal, String role)
true if the specified Principal has the specified security role, within the context of this
Realm; otherwise return false.principal - Principal for whom the role is to be checkedrole - Security role to be checkedboolean hasRole(HttpRequest request, HttpResponse response, Principal principal, String role)
true if the specified Principal has the specified security role, within the context of this
Realm; otherwise return false.request - Request we are processingresponse - Response we are creatingprincipal - Principal for whom the role is to be checkedrole - Security role to be checkedint preAuthenticateCheck(HttpRequest request, HttpResponse response, SecurityConstraint[] constraints, boolean disableProxyCaching, boolean securePagesWithPragma, boolean ssoEnabled) throws IOException
request - Request we are processingresponse - Response we are creatingconstraints - Security constraint we are enforcingdisableProxyCaching - whether or not to disable proxy caching for protected resources.securePagesWithPragma - true if we add headers which are incompatible with downloading office documents in IE
under SSL but which fix a caching problem in MozillssoEnabled - true if sso is enabledIOException - if an input/output error occursboolean invokeAuthenticateDelegate(HttpRequest request, HttpResponse response, Context context, Authenticator authenticator, boolean calledFromAuthenticate) throws IOException
true if
any specified requirements have been satisfied, or false if we have created a response challenge
already.request - Request we are processingresponse - Response we are creatingcontext - The Context to which client of this class is attached.authenticator - the current authenticator.calledFromAuthenticate - true if the call originates from HttpServletRequest.authenticateIOException - if an input/output error occursboolean invokePostAuthenticateDelegate(HttpRequest request, HttpResponse response, Context context) throws IOException
request - Request we are processingresponse - Response we are creatingcontext - The Context to which client of this class is attached.IOException - if an input/output error occursboolean hasUserDataPermission(HttpRequest request, HttpResponse response, SecurityConstraint[] constraint) throws IOException
true if this constraint was not violated and processing should continue, or false if we
have created a response already.request - Request we are processingresponse - Response we are creatingconstraint - Security constraint being checkedIOException - if an input/output error occursboolean hasUserDataPermission(HttpRequest request, HttpResponse response, SecurityConstraint[] constraints, String uri, String method) throws IOException
request - the request that may be redirectedresponse - the response that may be redirectedconstraints - the security constraints to check againsturi - the request URI (minus the context path) to checkmethod - the request method to checkIOExceptionvoid removePropertyChangeListener(PropertyChangeListener listener)
listener - The listener to removePrincipal getAlternatePrincipal(HttpRequest req)
req - The request object.String getAlternateAuthType(HttpRequest req)
req - The request object.void setRealmName(String name, String authMethod)
name - the name of the realm.String getRealmName()
boolean isSecurityExtensionEnabled(javax.servlet.ServletContext servletContext)
servletContext - the ServletContextvoid logout(HttpRequest hreq)
hreq - the HttpRequestCopyright © 2019. All rights reserved.