-
Notifications
You must be signed in to change notification settings - Fork 558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added struct definition to include ClientCert information to API Gateway when using mTLS #342
Changes from 5 commits
1d83b07
283152d
411a5fc
0e98aee
734e78c
c6725b7
e31c9a1
92a9843
19fe79d
ec6fee3
87559da
45be04b
e2f0235
36dc632
3329129
1c35d15
bc8a460
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,17 +65,18 @@ type APIGatewayV2HTTPRequest struct { | |
|
||
// APIGatewayV2HTTPRequestContext contains the information to identify the AWS account and resources invoking the Lambda function. | ||
type APIGatewayV2HTTPRequestContext struct { | ||
RouteKey string `json:"routeKey"` | ||
AccountID string `json:"accountId"` | ||
Stage string `json:"stage"` | ||
RequestID string `json:"requestId"` | ||
Authorizer *APIGatewayV2HTTPRequestContextAuthorizerDescription `json:"authorizer,omitempty"` | ||
APIID string `json:"apiId"` // The API Gateway HTTP API Id | ||
DomainName string `json:"domainName"` | ||
DomainPrefix string `json:"domainPrefix"` | ||
Time string `json:"time"` | ||
TimeEpoch int64 `json:"timeEpoch"` | ||
HTTP APIGatewayV2HTTPRequestContextHTTPDescription `json:"http"` | ||
RouteKey string `json:"routeKey"` | ||
AccountID string `json:"accountId"` | ||
Stage string `json:"stage"` | ||
RequestID string `json:"requestId"` | ||
Authorizer *APIGatewayV2HTTPRequestContextAuthorizerDescription `json:"authorizer,omitempty"` | ||
APIID string `json:"apiId"` // The API Gateway HTTP API Id | ||
DomainName string `json:"domainName"` | ||
DomainPrefix string `json:"domainPrefix"` | ||
Time string `json:"time"` | ||
TimeEpoch int64 `json:"timeEpoch"` | ||
HTTP APIGatewayV2HTTPRequestContextHTTPDescription `json:"http"` | ||
Authentication APIGatewayV2HTTPRequestContextAuthentication `json:"authentication"` | ||
} | ||
|
||
// APIGatewayV2HTTPRequestContextAuthorizerDescription contains authorizer information for the request context. | ||
|
@@ -189,10 +190,46 @@ type APIGatewayWebsocketProxyRequestContext struct { | |
Status string `json:"status"` | ||
} | ||
|
||
// APIGatewayCustomAuthorizerRequestTypeRequestIdentity contains identity information for the request caller. | ||
// APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidity contains certificate validity information for the request caller if using mTLS.. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I usually prefer for definitions to read top to bottom in the order they are used. In this case that would mean that each of your new types would only come after they were first used. Could we make that update here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed the order of definitions to match project conventions. |
||
type APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidity struct { | ||
NotAfter string `json:"notAfter"` | ||
NotBefore string `json:"notBefore"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like these are timestamps. I'm not entirely sure what we do elsewhere in this package but maybe these could be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was unable to find a way to convert the time format of the validity dates in the JSON unmarshalling not of the Tag hints I could find seam to work. I don't think writing a custom unmarshalling routine would be appropriate but am open to suggestion. |
||
} | ||
|
||
// APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert contains certificate information for the request caller if using mTLS.. | ||
type APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert struct { | ||
ClientCertPem string `json:"clientCertPem"` | ||
IssuerDN string `json:"issuerDN"` | ||
SerialNumber string `json:"serialNumber"` | ||
SubjectDN string `json:"subjectDN"` | ||
Validity APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidity `json:"validity"` | ||
} | ||
|
||
// APIGatewayV2HTTPRequestContextAuthenticationClientCertValidity contains client certificate validity information for the request caller if using mTLS.. | ||
type APIGatewayV2HTTPRequestContextAuthenticationClientCertValidity struct { | ||
NotAfter string `json:"notAfter"` | ||
NotBefore string `json:"notBefore"` | ||
} | ||
|
||
// APIGatewayV2HTTPRequestContextAuthenticationClientCert contains client certificate information for the request caller if using mTLS.. | ||
type APIGatewayV2HTTPRequestContextAuthenticationClientCert struct { | ||
ClientCertPem string `json:"clientCertPem"` | ||
IssuerDN string `json:"issuerDN"` | ||
SerialNumber string `json:"serialNumber"` | ||
SubjectDN string `json:"subjectDN"` | ||
Validity APIGatewayV2HTTPRequestContextAuthenticationClientCertValidity `json:"validity"` | ||
} | ||
|
||
// APIGatewayV2HTTPRequestContextAuthentication contains authentication context information for the request caller including client certificate information if using mTLS.. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit pick: here and elsewhere there is an unnecessary extra There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed the extra . |
||
type APIGatewayV2HTTPRequestContextAuthentication struct { | ||
ClientCert APIGatewayV2HTTPRequestContextAuthenticationClientCert `json:"clientCert"` | ||
} | ||
|
||
// APIGatewayCustomAuthorizerRequestTypeRequestIdentity contains identity information for the request caller including certificate information if using mTLS. | ||
type APIGatewayCustomAuthorizerRequestTypeRequestIdentity struct { | ||
APIKey string `json:"apiKey"` | ||
SourceIP string `json:"sourceIp"` | ||
APIKey string `json:"apiKey"` | ||
SourceIP string `json:"sourceIp"` | ||
ClientCert APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert `json:"clientCert"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This field is optional right? Or is it always supplied now by API GW? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Supplied by API GW when mTLS is configured, otherwise it will be ignored since we are just unmarshalling. |
||
} | ||
|
||
// APIGatewayCustomAuthorizerContext represents the expected format of an API Gateway custom authorizer response. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This field is optional right? Or is it always supplied now by API GW?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supplied by API GW when mTLS is configured, otherwise it will be ignored since we are just unmarshalling.