public class StandardRMIAuthenticator extends java.lang.Object implements RMIAuthenticator, java.io.Serializable
Constructor and Description |
---|
StandardRMIAuthenticator() |
Modifier and Type | Method and Description |
---|---|
void |
addRole(java.lang.String authId,
java.lang.String role)
Add a role to a user
|
boolean |
authenticate(java.net.InetSocketAddress remoteAddress,
java.lang.String authId,
java.lang.String passphrase)
Authenticate a user that established the connection from the given address.
|
boolean |
authorize(java.lang.String authId,
java.lang.Object object,
java.lang.reflect.Method method)
Authorize a user to invoke a specific method on a specific object.
|
boolean |
changePassphrase(java.lang.String authId,
java.lang.String passphrase)
Change the pass-phrase of a registered authentication identifier
|
void |
createRole(java.lang.String role)
Create a new user role
|
void |
deleteRole(java.lang.String role)
Delete a user role
|
boolean |
getDefaultAuthorization()
Returns the default authorization, that is the default return value of the
authorize(String, Object, Method) method when no criterion has been
found |
boolean |
isRegistered(java.lang.String authId)
Gets the registration status for the given identifier
|
static void |
main(java.lang.String[] args) |
boolean |
register(java.lang.String authId,
java.lang.String passphrase)
Register a new identity
|
void |
removeRole(java.lang.String authId,
java.lang.String role)
Remove a role from a user
|
void |
setDefaultAuthorization(boolean authorizeByDefault)
Sets the default authorization, that is the default return value of the
authorize(String, Object, Method) method when no criterion has been
found |
void |
setIdAuthorization(java.lang.String authId,
java.lang.Class<?> cls,
int authorized)
Set class couple authorization for a user
|
void |
setIdAuthorization(java.lang.String authId,
java.lang.reflect.Method method,
int authorized)
Set method couple authorization for a user
|
void |
setIdAuthorization(java.lang.String authId,
java.lang.Object object,
int authorized)
Set object couple authorization for a user
|
void |
setIdAuthorization(java.lang.String authId,
java.lang.Object object,
java.lang.reflect.Method method,
int authorized)
Set object-method couple authorization for a user
|
void |
setRoleAuthorization(java.lang.String role,
java.lang.Class<?> cls,
int authorized)
Set class authorization for a role
|
void |
setRoleAuthorization(java.lang.String role,
java.lang.reflect.Method method,
int authorized)
Set method authorization for a role
|
void |
setRoleAuthorization(java.lang.String role,
java.lang.Object object,
int authorized)
Set object authorization for a role
|
void |
setRoleAuthorization(java.lang.String role,
java.lang.Object object,
java.lang.reflect.Method method,
int authorized)
Set object-method couple authorization for a role
|
void |
unregister(java.lang.String authId)
Unregister an identity.
|
public boolean authenticate(java.net.InetSocketAddress remoteAddress, java.lang.String authId, java.lang.String passphrase)
RMIAuthenticator
RMIRegistry
to accept the
incoming connectionauthenticate
in interface RMIAuthenticator
remoteAddress
- the address of the remote machineauthId
- the authentication identifier of the userpassphrase
- the passphrase to use for authenticationpublic boolean register(java.lang.String authId, java.lang.String passphrase)
authId
- authentication idpassphrase
- authentication pass-phrasepublic boolean isRegistered(java.lang.String authId)
authId
- the authentication identifier to checkpublic boolean changePassphrase(java.lang.String authId, java.lang.String passphrase)
authId
- authentication identifierpassphrase
- new pass-phrasepublic void unregister(java.lang.String authId)
authId
- the authentication identifier to unregisterpublic void createRole(java.lang.String role)
role
- the role to createpublic void deleteRole(java.lang.String role)
role
- the role to deletepublic void addRole(java.lang.String authId, java.lang.String role)
authId
- the identifier of the userrole
- the role to addpublic void removeRole(java.lang.String authId, java.lang.String role)
authId
- the identifier of the userrole
- the role to removepublic void setDefaultAuthorization(boolean authorizeByDefault)
authorize(String, Object, Method)
method when no criterion has been
foundauthorizeByDefault
- the default authorizationpublic boolean getDefaultAuthorization()
authorize(String, Object, Method)
method when no criterion has been
foundpublic void setIdAuthorization(java.lang.String authId, java.lang.Object object, java.lang.reflect.Method method, int authorized)
authId
- the authentication identifier to authorizeobject
- the object on which authorization is setmethod
- the method on which authorization is setauthorized
- 0=authorized, 1=not authorized, otherwise=default
authorizationpublic void setIdAuthorization(java.lang.String authId, java.lang.reflect.Method method, int authorized)
authId
- the authentication identifier to authorizemethod
- the method on which authorization is setauthorized
- 0=authorized, 1=not authorized, otherwise=default
authorizationpublic void setIdAuthorization(java.lang.String authId, java.lang.Object object, int authorized)
authId
- the authentication identifier to authorizeobject
- the object on which authorization is setauthorized
- 0=authorized, 1=not authorized, otherwise=default
authorizationpublic void setIdAuthorization(java.lang.String authId, java.lang.Class<?> cls, int authorized)
authId
- the authentication identifier to authorizecls
- the class on which authorization is setauthorized
- 0=authorized, 1=not authorized, otherwise=default
authorizationpublic void setRoleAuthorization(java.lang.String role, java.lang.Object object, java.lang.reflect.Method method, int authorized)
role
- the role to authorizeobject
- the object on which authorization is setmethod
- the method on which authorization is setauthorized
- 0=authorized, 1=not authorized, otherwise=default
authorizationpublic void setRoleAuthorization(java.lang.String role, java.lang.reflect.Method method, int authorized)
role
- the role to authorizemethod
- the method on which authorization is setauthorized
- 0=authorized, 1=not authorized, otherwise=default
authorizationpublic void setRoleAuthorization(java.lang.String role, java.lang.Object object, int authorized)
role
- the role to authorizeobject
- the object on which authorization is setauthorized
- 0=authorized, 1=not authorized, otherwise=default
authorizationpublic void setRoleAuthorization(java.lang.String role, java.lang.Class<?> cls, int authorized)
role
- the role to authorizecls
- the class on which authorization is setauthorized
- 0=authorized, 1=not authorized, otherwise=default
authorizationpublic boolean authorize(java.lang.String authId, java.lang.Object object, java.lang.reflect.Method method)
RMIAuthenticator
authorize
in interface RMIAuthenticator
authId
- the user authentication identifier, the same that ha been used
to authenticate the user in the
RMIAuthenticator.authenticate(InetSocketAddress, String, String)
methodobject
- the object to which the user requires the accessmethod
- the method that the user wants invokepublic static void main(java.lang.String[] args) throws java.lang.NoSuchMethodException, java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.SecurityException