/
HttpJwtAuthorizer.go
92 lines (78 loc) · 2.59 KB
/
HttpJwtAuthorizer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package awsapigatewayv2authorizers
import (
_init_ "github.com/aws/aws-cdk-go/awscdk/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
"github.com/aws/aws-cdk-go/awscdk/awsapigatewayv2"
"github.com/aws/aws-cdk-go/awscdk/awsapigatewayv2authorizers/internal"
)
// Authorize Http Api routes on whether the requester is registered as part of an AWS Cognito user pool.
//
// Example:
// import "github.com/aws/aws-cdk-go/awscdk"
// import "github.com/aws/aws-cdk-go/awscdk"
//
//
// issuer := "https://test.us.auth0.com"
// authorizer := awscdk.NewHttpJwtAuthorizer(jsii.String("BooksAuthorizer"), issuer, &HttpJwtAuthorizerProps{
// JwtAudience: []*string{
// jsii.String("3131231"),
// },
// })
//
// api := apigwv2.NewHttpApi(this, jsii.String("HttpApi"))
//
// api.AddRoutes(&AddRoutesOptions{
// Integration: awscdk.NewHttpUrlIntegration(jsii.String("BooksIntegration"), jsii.String("https://get-books-proxy.myproxy.internal")),
// Path: jsii.String("/books"),
// Authorizer: Authorizer,
// })
//
// Experimental.
type HttpJwtAuthorizer interface {
awsapigatewayv2.IHttpRouteAuthorizer
// Bind this authorizer to a specified Http route.
// Experimental.
Bind(options *awsapigatewayv2.HttpRouteAuthorizerBindOptions) *awsapigatewayv2.HttpRouteAuthorizerConfig
}
// The jsii proxy struct for HttpJwtAuthorizer
type jsiiProxy_HttpJwtAuthorizer struct {
internal.Type__awsapigatewayv2IHttpRouteAuthorizer
}
// Initialize a JWT authorizer to be bound with HTTP route.
// Experimental.
func NewHttpJwtAuthorizer(id *string, jwtIssuer *string, props *HttpJwtAuthorizerProps) HttpJwtAuthorizer {
_init_.Initialize()
if err := validateNewHttpJwtAuthorizerParameters(id, jwtIssuer, props); err != nil {
panic(err)
}
j := jsiiProxy_HttpJwtAuthorizer{}
_jsii_.Create(
"monocdk.aws_apigatewayv2_authorizers.HttpJwtAuthorizer",
[]interface{}{id, jwtIssuer, props},
&j,
)
return &j
}
// Initialize a JWT authorizer to be bound with HTTP route.
// Experimental.
func NewHttpJwtAuthorizer_Override(h HttpJwtAuthorizer, id *string, jwtIssuer *string, props *HttpJwtAuthorizerProps) {
_init_.Initialize()
_jsii_.Create(
"monocdk.aws_apigatewayv2_authorizers.HttpJwtAuthorizer",
[]interface{}{id, jwtIssuer, props},
h,
)
}
func (h *jsiiProxy_HttpJwtAuthorizer) Bind(options *awsapigatewayv2.HttpRouteAuthorizerBindOptions) *awsapigatewayv2.HttpRouteAuthorizerConfig {
if err := h.validateBindParameters(options); err != nil {
panic(err)
}
var returns *awsapigatewayv2.HttpRouteAuthorizerConfig
_jsii_.Invoke(
h,
"bind",
[]interface{}{options},
&returns,
)
return returns
}