@@ -2,11 +2,17 @@ package events
2
2
3
3
// IoTCustomAuthorizerRequest contains data coming in to a custom IoT device gateway authorizer function.
4
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"`
5
+ Token string `json:"token"`
6
+ SignatureVerified bool `json:"signatureVerified"` //whether the device gateway has validated the signature
7
+ Protocols []string `json:"protocols"` //can include "tls", "mqtt", or "http"
8
+ ProtocolData IoTCustomAuthorizerProtocolData `json:"protocolData"`
9
+ ConnectionMetadata IoTCustomAuthorizerMetadata `json:"connectionMetadata"`
10
+ }
11
+
12
+ type IoTCustomAuthorizerProtocolData struct {
13
+ HTTP * IoTHTTPContext `json:"http,omitempty"`
14
+ MQTT * IoTMQTTContext `json:"mqtt,omitempty"`
15
+ TLS * IoTTLSContext `json:"tls,omitempty"`
10
16
}
11
17
12
18
type IoTHTTPContext struct {
@@ -16,19 +22,23 @@ type IoTHTTPContext struct {
16
22
17
23
type IoTMQTTContext struct {
18
24
ClientID string `json:"clientId"`
19
- Password [] byte `json:"password"`
25
+ Password string `json:"password"` //base64-encoded string
20
26
Username string `json:"username"`
21
27
}
22
28
23
29
type IoTTLSContext struct {
24
30
ServerName string `json:"serverName"`
25
31
}
26
32
33
+ type IoTCustomAuthorizerMetadata struct {
34
+ ID string `json:"id"` //UUID. The connection ID
35
+ }
36
+
27
37
// IoTCustomAuthorizerResponse represents the expected format of an IoT device gateway authorization response.
28
38
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"`
39
+ IsAuthenticated bool `json:"isAuthenticated"`
40
+ PrincipalID string `json:"principalId"`
41
+ DisconnectAfterInSeconds int32 `json:"disconnectAfterInSeconds"`
42
+ RefreshAfterInSeconds int32 `json:"refreshAfterInSeconds"`
43
+ PolicyDocuments []APIGatewayCustomAuthorizerPolicy `json:"policyDocuments"`
34
44
}
0 commit comments