org.jwarp.service.security
Class SecurityService
java.lang.Object
|
+--org.jwarp.service.AService
|
+--org.jwarp.service.security.SecurityService
- All Implemented Interfaces:
- IConfigurable, IExceptionProvider, IReferenceable, ISecurityAware, ISecurityService, IService
- public class SecurityService
- extends AService
- implements ISecurityService, IConfigurable
This is the most import service in JWeb handling all security aspects.
Per context there is only and exactly one such service instance.
- Version:
- 1.0
- Author:
- Anatole Tresch
| Fields inherited from class org.jwarp.service.AService |
context, createdDate, dependencies, emptyProperties, exceptionListeners, log, resumedDate, serviceName, serviceStatus, serviceType, startedDate, stoppedDate, suspendedDate, systemTicket |
|
Method Summary |
boolean |
accessGranted(java.lang.String objectID,
int level,
ITicket ticket)
Returns true if the user is granted access of the given level to the object with the
given ID. |
void |
configure(org.jdom.Element configuration)
This configures the service. |
ISecurity |
getSecurity(ITicket admin)
Get the security object. |
java.lang.String[][] |
getSecurityObjects()
Returns the system object entities defined by this system instance. |
void |
initSecurity(ISecurity security,
ITicket systemTicket)
This called is defined by the security-aware interface. |
ITicket |
login(java.lang.String user,
java.lang.String pwd)
Login a user. |
void |
setSystemTicket(ITicket systemTicket)
Used to intialize the security with the context's security ticket for the system.
|
| Methods inherited from class org.jwarp.service.AService |
addExceptionListener, checkContext, createLogFromXML, getContext, getCreationDate, getDependencies, getExceptionListeners, getLog, getLogLevel, getName, getReference, getResumedDate, getShutDownDate, getStartDate, getStatus, getSuspendedDate, getType, removeAllExceptionListeners, removeExceptionListener, resume, sendExceptionEvent, setContext, setDependencies, setLogLevel, setName, shutdown, start, suspend |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jwarp.service.IService |
checkContext, getDependencies, getLogLevel, getName, getStatus, getType, resume, setContext, setDependencies, setLogLevel, shutdown, start, suspend |
SecurityService
public SecurityService()
- Creates a new security service.
getSecurityObjects
public java.lang.String[][] getSecurityObjects()
- Returns the system object entities defined by this system instance. Returnins an array
of two element arrays (first elem: identifier string, secnod elem: description).
- Specified by:
getSecurityObjects in interface ISecurityAware
- Returns:
- The security object string arrays (2 elems)
initSecurity
public void initSecurity(ISecurity security,
ITicket systemTicket)
- This called is defined by the security-aware interface. Actually we do not have to do anything
sinc we ourself generated the systemTicket. This method here is just left empty.
- Specified by:
initSecurity in interface ISecurityAware
setSystemTicket
public void setSystemTicket(ITicket systemTicket)
throws java.lang.SecurityException
- Used to intialize the security with the context's security ticket for the system.
Please be aware that you must call this method BEFORE you configure your
security service. If you do not so the security service will not be initialised with this system user ticket.
- Specified by:
setSystemTicket in interface ISecurityService
- Parameters:
The - system ticket- Throws:
java.lang.SecurityException - Raised if the security ticket is yet defined.
configure
public void configure(org.jdom.Element configuration)
throws ConfigurationException
- This configures the service. The service can be configured and then started
independently. The configuration process creates a new security context and
loads its data directly. The start method is also directly called.
- Specified by:
configure in interface IConfigurable- Overrides:
configure in class AService
- Parameters:
configuration - the configuration root for this service- Throws:
ServiceConfigurationException - If the configuration is missing or invalid
accessGranted
public boolean accessGranted(java.lang.String objectID,
int level,
ITicket ticket)
- Returns true if the user is granted access of the given level to the object with the
given ID. This is the cetral access control method of the WHOLE security system.
- Specified by:
accessGranted in interface ISecurityService
- Returns:
- true if the user is a member
login
public ITicket login(java.lang.String user,
java.lang.String pwd)
throws java.lang.SecurityException
- Login a user.
- Specified by:
login in interface ISecurityService
- Parameters:
user - The user iduser - The user password- Throws:
If - access was denied
getSecurity
public ISecurity getSecurity(ITicket admin)
throws java.lang.SecurityException
- Get the security object. This must be only allowed to admin users since for
all "normal" operations the accessgranted method is sufficient.
- Specified by:
getSecurity in interface ISecurityService
- Parameters:
admin - The admin ticket