Interface AuthorizationSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This is the basic session for verifying authorizations.
Like all OsidSessions, AuthorizationSessions are
dedicated to single processing threads and a single authenticated user.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if this user can perform authorization checks.getAuthorizationCondition(Id functionId) Gets theAuthorizationConditionfor making conditional authorization checks.getVault()Gets theVaultassociated with this session.Gets theVaultIdassociated with this session.booleanisAuthorized(Id agentId, Id functionId, Id qualifierId) Determines if the given agent is authorized.booleanisAuthorizedOnCondition(Id agentId, Id functionId, Id qualifierId, AuthorizationCondition condition) Determines if the given agent is authorized.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatTypes, getLocales, isAuthenticated, startTransaction, supportsTransactions
-
Method Details
-
getVaultId
Id getVaultId()Gets theVaultIdassociated with this session.- Returns:
- the
Vault Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getVault
Gets theVaultassociated with this session.- Returns:
- the
Vaultassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canAccessAuthorizations
boolean canAccessAuthorizations()Tests if this user can perform authorization checks. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer lookup operations to unauthorized users.- Returns:
falseif authorization methods are not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
isAuthorized
boolean isAuthorized(Id agentId, Id functionId, Id qualifierId) throws NotFoundException, OperationFailedException, PermissionDeniedException Determines if the given agent is authorized. An agent is authorized if an active authorization exists whoseAgent,FunctionandQualifiermatches the supplied parameters. Authorizations may be defined using groupings or hieratchical structures for both theAgentand theQualifierbut are queried in the de-nornmalized form. TheAgentis generally determined through the use of an Authentication OSID. TheFunctionandQualifierare already known as they map to the desired authorization to validate.- Parameters:
agentId- theIdof anAgentfunctionId- theIdof aFunctionqualifierId- theIdof aQualifier- Returns:
trueif the user is authorized,falseothersise- Throws:
NotFoundException-functionIdis not foundNullArgumentException-agentId,functionIdorqualifierIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure making request- Compliance:
mandatory- This method must be implemented.- Notes:
Authorizations- may be stored in a normalized form with respect to various Resources and created using specific nodes in a {@code Function} or {@code Qualifer} hierarchy. The provider needs to maintain a de-normalized implicit authorization store or expand the applicable hierarchies on the fly to honor this query. Querying the authorization service may in itself require a separate authorization. A {@code PERMISSION_DENIED} is a result of this authorization failure. If no explicit or implicit authorization exists for the queried tuple, this method should return {@code false}.
-
getAuthorizationCondition
AuthorizationCondition getAuthorizationCondition(Id functionId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets theAuthorizationConditionfor making conditional authorization checks.- Parameters:
functionId- theIdof aFunction- Returns:
- an authorization condition
- Throws:
NotFoundException-functionIdis not foundNullArgumentException-functionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure making request- Compliance:
mandatory- This method must be implemented.
-
isAuthorizedOnCondition
boolean isAuthorizedOnCondition(Id agentId, Id functionId, Id qualifierId, AuthorizationCondition condition) throws NotFoundException, OperationFailedException, PermissionDeniedException Determines if the given agent is authorized. An agent is authorized if an active authorization exists whoseAgent,FunctionandQualifiermatches the supplied parameters. Authorizations may be defined using groupings or hieratchical structures for both theAgentand theQualifierbut are queried in the de-nornmalized form. TheAgentis generally determined through the use of an Authentication OSID. TheFunctionandQualifierare already known as they map to the desired authorization to validate.- Parameters:
agentId- theIdof anAgentfunctionId- theIdof aFunctionqualifierId- theIdof aQualifiercondition- an authorization condition- Returns:
trueif the user is authorized,falseothersise- Throws:
NotFoundException-functionIdis not foundNullArgumentException-agentId,functionId, qualifierId, orconditionisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure making requestUnsupportedException-conditiondid not originate fromgetAuthorizationCondition()- Compliance:
mandatory- This method must be implemented.- Notes:
Authorizations- may be stored in a normalized form with respect to various {@code Resources} and created using specific nodes in a {@code Function} or {@code Qualifer} hierarchy. The provider needs to maintain a de-normalized implicit authorization store or expand the applicable hierarchies on the fly to honor this query. Querying the authorization service may in itself require a separate authorization. A {@code PERMISSION_DENIED} is a result of this authorization failure. If no explicit or implicit authorization exists for the queried tuple, this method should return {@code false}.
-