org.jwarp.service.security
Class ASecurity

java.lang.Object
  |
  +--org.jwarp.service.security.ASecurity
All Implemented Interfaces:
ISecurity, ISecurityAware
Direct Known Subclasses:
FileSecurity, SQLSecurity

public abstract class ASecurity
extends java.lang.Object
implements ISecurity

This is the basic class you handles security qiestions such as checking access rights, handling users, groups and system objects. Subclasses of this class only have to implement the loading and saving of the internal state.

Version:
1.0
Author:
Anatole Tresch

Field Summary
(package private)  int defaultExpireSeconds
          The default expire time for tickets in seconds
(package private)  java.util.List listeners
           
(package private)  IItem system
           
(package private)  IItem systemContext
           
(package private)  IItem systemSec
           
(package private)  ITicket systemTicket
          The actual valid system ticket.
(package private)  java.util.Hashtable tickets
          The currently defined valid tickets.
 
Fields inherited from interface org.jwarp.service.security.ISecurity
ALL_USERS, LEVEL_CREATE, LEVEL_DELETE, LEVEL_FULLACCESS, LEVEL_GRANT, LEVEL_READ, LEVEL_UPDATE
 
Constructor Summary
ASecurity(ITicket systemTicket)
          Creates a new security.
 
Method Summary
 void addSecurityListener(ISecurityListener listener)
          Add a work manager listener to listen to the work managers activities.
 void checkAdmin(ITicket admin, int level)
          Check if the given ticket has global system admin rights.
 void checkTicket(ITicket user)
          Check the validity of the given ticket.
protected  void fireSecurityEvent(SecurityEvent evt)
          Method used to fire a work manager event to all registered listeners.
 IContext getContext()
          Returns the context of this security.
protected  int getExpireExtendSeconds(ISecurityUser user)
          This method returns how many seconds the expire time is extended when the ticket is accessed at some time.
protected  int getExpireSeconds(ISecurityUser user)
          This method returns how many seconds a ticket for this user will be valid.
 java.lang.String[][] getSecurityObjects()
          Returns the system object entities defined by this system instance.
 void initSecurity(ISecurity security, ITicket systemTicket)
          This method is called after all system related objects are defined.
 boolean isLoggedIn(ISecurityUser user, ITicket admin)
          Returns true if the user is loged in.
 void removeSecurityListener(ISecurityListener listener)
          Removes a work manager listener from the listeners list.
 void setContext(IContext context, ITicket admin)
          Set a new context (only allowed for admin users)
 
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.security.ISecurity
accessGranted, accessGranted, addMember, addMember, createGroup, createObject, createUser, delete, delete, delete, getGroup, getGroup, getGroups, getMembers, getObject, getObject, getObjects, getUser, getUser, getUsers, grant, grant, grant, grant, login, removeMember, removeMember, revoke, revoke, revoke, revoke
 

Field Detail

tickets

java.util.Hashtable tickets
The currently defined valid tickets.

defaultExpireSeconds

int defaultExpireSeconds
The default expire time for tickets in seconds

systemTicket

transient ITicket systemTicket
The actual valid system ticket.

system

transient IItem system

systemSec

transient IItem systemSec

systemContext

transient IItem systemContext

listeners

transient java.util.List listeners
Constructor Detail

ASecurity

public ASecurity(ITicket systemTicket)
Creates a new security.
Method Detail

checkTicket

public void checkTicket(ITicket user)
                 throws java.lang.SecurityException
Check the validity of the given ticket.
Specified by:
checkTicket in interface ISecurity

isLoggedIn

public boolean isLoggedIn(ISecurityUser user,
                          ITicket admin)
                   throws java.lang.SecurityException
Description copied from interface: ISecurity
Returns true if the user is loged in.
Specified by:
isLoggedIn in interface ISecurity
Returns:
true if the user given is logged in to this security context

getExpireSeconds

protected int getExpireSeconds(ISecurityUser user)
This method returns how many seconds a ticket for this user will be valid. By default this method returns -1 thus no tickets will ever expire.

getExpireExtendSeconds

protected int getExpireExtendSeconds(ISecurityUser user)
This method returns how many seconds the expire time is extended when the ticket is accessed at some time. By default this method returns -1 meaning the value is not defined / ever.

checkAdmin

public void checkAdmin(ITicket admin,
                       int level)
                throws java.lang.SecurityException
Check if the given ticket has global system admin rights. Note that subclasses need to override this setting.
Parameters:
admin - The ticket to be proofed.

setContext

public void setContext(IContext context,
                       ITicket admin)
                throws java.lang.SecurityException
Set a new context (only allowed for admin users)
Specified by:
setContext in interface ISecurity

getContext

public IContext getContext()
Returns the context of this security.
Returns:
The security's context

addSecurityListener

public void addSecurityListener(ISecurityListener listener)
Add a work manager listener to listen to the work managers activities.
Specified by:
addSecurityListener in interface ISecurity

removeSecurityListener

public void removeSecurityListener(ISecurityListener listener)
Removes a work manager listener from the listeners list.
Specified by:
removeSecurityListener in interface ISecurity
Parameters:
The - listener

fireSecurityEvent

protected void fireSecurityEvent(SecurityEvent evt)
Method used to fire a work manager event to all registered listeners.
Parameters:
evt - The event to be broadcasted.

initSecurity

public void initSecurity(ISecurity security,
                         ITicket systemTicket)
                  throws java.lang.SecurityException
Description copied from interface: ISecurityAware
This method is called after all system related objects are defined. Note that if no security is available null is passed as security parameter.
Specified by:
initSecurity in interface ISecurityAware

getSecurityObjects

public java.lang.String[][] getSecurityObjects()
Description copied from interface: ISecurityAware
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
Following copied from interface: org.jwarp.service.security.ISecurityAware
Returns:
The security object string arrays (2 elems)

©   O R C A   S y s t e m s