|
deegree 2.5 (2011/06/29 09:44 build-8-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.security.drm.SecurityAccessManager
public class SecurityAccessManager
This singleton manages access to the data stored in an associated SecurityRegistry
-instance.
In order to use methods that read from the registry, a SecurityAccess
instance has to be acquired first:
Example Code:
SecurityAccess access = SecurityAccessManager.getInstance(); ReadToken accessToken = access.acquireReadToken(); Role role = access.getRoleById( accessToken, 1 );
If write access is needed as well, one has to acquire the exclusive SecurityTransaction
. This is only
possible if the User
has the "write"-privilege.
Example Code:
SecurityAccess access = SecurityAccess.getInstance (); SecurityTransaction lock = access.acquireSecurityTransaction (user); access.registerUser (lock, "TESTUSER"); ... access.commitTransaction (lock); // after committing changes are made persistent
Method Summary | |
---|---|
void |
abortTransaction(SecurityTransaction lock)
Aborts the current transaction and undoes all changes made to the Registry . |
SecurityAccess |
acquireAccess(User user)
Tries to acquire a SecurityAccess -instance. |
SecurityTransaction |
acquireTransaction(User user)
Tries to acquire the SecurityTransaction for the given User . |
void |
commitTransaction(SecurityTransaction transaction)
Ends the current transaction and commits all changes to the Registry . |
static SecurityAccessManager |
getInstance()
Returns the only instance of this class. |
User |
getUserByName(java.lang.String name)
This method is only to be used to get an initial User object. |
static void |
initialize(java.lang.String registryClassName,
java.util.Properties registryProperties,
long timeout)
Initializes the SecurityAccessManager -singleton with the given Registry -instance. |
static boolean |
isInitialized()
|
(package private) void |
verify(SecurityTransaction transaction)
Verifies that the submitted Transaction is valid. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void initialize(java.lang.String registryClassName, java.util.Properties registryProperties, long timeout) throws GeneralSecurityException
SecurityAccessManager
-singleton with the given Registry
-instance.
registryClassName
- registryProperties
- timeout
-
GeneralSecurityException
public static boolean isInitialized()
public static SecurityAccessManager getInstance() throws GeneralSecurityException
GeneralSecurityException
public User getUserByName(java.lang.String name) throws GeneralSecurityException
User
object. (Otherwise one would need a
User
to perform a User
lookup.)
name
-
GeneralSecurityException
public SecurityAccess acquireAccess(User user) throws GeneralSecurityException, UnauthorizedException
SecurityAccess
-instance.
user
-
GeneralSecurityException
UnauthorizedException
public SecurityTransaction acquireTransaction(User user) throws GeneralSecurityException, UnauthorizedException
SecurityTransaction
for the given User
. Only possibly for
User
s that have the "modify"-privilege.
NOTE: The implementation checks if the currentTransaction
timed out BEFORE it checks if the user is
allowed to write to the registry at all. This is because some JDBC-drivers (at least the JDBC-ODBC- bridge
together with Microsoft Access (tm)) have been observed to return strange results sometimes when there's a
transaction still going on (so that the privileges of the user cannot be retrieved reliably from the registry).
user
-
GeneralSecurityException
UnauthorizedException
void verify(SecurityTransaction transaction) throws ReadWriteLockInvalidException
Transaction
is valid. There are two ways for it to become invalid:
transaction
-
ReadWriteLockInvalidException
GeneralSecurityException
- if transaction is invalidpublic void commitTransaction(SecurityTransaction transaction) throws GeneralSecurityException
Registry
.
transaction
-
GeneralSecurityException
public void abortTransaction(SecurityTransaction lock) throws GeneralSecurityException
Registry
.
lock
-
GeneralSecurityException
|
deegree 2.5 (2011/06/29 09:44 build-8-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org