public abstract class AbstractSecurityService extends Object implements SecurityService
SecurityService interface. This class mainly contains
utility methods helping with actual implementations.| 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 String[] |
decodeBase64Credentials(Object credentials,
String charset)
Decode credentials encoded in base 64 (in the form of "username:password"), as they have been
sent by a RemoteObject.
|
protected Object |
endAuthorization(AbstractSecurityContext context)
Invoke a service method (EJB3, Spring, Seam, etc...) after a successful authorization.
|
protected void |
endLogin(Object credentials,
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.
|
void |
login(Object credentials)
A default implementation of the basic login method, passing null as the extra charset
parameter.
|
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 String AUTH_TYPE
public AbstractSecurityService()
public void login(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 Object endAuthorization(AbstractSecurityContext context) throws Exception
SecurityService.authorize(AbstractSecurityContext).context - the current security context.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 String[] decodeBase64Credentials(Object credentials, String charset)
credentials - base 64 encoded credentials.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(Object credentials, 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)