public class JWTAuthPlugin extends AuthenticationPlugin implements SpecProvider, ConfigEditablePlugin
Modifier and Type | Class and Description |
---|---|
static class |
JWTAuthPlugin.WellKnownDiscoveryConfig
Config object for a OpenId Connect well-known config
Typically exposed through /.well-known/openid-configuration endpoint
|
SolrInfoBean.Category, SolrInfoBean.Group
AUTHENTICATION_PLUGIN_PROP, HTTP_HEADER_X_SOLR_AUTHDATA, metricManager, numAuthenticated, numErrors, numMissingCredentials, numPassThrough, numWrongCredentials, registryName, requests, requestTimes, totalTime
Constructor and Description |
---|
JWTAuthPlugin()
Initialize plugin
|
Modifier and Type | Method and Description |
---|---|
protected org.apache.solr.security.JWTAuthPlugin.JWTAuthenticationResponse |
authenticate(String authorizationHeader)
Testable authentication method
|
void |
close() |
boolean |
doAuthenticate(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse,
javax.servlet.FilterChain filterChain)
Main authentication method that looks for correct JWT token in the Authorization header
|
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.
|
protected String |
generateAuthDataHeader() |
ValidatingJsonMap |
getSpec() |
void |
init(Map<String,Object> pluginConfig)
This is called upon loading up of a plugin, used for setting it up.
|
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, closeRequest, getCategory, getDescription, getMetricNames, getMetricRegistry, getName, initializeMetrics
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMetricsSnapshot, registerMetricName
public void init(Map<String,Object> pluginConfig)
AuthenticationPlugin
init
in class AuthenticationPlugin
pluginConfig
- Config parameters, possibly from a ZK sourcepublic boolean doAuthenticate(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain filterChain) throws Exception
doAuthenticate
in class AuthenticationPlugin
servletRequest
- the http requestservletResponse
- the http responsefilterChain
- the servlet filter chainException
- any exception thrown during the authentication, e.g. PrivilegedActionExceptionprotected org.apache.solr.security.JWTAuthPlugin.JWTAuthenticationResponse authenticate(String authorizationHeader)
authorizationHeader
- the http header "Authentication"public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public ValidatingJsonMap getSpec()
getSpec
in interface SpecProvider
public Map<String,Object> edit(Map<String,Object> latestConf, List<CommandOperation> commands)
edit
in interface ConfigEditablePlugin
latestConf
- latest version of configcommands
- the list of command operations to performprotected String generateAuthDataHeader()
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 nodeCopyright © 2000-2019 Apache Software Foundation. All Rights Reserved.