Class JwtProvider
- java.lang.Object
-
- io.helidon.security.spi.SynchronousProvider
-
- io.helidon.security.providers.jwt.JwtProvider
-
- All Implemented Interfaces:
AuthenticationProvider,OutboundSecurityProvider,SecurityProvider
public final class JwtProvider extends SynchronousProvider implements AuthenticationProvider, OutboundSecurityProvider
Provider that can process JWT tokens in request headers and assert identity (e.g. create aPrincipalfor aSubjectType.USERorSubjectType.SERVICE. This provider can also propagate identity using JWT token, either by creating a new JWT or by propagating the existing token "as is". Verification and signatures of tokens is done through JWK standard - two separate JWK files are expected (one for verification, one for signatures).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJwtProvider.BuilderFluent API builder forJwtProvider.static classJwtProvider.JwtOutboundTargetA custom object to configure specific handling of outbound calls.
-
Field Summary
Fields Modifier and Type Field Description static StringEP_PROPERTY_OUTBOUND_USERConfigure this for outbound requests to override user to use.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JwtProvider.Builderbuilder()A builder for this provider.static JwtProvidercreate(Config config)Create provider instance from configuration.booleanisOutboundSupported(ProviderRequest providerRequest, SecurityEnvironment outboundEnv, EndpointConfig outboundConfig)Check if the path to be executed is supported by this security provider.protected AuthenticationResponsesyncAuthenticate(ProviderRequest providerRequest)Synchronous authentication.protected OutboundSecurityResponsesyncOutbound(ProviderRequest providerRequest, SecurityEnvironment outboundEnv, EndpointConfig outboundEndpointConfig)Synchronous outbound security.-
Methods inherited from class io.helidon.security.spi.SynchronousProvider
authenticate, authorize, outboundSecurity, syncAuthorize
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.helidon.security.spi.AuthenticationProvider
authenticate
-
Methods inherited from interface io.helidon.security.spi.OutboundSecurityProvider
outboundSecurity
-
Methods inherited from interface io.helidon.security.spi.SecurityProvider
supportedAnnotations, supportedAttributes, supportedConfigKeys, supportedCustomObjects
-
-
-
-
Field Detail
-
EP_PROPERTY_OUTBOUND_USER
public static final String EP_PROPERTY_OUTBOUND_USER
Configure this for outbound requests to override user to use.- See Also:
- Constant Field Values
-
-
Method Detail
-
builder
public static JwtProvider.Builder builder()
A builder for this provider.- Returns:
- builder to create a new instance
-
create
public static JwtProvider create(Config config)
Create provider instance from configuration.- Parameters:
config- configuration of this provider- Returns:
- provider instance
-
syncAuthenticate
protected AuthenticationResponse syncAuthenticate(ProviderRequest providerRequest)
Description copied from class:SynchronousProviderSynchronous authentication.- Overrides:
syncAuthenticatein classSynchronousProvider- Parameters:
providerRequest- context with environment, subject(s) etc.- Returns:
- authentication response
- See Also:
AuthenticationProvider.authenticate(ProviderRequest)
-
isOutboundSupported
public boolean isOutboundSupported(ProviderRequest providerRequest, SecurityEnvironment outboundEnv, EndpointConfig outboundConfig)
Description copied from interface:OutboundSecurityProviderCheck if the path to be executed is supported by this security provider. Defaults to true.- Specified by:
isOutboundSupportedin interfaceOutboundSecurityProvider- Parameters:
providerRequest- context with environment, subject(s) etc. that was receivedoutboundEnv- environment for outbound calloutboundConfig- outbound endpoint configuration- Returns:
- true if this identity propagator can generate required headers for the path defined
-
syncOutbound
protected OutboundSecurityResponse syncOutbound(ProviderRequest providerRequest, SecurityEnvironment outboundEnv, EndpointConfig outboundEndpointConfig)
Description copied from class:SynchronousProviderSynchronous outbound security.- Overrides:
syncOutboundin classSynchronousProvider- Parameters:
providerRequest- context with environment, subject(s) etc.outboundEnv- environment of this outbound calloutboundEndpointConfig- endpoint config for outbound call- Returns:
- outbound response
- See Also:
OutboundSecurityProvider.outboundSecurity(ProviderRequest, SecurityEnvironment, EndpointConfig),OutboundSecurityProvider.isOutboundSupported(ProviderRequest, SecurityEnvironment, EndpointConfig)
-
-