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 SummaryNested Classes Modifier and Type Class Description static classPKIAuthenticationPlugin.PKIHeaderData- 
Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBeanSolrInfoBean.Category, SolrInfoBean.Group
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static StringACCEPT_VERSIONSstatic PrincipalCLUSTER_MEMBER_NODEstatic StringHEADERstatic StringHEADER_V2static StringNODE_IS_USERstatic StringSEND_VERSION- 
Fields inherited from class org.apache.solr.security.AuthenticationPluginAUTHENTICATION_PLUGIN_PROP, HTTP_HEADER_X_SOLR_AUTHDATA, numAuthenticated, numErrors, numMissingCredentials, numPassThrough, numWrongCredentials, requests, requestTimes, solrMetricsContext, totalTime
 
- 
 - 
Constructor SummaryConstructors Constructor Description PKIAuthenticationPlugin(CoreContainer cores, String nodeName, PublicKeyHandler publicKeyHandler)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Implementations should always callSolrMetricProducer.super.close()to ensure that metrics with the same life-cycle as this component are properly unregistered.booleandoAuthenticate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain)This method attempts to authenticate the request.org.apache.solr.client.solrj.impl.SolrHttpClientBuildergetHttpClientBuilder(org.apache.solr.client.solrj.impl.SolrHttpClientBuilder builder)StringgetPublicKey()voidinit(Map<String,Object> pluginConfig)This is called upon loading up of a plugin, used for setting it up.booleanisInterceptorRegistered()booleanneedsAuthorization(javax.servlet.http.HttpServletRequest req)voidsetup(org.apache.solr.client.solrj.impl.Http2SolrClient client)static voidwithServerIdentity(boolean enabled)Mark the current thread as a server thread and set a flag in SolrRequestInfo to indicate you want to send a request as the server identity instead of as the authenticated user.- 
Methods inherited from class org.apache.solr.security.AuthenticationPluginauthenticate, closeRequest, getCategory, getDescription, getName, getSolrMetricsContext, initializeMetrics, interceptInternodeRequest, interceptInternodeRequest, wrapWithPrincipal, wrapWithPrincipal
 
- 
 
- 
- 
- 
Field Detail- 
ACCEPT_VERSIONSpublic static final String ACCEPT_VERSIONS - See Also:
- Constant Field Values
 
 - 
SEND_VERSIONpublic static final String SEND_VERSION - See Also:
- Constant Field Values
 
 - 
HEADERpublic static final String HEADER - See Also:
- Constant Field Values
 
 - 
HEADER_V2public static final String HEADER_V2 - See Also:
- Constant Field Values
 
 - 
NODE_IS_USERpublic static final String NODE_IS_USER - See Also:
- Constant Field Values
 
 - 
CLUSTER_MEMBER_NODEpublic static final Principal CLUSTER_MEMBER_NODE 
 
- 
 - 
Constructor Detail- 
PKIAuthenticationPluginpublic PKIAuthenticationPlugin(CoreContainer cores, String nodeName, PublicKeyHandler publicKeyHandler) 
 
- 
 - 
Method Detail- 
withServerIdentitypublic static void withServerIdentity(boolean enabled) Mark the current thread as a server thread and set a flag in SolrRequestInfo to indicate you want to send a request as the server identity instead of as the authenticated user.- Parameters:
- enabled- If true, enable the current thread to make requests with the server identity.
- See Also:
- SolrRequestInfo.setUseServerToken(boolean)
 
 - 
isInterceptorRegisteredpublic boolean isInterceptorRegistered() 
 - 
initpublic void init(Map<String,Object> pluginConfig) Description copied from class:AuthenticationPluginThis is called upon loading up of a plugin, used for setting it up.- Specified by:
- initin class- AuthenticationPlugin
- Parameters:
- pluginConfig- Config parameters, possibly from a ZK source
 
 - 
doAuthenticatepublic boolean doAuthenticate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain) throws ExceptionDescription copied from class:AuthenticationPluginThis 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:
- doAuthenticatein class- AuthenticationPlugin
- Parameters:
- request- the http request
- response- the http response
- filterChain- 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
 
 - 
setuppublic void setup(org.apache.solr.client.solrj.impl.Http2SolrClient client) - Specified by:
- setupin interface- HttpClientBuilderPlugin
 
 - 
getHttpClientBuilderpublic org.apache.solr.client.solrj.impl.SolrHttpClientBuilder getHttpClientBuilder(org.apache.solr.client.solrj.impl.SolrHttpClientBuilder builder) - Specified by:
- getHttpClientBuilderin interface- HttpClientBuilderPlugin
- Returns:
- Returns an instance of a SolrHttpClientBuilder to be used for configuring the HttpClients for use with SolrJ clients.
 
 - 
needsAuthorizationpublic boolean needsAuthorization(javax.servlet.http.HttpServletRequest req) 
 - 
closepublic void close() throws IOExceptionDescription copied from interface:SolrMetricProducerImplementations 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:
- closein interface- AutoCloseable
- Specified by:
- closein interface- SolrMetricProducer
- Throws:
- IOException
 
 - 
getPublicKeypublic String getPublicKey() 
 
- 
 
-