public class DefaultAuthorizer extends Object implements Authorizer
Authorizer implementation.| Constructor and Description |
|---|
DefaultAuthorizer(DiscretionaryAccessController externalDacHandler,
MandatoryAccessController macHandler,
UserStore userStore) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addGroupsToResource(String resourceType,
String resourceName,
String action,
List<String> groups)
Allow given groups to access the givne resource.
|
void |
addProtectedResource(String resourceType,
String resourceName,
boolean durable,
String owner)
Create auth resource.
|
boolean |
authorize(String scopeName,
String userId)
Authorize user with given scope key.
|
boolean |
authorize(String resourceType,
String resourceName,
String action,
String userId)
Authorize resource with given resource and action.
|
boolean |
changeResourceOwner(String resourceType,
String resourceName,
String owner)
Create auth resource.
|
void |
deleteProtectedResource(String resourceType,
String resourceName)
Delete auth resource.
|
AuthResource |
getAuthResource(String resourceType,
String resourceName)
Query auth resource.
|
void |
initialize(io.ballerina.messaging.broker.common.StartupContext startupContext)
Initialize authorization strategy based on given auth configuration, user store manager and data source.
|
boolean |
removeGroupFromResource(String resourceType,
String resourceName,
String action,
String group)
Revoke access from the given group.
|
public DefaultAuthorizer(DiscretionaryAccessController externalDacHandler, MandatoryAccessController macHandler, UserStore userStore)
public void initialize(io.ballerina.messaging.broker.common.StartupContext startupContext)
throws Exception
Authorizerinitialize in interface AuthorizerstartupContext - the startup context provides registered services for authProviderExceptionpublic boolean authorize(String scopeName, String userId) throws AuthException, AuthServerException, AuthNotFoundException
Authorizerauthorize in interface AuthorizerscopeName - a scope keyuserId - an user identifierAuthException - throws if error occur during authorizationAuthServerExceptionAuthNotFoundExceptionpublic boolean authorize(String resourceType, String resourceName, String action, String userId) throws AuthException, AuthServerException, AuthNotFoundException
Authorizerauthorize in interface AuthorizerresourceType - resource TyperesourceName - resourceaction - actionuserId - user identifierAuthException - throws if error occur during authorizationAuthServerExceptionAuthNotFoundExceptionpublic AuthResource getAuthResource(String resourceType, String resourceName) throws AuthServerException, AuthNotFoundException
AuthorizergetAuthResource in interface AuthorizerresourceType - resource typeresourceName - resource nameAuthServerException - throws if error occurs while authorizing resourceAuthNotFoundException - throws if auth resource is not foundpublic void addProtectedResource(String resourceType, String resourceName, boolean durable, String owner) throws AuthServerException
AuthorizeraddProtectedResource in interface AuthorizerresourceType - resource typeresourceName - resource namedurable - is durableowner - resource ownerAuthServerException - throws if error occurs while authorizing resourcepublic void deleteProtectedResource(String resourceType, String resourceName) throws AuthServerException, AuthNotFoundException
AuthorizerdeleteProtectedResource in interface AuthorizerresourceType - resource typeresourceName - resource nameAuthServerException - throws if error occurs while authorizing resourceAuthNotFoundException - throws if auth resource is not foundpublic boolean addGroupsToResource(String resourceType, String resourceName, String action, List<String> groups) throws AuthServerException
AuthorizeraddGroupsToResource in interface AuthorizerresourceType - resource typeresourceName - resource nameaction - actiongroups - list of group to addAuthServerException - throws if error occurred while adding groups to resourcepublic boolean removeGroupFromResource(String resourceType, String resourceName, String action, String group) throws AuthServerException, AuthNotFoundException
AuthorizerremoveGroupFromResource in interface AuthorizerresourceType - resource typeresourceName - resource nameaction - actiongroup - groupAuthServerException - throws if an server error occurredAuthNotFoundException - throws if the resource is not foundpublic boolean changeResourceOwner(String resourceType, String resourceName, String owner) throws AuthServerException, AuthNotFoundException, AuthException
AuthorizerchangeResourceOwner in interface AuthorizerresourceType - resource typeresourceName - resource nameowner - newOwnerAuthServerException - throws if an server error occurredAuthNotFoundException - throws if the resource is not foundAuthExceptionCopyright © 2018 WSO2. All rights reserved.