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 ClassesNested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBean
SolrInfoBean.Category, SolrInfoBean.Group -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Principalstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.apache.solr.security.AuthenticationPlugin
AUTHENTICATION_PLUGIN_PROP, HTTP_HEADER_X_SOLR_AUTHDATA, numAuthenticated, numErrors, numMissingCredentials, numPassThrough, numWrongCredentials, requests, requestTimes, solrMetricsContextFields inherited from interface org.apache.solr.metrics.SolrMetricProducer
CATEGORY_ATTR, HANDLER_ATTR, NAME_ATTR, OPERATION_ATTR, PLUGIN_NAME_ATTR, RESULT_ATTR, TYPE_ATTR -
Constructor Summary
ConstructorsConstructorDescriptionPKIAuthenticationPlugin(CoreContainer cores, String nodeName, PublicKeyHandler publicKeyHandler) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Implementations should always callSolrMetricProducer.super.close()to ensure that metrics with the same life-cycle as this component are properly unregistered.booleandoAuthenticate(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain filterChain) This method attempts to authenticate the request.voidThis is called upon loading up of a plugin, used for setting it up.booleanbooleanneedsAuthorization(jakarta.servlet.http.HttpServletRequest req) voidsetup(HttpJettySolrClient 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.AuthenticationPlugin
authenticate, closeRequest, getCategory, getDescription, getName, getSolrMetricsContext, initializeMetrics, interceptInternodeRequest, wrapWithPrincipal, wrapWithPrincipal
-
Field Details
-
ACCEPT_VERSIONS
- See Also:
-
SEND_VERSION
- See Also:
-
HEADER
- See Also:
-
HEADER_V2
- See Also:
-
NODE_IS_USER
- See Also:
-
CLUSTER_MEMBER_NODE
-
-
Constructor Details
-
PKIAuthenticationPlugin
public PKIAuthenticationPlugin(CoreContainer cores, String nodeName, PublicKeyHandler publicKeyHandler)
-
-
Method Details
-
withServerIdentity
public 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:
-
isInterceptorRegistered
public boolean isInterceptorRegistered() -
init
Description copied from class:AuthenticationPluginThis is called upon loading up of a plugin, used for setting it up.- Specified by:
initin classAuthenticationPlugin- Parameters:
pluginConfig- Config parameters, possibly from a ZK source
-
doAuthenticate
public boolean doAuthenticate(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain filterChain) throws Exception Description 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 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
- Specified by:
setupin interfaceHttpClientBuilderPlugin
-
needsAuthorization
public boolean needsAuthorization(jakarta.servlet.http.HttpServletRequest req) -
close
Description 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 interfaceAutoCloseable- Specified by:
closein interfaceSolrMetricProducer- Throws:
IOException
-
getPublicKey
-