File size: 3,285 Bytes
c3edc81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{
    "states": [
      "Disconnected",
      "Waiting for Token",
      "Token Requested",
      "Token Received",
      "Awaiting CONNACK",
      "Authenticating",
      "Token Validating",
      "Connected",
      "Session Resumed",
      "Unauthorized",
      "Reauthenticating",
      "Session Terminated"
    ],
    "initial_state": "Disconnected",
    "final_states": ["Session Terminated"],
    "transitions": [
      {
        "from": "Disconnected",
        "to": "Waiting for Token",
        "event": "Client initiates connection",
        "action": "Start TLS handshake"
      },
      {
        "from": "Waiting for Token",
        "to": "Token Requested",
        "event": "Request token from AS",
        "action": "Send token request (HTTPS/PSK/RPK)"
      },
      {
        "from": "Token Requested",
        "to": "Token Received",
        "event": "Token received from AS",
        "action": "Store JWT/CWT token"
      },
      {
        "from": "Token Requested",
        "to": "Disconnected",  
        "event": "Token request timeout/error",
        "action": "Retry or terminate"
      },
      {
        "from": "Token Received",
        "to": "Authenticating",
        "event": "Send CONNECT/AUTH packet",
        "action": "Include token in 'authz-info' topic"
      },
      {
        "from": "Authenticating",
        "to": "Awaiting CONNACK",  
        "event": "Token uploaded",
        "action": "Wait for broker response"
      },
      {
        "from": "Awaiting CONNACK",
        "to": "Token Validating",
        "event": "Broker processes token",
        "action": "Validate token (introspection)"
      },
      {
        "from": "Token Validating",
        "to": "Connected",
        "event": "Token valid",
        "action": "Send CONNACK(Success)"
      },
      {
        "from": "Token Validating",
        "to": "Unauthorized",
        "event": "Token invalid/expired",
        "action": "Send CONNACK(Not Authorized)"
      },
      {
        "from": "Connected",
        "to": "Session Resumed",
        "event": "CONNECT(CleanSession=0)",
        "action": "Resume prior session"
      },
      {
        "from": "Session Resumed",
        "to": "Connected",
        "event": "Session validated",
        "action": "Send CONNACK(Session Present=1)"
      },
      {
        "from": "Session Resumed",
        "to": "Session Terminated",
        "event": "Session invalid",
        "action": "Send DISCONNECT"
      },
      {
        "from": "Connected",
        "to": "Reauthenticating",
        "event": "Token expired",
        "action": "Send AUTH packet"
      },
      {
        "from": "Reauthenticating",
        "to": "Token Validating",
        "event": "Broker validates new token",
        "action": "Process AUTH/CONNACK"
      },
      {
        "from": "Reauthenticating",
        "to": "Unauthorized",
        "event": "Reauthentication failed",
        "action": "Send DISCONNECT"
      },
      {
        "from": "Connected",
        "to": "Session Terminated",
        "event": "DISCONNECT received/sent",
        "action": "Cleanup session"
      },
      {
        "from": "Unauthorized",
        "to": "Session Terminated",
        "event": "DISCONNECT sent",
        "action": "Close connection"
      }
    ]
  }