public abstract class AbstractSecurityService extends java.lang.Object implements SecurityService
SecurityService interface. This class mainly contains
utility methods helping with actual implementations.SecurityService.AuthenticationContext| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
AUTH_TYPE |
| Constructor and Description |
|---|
AbstractSecurityService() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptsContext()
A security service can optionally indicate that it's able to authorize requests that are not HTTP requests
(websockets).
|
protected java.lang.String[] |
decodeBase64Credentials(java.lang.Object credentials,
java.lang.String charset)
Decode credentials encoded in base 64 (in the form of "username:password"), as they have been
sent by a RemoteObject.
|
protected java.lang.Object |
endAuthorization(AbstractSecurityContext context)
Invoke a service method (EJB3, Spring, Seam, etc...) after a successful authorization.
|
protected void |
endLogin(java.lang.Object credentials,
java.lang.String charset)
Try to save current credentials in distributed data, typically a user session attribute.
|
protected void |
endLogout()
Try to remove credentials previously saved in distributed data.
|
void |
handleSecurityException(SecurityServiceException e)
Handle a security exception.
|
java.security.Principal |
login(java.lang.Object credentials)
A default implementation of the basic login method, passing null as the extra charset
parameter.
|
void |
prelogin(javax.servlet.http.HttpSession session,
java.lang.Object request,
java.lang.String servletName) |
protected void |
startAuthorization(AbstractSecurityContext context)
Try to login by using remote credentials (see Flex method RemoteObject.setRemoteCredentials()).
|
protected boolean |
tryRelogin()
Try to re-authenticate the current user with credentials previously saved in distributed data.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitauthorize, configure, login, logoutpublic static final java.lang.String AUTH_TYPE
public void prelogin(javax.servlet.http.HttpSession session,
java.lang.Object request,
java.lang.String servletName)
prelogin in interface SecurityServicepublic java.security.Principal login(java.lang.Object credentials)
throws SecurityServiceException
login in interface SecurityServicecredentials - the login:password pair (must be a base64/ISO-8859-1 encoded string).SecurityServiceExceptionprotected void startAuthorization(AbstractSecurityContext context) throws SecurityServiceException
SecurityService.authorize(AbstractSecurityContext).context - the current security context.SecurityServiceException - if login fails.protected java.lang.Object endAuthorization(AbstractSecurityContext context) throws java.lang.Exception
SecurityService.authorize(AbstractSecurityContext).context - the current security context.java.lang.Exception - if anything goes wrong with service invocation.public boolean acceptsContext()
SecurityService.authorize(AbstractSecurityContext) will be
invoked in a ServletGraniteContext and not in a HttpGraniteContextacceptsContext in interface SecurityServiceHttpGraniteContext is mandatedprotected java.lang.String[] decodeBase64Credentials(java.lang.Object credentials,
java.lang.String charset)
credentials - base 64 encoded credentials.java.lang.IllegalArgumentException - if credentials isn't a String.SecurityServiceException - if credentials are invalid (bad encoding or missing ':').public void handleSecurityException(SecurityServiceException e)
AMF3MessageProcessor.processCommandMessage(flex.messaging.messages.CommandMessage)
whenever a SecurityService occurs and does nothing by default.handleSecurityException in interface SecurityServicee - the security exception.protected void endLogin(java.lang.Object credentials,
java.lang.String charset)
SecurityService.login(Object) operation and is useful
in clustered environments with session replication in order to transparently re-authenticate the
user when failing over.credentials - the credentials to be saved in distributed data.protected boolean tryRelogin()
SecurityService.authorize(AbstractSecurityContext)
method when the current user principal is null.endLogin(Object, String)protected void endLogout()
SecurityService.logout() method.endLogin(Object, String)