Package org.apache.solr.security
Class PKIAuthenticationPlugin
- java.lang.Object
-
- org.apache.solr.security.AuthenticationPlugin
-
- org.apache.solr.security.PKIAuthenticationPlugin
-
- All Implemented Interfaces:
AutoCloseable
,SolrInfoBean
,SolrMetricProducer
,HttpClientBuilderPlugin
public class PKIAuthenticationPlugin extends AuthenticationPlugin implements HttpClientBuilderPlugin
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PKIAuthenticationPlugin.PKIHeaderData
-
Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBean
SolrInfoBean.Category, SolrInfoBean.Group
-
-
Field Summary
Fields Modifier and Type Field Description static String
HEADER
static String
NODE_IS_USER
-
Fields inherited from class org.apache.solr.security.AuthenticationPlugin
AUTHENTICATION_PLUGIN_PROP, HTTP_HEADER_X_SOLR_AUTHDATA, numAuthenticated, numErrors, numMissingCredentials, numPassThrough, numWrongCredentials, requests, requestTimes, solrMetricsContext, totalTime
-
-
Constructor Summary
Constructors Constructor Description PKIAuthenticationPlugin(CoreContainer cores, String nodeName, PublicKeyHandler publicKeyHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Implementations should always callSolrMetricProducer.super.close()
to ensure that metrics with the same life-cycle as this component are properly unregistered.boolean
doAuthenticate(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain filterChain)
This method attempts to authenticate the request.SolrHttpClientBuilder
getHttpClientBuilder(SolrHttpClientBuilder builder)
String
getPublicKey()
void
init(Map<String,Object> pluginConfig)
This is called upon loading up of a plugin, used for setting it up.boolean
isInterceptorRegistered()
boolean
needsAuthorization(javax.servlet.http.HttpServletRequest req)
void
setup(Http2SolrClient client)
-
Methods inherited from class org.apache.solr.security.AuthenticationPlugin
authenticate, closeRequest, getCategory, getDescription, getMetricNames, getName, getSolrMetricsContext, initializeMetrics, interceptInternodeRequest, interceptInternodeRequest
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.core.SolrInfoBean
getMetricRegistry, getMetricsSnapshot, registerMetricName
-
Methods inherited from interface org.apache.solr.metrics.SolrMetricProducer
initializeMetrics
-
-
-
-
Field Detail
-
HEADER
public static final String HEADER
- See Also:
- Constant Field Values
-
NODE_IS_USER
public static final String NODE_IS_USER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PKIAuthenticationPlugin
public PKIAuthenticationPlugin(CoreContainer cores, String nodeName, PublicKeyHandler publicKeyHandler)
-
-
Method Detail
-
isInterceptorRegistered
public boolean isInterceptorRegistered()
-
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
-
doAuthenticate
public boolean doAuthenticate(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, 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:
request
- the http requestresponse
- 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
-
setup
public void setup(Http2SolrClient client)
- Specified by:
setup
in interfaceHttpClientBuilderPlugin
-
getHttpClientBuilder
public SolrHttpClientBuilder getHttpClientBuilder(SolrHttpClientBuilder builder)
- Specified by:
getHttpClientBuilder
in interfaceHttpClientBuilderPlugin
- Returns:
- Returns an instance of a SolrHttpClientBuilder to be used for configuring the HttpClients for use with SolrJ clients.
-
needsAuthorization
public boolean needsAuthorization(javax.servlet.http.HttpServletRequest req)
-
close
public void close() throws IOException
Description copied from interface:SolrMetricProducer
Implementations should always callSolrMetricProducer.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.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceSolrMetricProducer
- Throws:
IOException
-
getPublicKey
public String getPublicKey()
-
-