public abstract class AuthenticationPlugin extends Object implements Closeable, SolrInfoBean, SolrMetricProducer
SolrInfoBean.Category, SolrInfoBean.Group
Modifier and Type | Field and Description |
---|---|
static String |
AUTHENTICATION_PLUGIN_PROP |
static String |
HTTP_HEADER_X_SOLR_AUTHDATA |
protected SolrMetricManager |
metricManager |
protected com.codahale.metrics.Counter |
numAuthenticated |
protected com.codahale.metrics.Meter |
numErrors |
protected com.codahale.metrics.Counter |
numMissingCredentials |
protected com.codahale.metrics.Counter |
numPassThrough |
protected com.codahale.metrics.Counter |
numWrongCredentials |
protected String |
registryName |
protected com.codahale.metrics.Counter |
requests |
protected com.codahale.metrics.Timer |
requestTimes |
protected com.codahale.metrics.Counter |
totalTime |
Constructor and Description |
---|
AuthenticationPlugin() |
Modifier and Type | Method and Description |
---|---|
boolean |
authenticate(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain filterChain)
This method is called by SolrDispatchFilter in order to initiate authentication.
|
void |
closeRequest()
Cleanup any per request data
|
abstract boolean |
doAuthenticate(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain filterChain)
This method attempts to authenticate the request.
|
SolrInfoBean.Category |
getCategory()
Category of this component
|
String |
getDescription()
Simple one or two line description
|
Set<String> |
getMetricNames()
Modifiable set of metric names that this component reports (default is null,
which means none).
|
com.codahale.metrics.MetricRegistry |
getMetricRegistry()
An instance of
MetricRegistry that this component uses for metrics reporting
(default is null, which means no registry). |
String |
getName()
Simple common usage name, e.g.
|
abstract void |
init(Map<String,Object> pluginConfig)
This is called upon loading up of a plugin, used for setting it up.
|
void |
initializeMetrics(SolrMetricManager manager,
String registryName,
String tag,
String scope)
Initializes metrics specific to this producer
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMetricsSnapshot, registerMetricName
public static final String AUTHENTICATION_PLUGIN_PROP
public static final String HTTP_HEADER_X_SOLR_AUTHDATA
protected String registryName
protected SolrMetricManager metricManager
protected com.codahale.metrics.Meter numErrors
protected com.codahale.metrics.Counter requests
protected com.codahale.metrics.Timer requestTimes
protected com.codahale.metrics.Counter totalTime
protected com.codahale.metrics.Counter numAuthenticated
protected com.codahale.metrics.Counter numPassThrough
protected com.codahale.metrics.Counter numWrongCredentials
protected com.codahale.metrics.Counter numMissingCredentials
public abstract void init(Map<String,Object> pluginConfig)
pluginConfig
- Config parameters, possibly from a ZK sourcepublic abstract boolean doAuthenticate(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain filterChain) throws Exception
request
- the http requestresponse
- the http responsefilterChain
- the servlet filter chainException
- any exception thrown during the authentication, e.g. PrivilegedActionExceptionpublic final boolean authenticate(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain filterChain) throws Exception
Exception
protected boolean interceptInternodeRequest(org.apache.http.HttpRequest httpRequest, org.apache.http.protocol.HttpContext httpContext)
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.
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)
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.
request
- the httpRequest that is about to be sent to another internal Solr nodepublic void closeRequest()
public void initializeMetrics(SolrMetricManager manager, String registryName, String tag, String scope)
SolrMetricProducer
initializeMetrics
in interface SolrMetricProducer
manager
- an instance of SolrMetricManager
registryName
- registry name where metrics are registeredtag
- a symbolic tag that represents this instance of the producer,
or a group of related instances that have the same life-cycle. This tag is
used when managing life-cycle of some metrics and is set when
SolrMetricProducer.initializeMetrics(SolrMetricManager, String, String, String)
is called.scope
- scope of the metrics (eg. handler name) to separate metrics ofpublic String getName()
SolrInfoBean
getName
in interface SolrInfoBean
public String getDescription()
SolrInfoBean
getDescription
in interface SolrInfoBean
public SolrInfoBean.Category getCategory()
SolrInfoBean
getCategory
in interface SolrInfoBean
public Set<String> getMetricNames()
SolrInfoBean
SolrInfoBean.registerMetricName(String)
to capture what metrics names are reported from this component.
NOTE: this set has to allow iteration under modifications.
getMetricNames
in interface SolrInfoBean
public com.codahale.metrics.MetricRegistry getMetricRegistry()
SolrInfoBean
MetricRegistry
that this component uses for metrics reporting
(default is null, which means no registry).getMetricRegistry
in interface SolrInfoBean
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.