|
CSP for Java (JCSP) 1.1-rc1 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jcsp.net.security.SimpleSecurityAuthority
public class SimpleSecurityAuthority
Provides a basic security authority based on unique names. No passwords are used - a user is identified by a name which is guarded by a minimal protection scheme. This class is supplied as an example of implementing a security authority and not a robust implementation suitable for long term use.
Constructor Summary | |
---|---|
SimpleSecurityAuthority()
Creates a new simple authority. |
Method Summary | |
---|---|
Challenge |
createChallenge()
Creates a new challenge packet containing a timestamp and some random data. |
Response |
createResponse(Challenge c)
Creates a response to the challenge based on the currently logged in user. |
UserID |
createUserID(String username)
Creates and returns a user ID valid for this authority that represents the given user name. |
UserToken |
createUserToken(UserID user)
Creates and returns an authentication token valid for this authority that represents the given user name. |
void |
denyUserAccess(UserID u)
Removes a user from the set of permitted users. |
ServiceUserObject |
getUserObject()
Returns the authority interface for this service. |
boolean |
init(ServiceSettings s)
Initializes the service, setting a current user and the list of permitted users from the XML configuration file. |
boolean |
isRunning()
Returns true iff the service is running. |
void |
logoffUser()
Clears the currently logged on user. |
void |
logonUser(UserToken u)
Sets the currently logged on user. |
void |
permitUserAccess(UserID u)
Adds a user to the set of permitted users. |
boolean |
start()
Sets the service running. |
boolean |
stop()
Stops the service. |
String |
toString()
Returns a string description of this authority. |
boolean |
validateResponse(Challenge c,
Response r)
Checks if the generated response corresponds to one expected from a permitted user. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SimpleSecurityAuthority()
Method Detail |
---|
public Challenge createChallenge()
createChallenge
in interface SecurityAuthority
public boolean validateResponse(Challenge c, Response r)
validateResponse
in interface SecurityAuthority
c
- the challenge returned by createChallenge
.r
- the response generated by the other authority.
public Response createResponse(Challenge c)
createResponse
in interface SecurityAuthority
c
- the challenge to respond to.
public void logonUser(UserToken u) throws AccessDeniedException
logonUser
in interface SecurityAuthority
u
- the user's token.
AccessDeniedException
- if the user token is not valid for this authority.public void logoffUser()
createResponse
method will
fail until another user is logged in.
logoffUser
in interface SecurityAuthority
public void permitUserAccess(UserID u) throws AccessDeniedException
permitUserAccess
in interface SecurityAuthority
u
- the user ID to add.
AccessDeniedException
- if the ID was not allocated by this authority.public void denyUserAccess(UserID u) throws AccessDeniedException
denyUserAccess
in interface SecurityAuthority
u
- the user ID to remove.
AccessDeniedException
- if the ID was not allocated by this authority.public boolean start()
start
in interface Service
public boolean stop()
stop
in interface Service
public boolean isRunning()
isRunning
in interface Service
true
iff the service is currently running.public boolean init(ServiceSettings s)
Initializes the service, setting a current user and the list of permitted users from the XML configuration file. For example:
<SERVICE ...> <SETTING name="logonUser" value="foo@bar.com"/> <SETTING name="permitUser0" value="a"/> <SETTING name="permitUser1" value="b"/> </SETTING>
This sets the current user to be "foo@bar.com" but will allow responses from users "a" and "b".
init
in interface Service
s
- The settings used by the service.
true
iff the service has been initialized.public ServiceUserObject getUserObject()
getUserObject
in interface Service
ServiceUserObject
.public UserID createUserID(String username)
username
- the unique user name.
public UserToken createUserToken(UserID user) throws AccessDeniedException
user
- the user ID to authenticate.
AccessDeniedException
- if the user ID is not valid for this authority.public String toString()
toString
in class Object
|
CSP for Java (JCSP) 1.1-rc1 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |