public class MultiAuthPlugin extends AuthenticationPlugin implements ConfigEditablePlugin, SpecProvider
SolrInfoBean.Category, SolrInfoBean.Group
Modifier and Type | Field and Description |
---|---|
static String |
AUTHORIZATION_HEADER |
static String |
PROPERTY_SCHEME |
static String |
PROPERTY_SCHEMES |
AUTHENTICATION_PLUGIN_PROP, HTTP_HEADER_X_SOLR_AUTHDATA, numAuthenticated, numErrors, numMissingCredentials, numPassThrough, numWrongCredentials, requests, requestTimes, solrMetricsContext, totalTime
Constructor and Description |
---|
MultiAuthPlugin(CoreContainer cc) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Implementations should always call
SolrMetricProducer.super.close() to ensure that
metrics with the same life-cycle as this component are properly unregistered. |
void |
closeRequest()
Cleanup any per request data
|
boolean |
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.
|
ValidatingJsonMap |
getSpec() |
void |
init(Map<String,Object> pluginConfig)
This is called upon loading up of a plugin, used for setting it up.
|
void |
initializeMetrics(SolrMetricsContext parentContext,
String scope)
Initialize metrics specific to this producer.
|
protected void |
initPluginForScheme(Map<String,Object> schemeMap) |
protected boolean |
interceptInternodeRequest(org.apache.http.HttpRequest httpRequest,
org.apache.http.protocol.HttpContext httpContext)
Override this method to intercept internode requests.
|
protected boolean |
interceptInternodeRequest(org.eclipse.jetty.client.api.Request request)
Override this method to intercept internode requests.
|
authenticate, getCategory, getDescription, getMetricNames, getName, getSolrMetricsContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMetricRegistry, getMetricsSnapshot, registerMetricName
getUniqueMetricTag, initializeMetrics
public static final String PROPERTY_SCHEMES
public static final String PROPERTY_SCHEME
public static final String AUTHORIZATION_HEADER
public MultiAuthPlugin(CoreContainer cc)
public void init(Map<String,Object> pluginConfig)
AuthenticationPlugin
init
in class AuthenticationPlugin
pluginConfig
- Config parameters, possibly from a ZK sourcepublic void initializeMetrics(SolrMetricsContext parentContext, String scope)
SolrMetricProducer
initializeMetrics
in interface SolrMetricProducer
initializeMetrics
in class AuthenticationPlugin
parentContext
- parent metrics context. If this component has the same life-cycle as the parent
it can simply use the parent context, otherwise it should obtain a child context
using SolrMetricsContext.getChildContext(Object)
passing this
as the child.scope
- component scopepublic boolean doAuthenticate(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain filterChain) throws Exception
AuthenticationPlugin
doAuthenticate
in class AuthenticationPlugin
servletRequest
- the http requestservletResponse
- the http responsefilterChain
- the servlet filter chainException
- any exception thrown during the authentication, e.g. PrivilegedActionExceptionpublic void close() throws IOException
SolrMetricProducer
SolrMetricProducer.super.close()
to ensure that
metrics with the same life-cycle as this component are properly unregistered. This prevents
obscure memory leaks.
from: https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html
While this interface method is declared to throw Exception, implementers are strongly encouraged
to declare concrete implementations of the close method to throw more specific exceptions, or to
throw no exception at all if the close operation cannot fail.close
in interface AutoCloseable
close
in interface SolrMetricProducer
IOException
public void closeRequest()
AuthenticationPlugin
closeRequest
in class AuthenticationPlugin
protected boolean interceptInternodeRequest(org.apache.http.HttpRequest httpRequest, org.apache.http.protocol.HttpContext httpContext)
AuthenticationPlugin
PKIAuthenticationPlugin
. Return true to indicate that your plugin
did handle the request, or false to signal that PKI plugin should handle it. This method
will be called by PKIAuthenticationPlugin
's interceptor.
If not overridden, this method will return true for plugins implementing HttpClientBuilderPlugin
.
This method can be overridden by subclasses e.g. to set HTTP headers, even if you don't use a clientBuilder.
interceptInternodeRequest
in class AuthenticationPlugin
httpRequest
- the httpRequest that is about to be sent to another internal Solr nodehttpContext
- the context of that request.protected boolean interceptInternodeRequest(org.eclipse.jetty.client.api.Request request)
AuthenticationPlugin
PKIAuthenticationPlugin
. Return true to indicate that your plugin
did handle the request, or false to signal that PKI plugin should handle it. This method
will be called by PKIAuthenticationPlugin
's interceptor.
If not overridden, this method will return true for plugins implementing HttpClientBuilderPlugin
.
This method can be overridden by subclasses e.g. to set HTTP headers, even if you don't use a clientBuilder.
interceptInternodeRequest
in class AuthenticationPlugin
request
- the httpRequest that is about to be sent to another internal Solr nodepublic ValidatingJsonMap getSpec()
getSpec
in interface SpecProvider
public Map<String,Object> edit(Map<String,Object> latestConf, List<CommandOperation> commands)
ConfigEditablePlugin
edit
in interface ConfigEditablePlugin
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.