Interface ISecurityContext
- All Superinterfaces:
ISecurity, ISynchronizableSecuritySystem
The security context is responsible to manage users, roles and sessions.
- Since:
- 17.05.2006
- API:
- This is a public API.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcheckPermission(ISecurityDescriptor securityDescriptor, IPermission permission) Checks if the current session has a certain permission on the security descriptorstatic ISecurityContextcurrent()Gets the current security context.<T> TExecutes the callable in the context of the given execution contextDeprecated, for removal: This API element is subject to removal in a future version.longgetId()Gets the identifier of the security contextbooleanhasPermission(ISecurityDescriptor securityDescriptor, IPermission permission) Checks if the current session has a certain permission on the security descriptorroles()Gets the role repository of this security context.sessions()Gets the session repository of this security context.users()Gets the user repository of this security context.Methods inherited from interface ISynchronizableSecuritySystem
isSynchronizationRunning, synchronizeUser, triggerSynchronization
-
Method Details
-
roles
IRoleRepository roles()Gets the role repository of this security context. Allows to find
rolesof this security context / application.Example:
IRole manager = ivy.security.roles().find("Manager"); -
users
IUserRepository users()Gets the user repository of this security context. Allows to create, delete, find, query
usersof this security context / application.Example:
IUser user = ivy.security.users().find("Ivy"); -
sessions
ISessionRepository sessions()Gets the session repository of this security context. Allows to create, destroy, find sessions of this security context / application.
Example:
Number sessionCount = ivy.security.sessions().count(); -
getSystemUser
IUser getSystemUser()- API:
- This public API is available in Java.
-
hasPermission
Checks if the current session has a certain permission on the security descriptor- Parameters:
securityDescriptor- the security descriptor to check for the permissionpermission- the identifier of the permission to check- Returns:
- true if session has permission, otherwise false
- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
-
checkPermission
Checks if the current session has a certain permission on the security descriptor- Parameters:
securityDescriptor- the security descriptor to check for the permissionpermission- the permission to check- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
-
getCurrentSession
Deprecated, for removal: This API element is subject to removal in a future version.usesessions().current()Gets the current session. Gets the current session associated to the current thread- Returns:
- current session or null if current thread has no session associated
- API:
- This public API is available in Java.
-
getId
long getId()Gets the identifier of the security context- Returns:
- identifier
- API:
- This public API is available in Java.
-
executeAs
Executes the callable in the context of the given execution context- Type Parameters:
T- the type of the result- Parameters:
callable- the callableexecutionContext- the execution context- Returns:
- the result of the callable
- Throws:
Exception- if callable throws an exception- API:
- This public API is available in Java.
-
current
Gets the current security context.
Will return null if called out of scope. The scope is set if you call this method from an ivy process or any supported ivy environment. It is not set in non supported ivy environments (e.g. if you start your own threads, etc.).
- Returns:
- current security context or null if out of scope
- Since:
- 9.3
- API:
- This public API is available in Java.
-
sessions().current()