|
1 | 1 | package events |
2 | 2 |
|
3 | | -// IoTCustomAuthorizerRequest contains data coming in to a custom IoT device gateway authorizer function. |
4 | | -type IoTCustomAuthorizerRequest struct { |
5 | | - HTTPContext *IoTHTTPContext `json:"httpContext,omitempty"` |
6 | | - MQTTContext *IoTMQTTContext `json:"mqttContext,omitempty"` |
7 | | - TLSContext *IoTTLSContext `json:"tlsContext,omitempty"` |
8 | | - AuthorizationToken string `json:"token"` |
9 | | - TokenSignature string `json:"tokenSignature"` |
| 3 | +// IoTCoreCustomAuthorizerRequest represents the request to an IoT Core custom authorizer. |
| 4 | +// See https://docs.aws.amazon.com/iot/latest/developerguide/config-custom-auth.html |
| 5 | +type IoTCoreCustomAuthorizerRequest struct { |
| 6 | + Token string `json:"token"` |
| 7 | + SignatureVerified bool `json:"signatureVerified"` |
| 8 | + Protocols []string `json:"protocols"` |
| 9 | + ProtocolData *IoTCoreProtocolData `json:"protocolData,omitempty"` |
| 10 | + ConnectionMetadata *IoTCoreConnectionMetadata `json:"connectionMetadata,omitempty"` |
10 | 11 | } |
11 | 12 |
|
12 | | -type IoTHTTPContext struct { |
| 13 | +type IoTCoreProtocolData struct { |
| 14 | + TLS *IoTCoreTLSContext `json:"tls,omitempty"` |
| 15 | + HTTP *IoTCoreHTTPContext `json:"http,omitempty"` |
| 16 | + MQTT *IoTCoreMQTTContext `json:"mqtt,omitempty"` |
| 17 | +} |
| 18 | + |
| 19 | +type IoTCoreTLSContext struct { |
| 20 | + ServerName string `json:"serverName"` |
| 21 | +} |
| 22 | + |
| 23 | +type IoTCoreHTTPContext struct { |
13 | 24 | Headers map[string]string `json:"headers,omitempty"` |
14 | 25 | QueryString string `json:"queryString"` |
15 | 26 | } |
16 | 27 |
|
17 | | -type IoTMQTTContext struct { |
| 28 | +type IoTCoreMQTTContext struct { |
18 | 29 | ClientID string `json:"clientId"` |
19 | 30 | Password []byte `json:"password"` |
20 | 31 | Username string `json:"username"` |
21 | 32 | } |
22 | 33 |
|
23 | | -type IoTTLSContext struct { |
24 | | - ServerName string `json:"serverName"` |
| 34 | +type IoTCoreConnectionMetadata struct { |
| 35 | + ID string `json:"id"` |
25 | 36 | } |
26 | 37 |
|
27 | | -// IoTCustomAuthorizerResponse represents the expected format of an IoT device gateway authorization response. |
28 | | -type IoTCustomAuthorizerResponse struct { |
29 | | - IsAuthenticated bool `json:"isAuthenticated"` |
30 | | - PrincipalID string `json:"principalId"` |
31 | | - DisconnectAfterInSeconds int32 `json:"disconnectAfterInSeconds"` |
32 | | - RefreshAfterInSeconds int32 `json:"refreshAfterInSeconds"` |
33 | | - PolicyDocuments []string `json:"policyDocuments"` |
| 38 | +// IoTCoreCustomAuthorizerResponse represents the response from an IoT Core custom authorizer. |
| 39 | +// See https://docs.aws.amazon.com/iot/latest/developerguide/config-custom-auth.html |
| 40 | +type IoTCoreCustomAuthorizerResponse struct { |
| 41 | + IsAuthenticated bool `json:"isAuthenticated"` |
| 42 | + PrincipalID string `json:"principalId"` |
| 43 | + DisconnectAfterInSeconds uint32 `json:"disconnectAfterInSeconds"` |
| 44 | + RefreshAfterInSeconds uint32 `json:"refreshAfterInSeconds"` |
| 45 | + PolicyDocuments []*IAMPolicyDocument `json:"policyDocuments"` |
34 | 46 | } |
0 commit comments