Package org.apache.solr.security
Class RuleBasedAuthorizationPluginBase
- java.lang.Object
-
- org.apache.solr.security.RuleBasedAuthorizationPluginBase
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,SpecProvider
,AuthorizationPlugin
,ConfigEditablePlugin
- Direct Known Subclasses:
ExternalRoleRuleBasedAuthorizationPlugin
,RuleBasedAuthorizationPlugin
public abstract class RuleBasedAuthorizationPluginBase extends Object implements AuthorizationPlugin, ConfigEditablePlugin, SpecProvider
Base class for rule based authorization plugins
-
-
Constructor Summary
Constructors Constructor Description RuleBasedAuthorizationPluginBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AuthorizationResponse
authorize(AuthorizationContext context)
void
close()
boolean
doesUserHavePermission(Principal principal, PermissionNameProvider.Name permission)
Map<String,Object>
edit(Map<String,Object> latestConf, List<CommandOperation> commands)
Operate the commands on the latest conf and return a new conf object If there are errors in the commands , throw a SolrException.ValidatingJsonMap
getSpec()
abstract Set<String>
getUserRoles(Principal principal)
Finds users rolesvoid
init(Map<String,Object> initInfo)
-
-
-
Method Detail
-
authorize
public AuthorizationResponse authorize(AuthorizationContext context)
- Specified by:
authorize
in interfaceAuthorizationPlugin
-
doesUserHavePermission
public boolean doesUserHavePermission(Principal principal, PermissionNameProvider.Name permission)
-
init
public void init(Map<String,Object> initInfo)
- Specified by:
init
in interfaceAuthorizationPlugin
-
getUserRoles
public abstract Set<String> getUserRoles(Principal principal)
Finds users roles- Parameters:
principal
- the user Principal to fetch roles for- Returns:
- set of roles as strings or empty set if no roles found
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
edit
public Map<String,Object> edit(Map<String,Object> latestConf, List<CommandOperation> commands)
Description copied from interface:ConfigEditablePlugin
Operate the commands on the latest conf and return a new conf object If there are errors in the commands , throw a SolrException. return a null if no changes are to be made as a result of this edit. It is the responsibility of the implementation to ensure that the returned config is valid . The framework does no validation of the data- Specified by:
edit
in interfaceConfigEditablePlugin
-
getSpec
public ValidatingJsonMap getSpec()
- Specified by:
getSpec
in interfaceSpecProvider
-
-