unsw.cse.mica.blackboard.secure
Class SimpleBlackboardSecurityManager
java.lang.Object
unsw.cse.mica.blackboard.secure.SimpleBlackboardSecurityManager
- All Implemented Interfaces:
- BlackboardSecurityManager, SimpleBlackboardSecurityConstants
public class SimpleBlackboardSecurityManager
- extends java.lang.Object
- implements BlackboardSecurityManager, SimpleBlackboardSecurityConstants
A simple implementation of the BlackboardSecurityManager
interface.
- Author:
- mmcgill
Fields inherited from interface unsw.cse.mica.blackboard.secure.SimpleBlackboardSecurityConstants |
ATTRIBUTE_DEFAULT, ATTRIBUTE_GROUPS, ATTRIBUTE_NAME, ATTRIBUTE_PASSWORD, ATTRIBUTE_TYPE, ATTRIBUTE_VALUE, DEFAULT_AGENTS_FILE, DEFAULT_RULES_FILE, ELEMENT_ACCEPT, ELEMENT_ACTION, ELEMENT_AGENT, ELEMENT_AGENTS, ELEMENT_AND, ELEMENT_ELSE, ELEMENT_GROUP, ELEMENT_IF, ELEMENT_NOT, ELEMENT_OR, ELEMENT_REJECT, ELEMENT_RULES, ELEMENT_SLOT, ELEMENT_THEN, ELEMENT_TYPE, VALUE_ACCEPT, VALUE_READ, VALUE_REJECT, VALUE_WRITE |
Constructor Summary |
SimpleBlackboardSecurityManager(java.lang.String agentsFile,
java.lang.String mobRulesFile,
TypeManager typeManager)
Creates a SimpleBlackboardSecurityManager reading the agents/groups and mob authorisation rules from files. |
Method Summary |
java.lang.String |
classifyAgent(java.lang.String proposedName,
java.lang.String password)
Checks the name and password from an agent. |
boolean |
isAuthorised(java.lang.String agentClassification,
int action,
Mob mob)
Checks whether an agent can read/write a given mob. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleBlackboardSecurityManager
public SimpleBlackboardSecurityManager(java.lang.String agentsFile,
java.lang.String mobRulesFile,
TypeManager typeManager)
- Creates a
SimpleBlackboardSecurityManager
reading the agents/groups and mob authorisation rules from files.
- Parameters:
agentsFile
- name of the file to read the agents/groups frommobRulesFile
- name of the file to read the mob authorisation rules fromtypeManager
- a TypeManager to use for testing mob types
classifyAgent
public java.lang.String classifyAgent(java.lang.String proposedName,
java.lang.String password)
throws AgentClassificationException
- Checks the name and password from an agent. If the agent is successful returns the agents proposed name as its class.
- Specified by:
classifyAgent
in interface BlackboardSecurityManager
- Parameters:
proposedName
- the name the agent is attempting to connect withpassword
- the password the agent is using to connect
- Returns:
- the class the agent is assigned to
- Throws:
AgentClassificationException
- if the agent cannot be classified
isAuthorised
public boolean isAuthorised(java.lang.String agentClassification,
int action,
Mob mob)
- Description copied from interface:
BlackboardSecurityManager
- Checks whether an agent can read/write a given mob.
- Specified by:
isAuthorised
in interface BlackboardSecurityManager
- Parameters:
agentClassification
- the agents classificationaction
- whether the agent is attempting to read/writemob
- the mob being read/written
- Returns:
- true if the agent is authorised else false