1 | import { Handler } from "../handler";
|
2 | import { PolicyDocument } from "./api-gateway-authorizer";
|
3 |
|
4 | export type IoTProtocolType = "http" | "mqtt" | "tls";
|
5 |
|
6 | export type IoTCustomAuthorizerHandler = Handler<IoTCustomAuthorizerEvent, IoTCustomAuthorizerResult>;
|
7 |
|
8 | export interface IoTProtocolDataTLS {
|
9 | serverName: string;
|
10 | }
|
11 |
|
12 | export interface IoTProtocolDataHTTP {
|
13 | headers: Record<string, string>;
|
14 | queryString: string;
|
15 | }
|
16 |
|
17 | export interface IoTProtocolDataMQTT {
|
18 | username?: string;
|
19 | password?: string;
|
20 | clientId: string;
|
21 | }
|
22 |
|
23 | export interface IoTCustomAuthorizerEvent {
|
24 | token?: string;
|
25 | signatureVerified: boolean;
|
26 | protocols: IoTProtocolType[];
|
27 | protocolData: {
|
28 | tls?: IoTProtocolDataTLS;
|
29 | http?: IoTProtocolDataHTTP;
|
30 | mqtt?: IoTProtocolDataMQTT;
|
31 | };
|
32 | connectionMetadata: {
|
33 | id: string;
|
34 | };
|
35 | }
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | export interface IoTCustomAuthorizerResult {
|
43 | isAuthenticated: boolean;
|
44 | principalId: string;
|
45 | disconnectAfterInSeconds: number;
|
46 | refreshAfterInSeconds: number;
|
47 | policyDocuments: PolicyDocument[];
|
48 | }
|