public static final class JwtProvider.Builder extends Object implements Builder<JwtProvider>
JwtProvider.| Modifier and Type | Method and Description |
|---|---|
JwtProvider.Builder |
allowImpersonation(boolean allowImpersonation)
Whether to allow impersonation by explicitly overriding
username from outbound requests using
JwtProvider.EP_PROPERTY_OUTBOUND_USER property. |
JwtProvider.Builder |
allowUnsigned(boolean allowUnsigned)
Configure support for unsigned JWT.
|
JwtProvider.Builder |
atnTokenHandler(TokenHandler tokenHandler)
Token handler to extract username from request.
|
JwtProvider.Builder |
authenticate(boolean authenticate)
Whether to authenticate requests.
|
JwtProvider |
build()
Build the instance from this builder.
|
JwtProvider.Builder |
config(Config config)
Load this builder from a configuration.
|
void |
expectedAudience(String audience)
Audience expected in inbound JWTs.
|
JwtProvider.Builder |
issuer(String issuer)
Issuer used to create new JWTs.
|
JwtProvider.Builder |
optional(boolean optional)
Whether authentication is required.
|
JwtProvider.Builder |
outboundConfig(OutboundConfig config)
Configuration of outbound rules.
|
JwtProvider.Builder |
propagate(boolean propagate)
Whether to propagate identity.
|
JwtProvider.Builder |
signJwk(Resource signJwkResource)
JWK resource used to sign JWTs created by us.
|
JwtProvider.Builder |
subjectType(SubjectType subjectType)
Principal type this provider extracts (and also propagates).
|
JwtProvider.Builder |
verifyJwk(Resource verifyJwkResource)
JWK resource used to verify JWTs created by other parties.
|
JwtProvider.Builder |
verifySignature(boolean shouldValidate)
Configure whether to verify signatures.
|
public JwtProvider build()
Builderbuild in interface Builder<JwtProvider>public JwtProvider.Builder propagate(boolean propagate)
propagate - whether to propagate identity (true) or not (false)public JwtProvider.Builder authenticate(boolean authenticate)
authenticate - whether to authenticate (true) or not (false)public JwtProvider.Builder allowImpersonation(boolean allowImpersonation)
JwtProvider.EP_PROPERTY_OUTBOUND_USER property.
By default this is not allowed and identity can only be propagated.allowImpersonation - set to true to allow impersonationpublic JwtProvider.Builder allowUnsigned(boolean allowUnsigned)
true any JWT that has algorithm
set to none and no kid defined will be accepted.
Note that this has serious security impact - if JWT can be sent
from a third party, this allows the third party to send ANY JWT
and it would be accpted as valid.allowUnsigned - to allow unsigned (insecure) JWTpublic JwtProvider.Builder verifySignature(boolean shouldValidate)
Make sure your service is properly secured on network level and only accessible from a secure endpoint that provides the JWTs when signature verification is disabled. If signature verification is disabled, this service will accept ANY JWT
shouldValidate - set to false to disable validation of JWT signaturespublic JwtProvider.Builder subjectType(SubjectType subjectType)
subjectType - type of principalpublic JwtProvider.Builder atnTokenHandler(TokenHandler tokenHandler)
tokenHandler - token handler instancepublic JwtProvider.Builder optional(boolean optional)
optional - whether authentication is optional (true) or required (false)public JwtProvider.Builder outboundConfig(OutboundConfig config)
config - outbound configuration, each target may contain custom object JwtProvider.JwtOutboundTarget
to add our configuration.public JwtProvider.Builder signJwk(Resource signJwkResource)
signJwkResource - resource pointing to a JSON with keyspublic JwtProvider.Builder verifyJwk(Resource verifyJwkResource)
verifyJwkResource - resource pointing to a JSON with keyspublic JwtProvider.Builder issuer(String issuer)
issuer - issuer to add to the issuer claimpublic JwtProvider.Builder config(Config config)
config - configuration to load frompublic void expectedAudience(String audience)
audience - audience stringCopyright © 2018–2019 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms.