AuthenticateJwtOptions Struct
Options for ListenerAction.authenticateJwt().
| Source | aws-elasticloadbalancingv2/lib/alb/application-listener-action.ts |
|---|---|
| Type last changed |
Example
ts
declare const lb: elbv2.ApplicationLoadBalancer;
declare const certificate: elbv2.IListenerCertificate;
declare const myTargetGroup: elbv2.ApplicationTargetGroup;
// JWT authentication requires HTTPS
const listener = lb.addListener('Listener', {
protocol: elbv2.ApplicationProtocol.HTTPS,
port: 443,
certificates: [certificate],
defaultAction: elbv2.ListenerAction.authenticateJwt({
issuer: 'https://issuer.example.com',
jwksEndpoint: 'https://issuer.example.com/.well-known/jwks.json',
next: elbv2.ListenerAction.forward([myTargetGroup]),
}),
});
python
# lb: elbv2.ApplicationLoadBalancer
# certificate: elbv2.IListenerCertificate
# my_target_group: elbv2.ApplicationTargetGroup
# JWT authentication requires HTTPS
listener = lb.add_listener("Listener",
protocol=elbv2.ApplicationProtocol.HTTPS,
port=443,
certificates=[certificate],
default_action=elbv2.ListenerAction.authenticate_jwt(
issuer="https://issuer.example.com",
jwks_endpoint="https://issuer.example.com/.well-known/jwks.json",
next=elbv2.ListenerAction.forward([my_target_group])
)
)
java
ApplicationLoadBalancer lb;
IListenerCertificate certificate;
ApplicationTargetGroup myTargetGroup;
// JWT authentication requires HTTPS
ApplicationListener listener = lb.addListener("Listener", BaseApplicationListenerProps.builder()
.protocol(ApplicationProtocol.HTTPS)
.port(443)
.certificates(List.of(certificate))
.defaultAction(ListenerAction.authenticateJwt(AuthenticateJwtOptions.builder()
.issuer("https://issuer.example.com")
.jwksEndpoint("https://issuer.example.com/.well-known/jwks.json")
.next(ListenerAction.forward(List.of(myTargetGroup)))
.build()))
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
ApplicationLoadBalancer lb;
IListenerCertificate certificate;
ApplicationTargetGroup myTargetGroup;
// JWT authentication requires HTTPS
var listener = lb.AddListener("Listener", new BaseApplicationListenerProps {
Protocol = ApplicationProtocol.HTTPS,
Port = 443,
Certificates = new [] { certificate },
DefaultAction = ListenerAction.AuthenticateJwt(new AuthenticateJwtOptions {
Issuer = "https://issuer.example.com",
JwksEndpoint = "https://issuer.example.com/.well-known/jwks.json",
Next = ListenerAction.Forward(new [] { myTargetGroup })
})
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var lb ApplicationLoadBalancer
var certificate IListenerCertificate
var myTargetGroup ApplicationTargetGroup
// JWT authentication requires HTTPS
listener := lb.AddListener(jsii.String("Listener"), &BaseApplicationListenerProps{
Protocol: elbv2.ApplicationProtocol_HTTPS,
Port: jsii.Number(443),
Certificates: []IListenerCertificate{
certificate,
},
DefaultAction: elbv2.ListenerAction_AuthenticateJwt(&AuthenticateJwtOptions{
Issuer: jsii.String("https://issuer.example.com"),
JwksEndpoint: jsii.String("https://issuer.example.com/.well-known/jwks.json"),
Next: elbv2.ListenerAction_Forward([]IApplicationTargetGroup{
myTargetGroup,
}),
}),
})
Properties
The issuer of the JWT token.
This must be a full URL, including the HTTPS protocol, the domain, and the path.
example
ts
'https://issuer.example.com'
jwksEndpointstringjwks_endpointstrjwksEndpointStringJwksEndpointstringJwksEndpoint*string required #The JWKS (JSON Web Key Set) endpoint URL.
The endpoint must be publicly accessible and return the public keys used to verify JWT signatures.
example
ts
'https://issuer.example.com/jwks'
nextListenerActionnextListenerActionnextListenerActionNextListenerActionNextListenerAction required #What action to execute next.
Multiple actions form a linked chain; the chain must always terminate in a (weighted)forward, fixedResponse or redirect action.