Package org.apache.solr.security
Class BasicAuthPlugin
- java.lang.Object
-
- org.apache.solr.security.AuthenticationPlugin
-
- org.apache.solr.security.BasicAuthPlugin
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,SpecProvider
,ConfigEditablePlugin
public class BasicAuthPlugin extends AuthenticationPlugin implements ConfigEditablePlugin, SpecProvider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
BasicAuthPlugin.AuthenticationProvider
-
Field Summary
Fields Modifier and Type Field Description static String
PROPERTY_BLOCK_UNKNOWN
static String
PROPERTY_REALM
-
Fields inherited from class org.apache.solr.security.AuthenticationPlugin
AUTHENTICATION_PLUGIN_PROP
-
-
Constructor Summary
Constructors Constructor Description BasicAuthPlugin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
authenticate(String username, String pwd)
void
close()
void
closeRequest()
Cleanup any per request databoolean
doAuthenticate(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain filterChain)
This method attempts to authenticate the request.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.protected BasicAuthPlugin.AuthenticationProvider
getAuthenticationProvider(Map<String,Object> pluginConfig)
boolean
getBlockUnknown()
ValidatingJsonMap
getSpec()
void
init(Map<String,Object> pluginConfig)
This is called upon loading up of a plugin, used for setting it up.
-
-
-
Field Detail
-
PROPERTY_BLOCK_UNKNOWN
public static final String PROPERTY_BLOCK_UNKNOWN
- See Also:
- Constant Field Values
-
PROPERTY_REALM
public static final String PROPERTY_REALM
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(Map<String,Object> pluginConfig)
Description copied from class:AuthenticationPlugin
This is called upon loading up of a plugin, used for setting it up.- Specified by:
init
in classAuthenticationPlugin
- Parameters:
pluginConfig
- Config parameters, possibly from a ZK source
-
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
-
getAuthenticationProvider
protected BasicAuthPlugin.AuthenticationProvider getAuthenticationProvider(Map<String,Object> pluginConfig)
-
doAuthenticate
public boolean doAuthenticate(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain filterChain) throws Exception
Description copied from class:AuthenticationPlugin
This method attempts to authenticate the request. Upon a successful authentication, this must call the next filter in the filter chain and set the user principal of the request, or else, upon an error or an authentication failure, throw an exception.- Specified by:
doAuthenticate
in classAuthenticationPlugin
- Parameters:
servletRequest
- the http requestservletResponse
- the http responsefilterChain
- the servlet filter chain- Returns:
- false if the request not be processed by Solr (not continue), i.e. the response and status code have already been sent.
- Throws:
Exception
- any exception thrown during the authentication, e.g. PrivilegedActionException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
closeRequest
public void closeRequest()
Description copied from class:AuthenticationPlugin
Cleanup any per request data- Overrides:
closeRequest
in classAuthenticationPlugin
-
getSpec
public ValidatingJsonMap getSpec()
- Specified by:
getSpec
in interfaceSpecProvider
-
getBlockUnknown
public boolean getBlockUnknown()
-
-