@burgan-tech/morph-idm-runtime 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/burgan-tech-morph-idm-runtime-0.0.3.tgz +0 -0
  2. package/morph-idm/Schemas/client/client-update-1.0.0.json +263 -0
  3. package/morph-idm/Schemas/{user → person}/person-master-1.0.0.json +1 -1
  4. package/morph-idm/Schemas/token/token-start-1.0.0.json +6 -19
  5. package/morph-idm/Schemas/user/user-master-1.0.0.json +46 -1
  6. package/morph-idm/Schemas/user-login/retry-login-1.0.0.json +39 -0
  7. package/morph-idm/Tasks/call-device-start-1.0.0.json +1 -1
  8. package/morph-idm/Tasks/call-device-update-1.0.0.json +1 -1
  9. package/morph-idm/Tasks/consent/consent-auto-select-script.json +16 -0
  10. package/morph-idm/Tasks/{user/send-push-task.json → device/search-device-task.json} +5 -5
  11. package/morph-idm/Tasks/get-device-1.0.0.json +1 -1
  12. package/morph-idm/Tasks/person/get-person-by-task.json +19 -0
  13. package/morph-idm/Tasks/person/person-update-direct-transition.json +23 -0
  14. package/morph-idm/Tasks/token/token-create-jwt.json +0 -1
  15. package/morph-idm/Tasks/token/token-redeem-trigger.json +22 -0
  16. package/morph-idm/Tasks/token/user-login-get-as-filterable.json +22 -0
  17. package/morph-idm/Tasks/user/evaluate-failed-login-script.json +18 -0
  18. package/morph-idm/Tasks/user/get-phone-from-person-task.json +20 -0
  19. package/morph-idm/Tasks/user/otp-code-generator.json +15 -0
  20. package/morph-idm/Tasks/user/send-otp-sms-task.json +26 -0
  21. package/morph-idm/Tasks/user/user-update-password-fail-count.json +24 -0
  22. package/morph-idm/Tasks/user-login/auth-code-generator.json +17 -0
  23. package/morph-idm/Tasks/user-login/increment-local-fail-count.json +17 -0
  24. package/morph-idm/Tasks/user-login/password-verify.json +26 -0
  25. package/morph-idm/Tasks/user-login/push-send-task.json +25 -0
  26. package/morph-idm/TestCases/test-123/.httpyac.json +15 -0
  27. package/morph-idm/TestCases/test-123/01-person.http +95 -0
  28. package/morph-idm/TestCases/test-123/02-user.http +83 -0
  29. package/morph-idm/TestCases/test-123/03-scope.http +65 -0
  30. package/morph-idm/TestCases/test-123/04-consent.http +66 -0
  31. package/morph-idm/TestCases/test-123/05-device.http +86 -0
  32. package/morph-idm/TestCases/test-123/06-user-login.http +206 -0
  33. package/morph-idm/TestCases/test-123/README.md +112 -0
  34. package/morph-idm/TestCases/test-123/cleanup.js +49 -0
  35. package/morph-idm/TestCases/test-123/cleanup.sh +20 -0
  36. package/morph-idm/TestCases/test-123/cleanup.sql +45 -0
  37. package/morph-idm/TestCases/test-123/http-client.env.json +13 -0
  38. package/morph-idm/TestCases/test-123/run-setup.sh +42 -0
  39. package/morph-idm/TestCases/test-auto-consent/.httpyac.json +14 -0
  40. package/morph-idm/TestCases/test-auto-consent/01-person.http +72 -0
  41. package/morph-idm/TestCases/test-auto-consent/02-user.http +74 -0
  42. package/morph-idm/TestCases/test-auto-consent/03-scope.http +66 -0
  43. package/morph-idm/TestCases/test-auto-consent/04-device.http +56 -0
  44. package/morph-idm/TestCases/test-auto-consent/05-user-login.http +132 -0
  45. package/morph-idm/TestCases/test-auto-consent/README.md +36 -0
  46. package/morph-idm/TestCases/test-auto-consent/cleanup.js +47 -0
  47. package/morph-idm/TestCases/test-auto-consent/run-setup.sh +50 -0
  48. package/morph-idm/TestCases/test-multiple-consent/.httpyac.json +17 -0
  49. package/morph-idm/TestCases/test-multiple-consent/01-person.http +103 -0
  50. package/morph-idm/TestCases/test-multiple-consent/02-user.http +83 -0
  51. package/morph-idm/TestCases/test-multiple-consent/03-scope-2.http +66 -0
  52. package/morph-idm/TestCases/test-multiple-consent/03-scope.http +66 -0
  53. package/morph-idm/TestCases/test-multiple-consent/04-consent-1.http +67 -0
  54. package/morph-idm/TestCases/test-multiple-consent/04-consent-2.http +66 -0
  55. package/morph-idm/TestCases/test-multiple-consent/05-device.http +87 -0
  56. package/morph-idm/TestCases/test-multiple-consent/06-user-login.http +183 -0
  57. package/morph-idm/TestCases/test-multiple-consent/README.md +37 -0
  58. package/morph-idm/TestCases/test-multiple-consent/cleanup.js +46 -0
  59. package/morph-idm/TestCases/test-multiple-consent/cleanup.sh +20 -0
  60. package/morph-idm/TestCases/test-multiple-consent/run-setup.sh +53 -0
  61. package/morph-idm/Views/user-login/push-waiting.json +28 -0
  62. package/morph-idm/Views/user-login/start.json +28 -0
  63. package/morph-idm/Workflows/client/client-1.0.0.json +8 -3
  64. package/morph-idm/Workflows/client/execute/client-update.http +763 -0
  65. package/morph-idm/Workflows/client/execute/client.http +13 -5
  66. package/morph-idm/Workflows/client/src/CreateRsaByHttpCallMapping.csx +10 -14
  67. package/morph-idm/Workflows/client/src/PasswordGeneratorMapping.csx +0 -1
  68. package/morph-idm/Workflows/consent-selection/consent-selection-1.0.0.json +37 -6
  69. package/morph-idm/Workflows/consent-selection/execute/multi-consent-selection.http +209 -0
  70. package/morph-idm/Workflows/consent-selection/src/ConsentSelectedMapping.csx +18 -22
  71. package/morph-idm/Workflows/consent-selection/src/CreateAutoConsentMapping.csx +45 -45
  72. package/morph-idm/Workflows/consent-selection/src/MultipleConsentsRule.csx +12 -8
  73. package/morph-idm/Workflows/consent-selection/src/NoConsentEligibleRule.csx +6 -22
  74. package/morph-idm/Workflows/consent-selection/src/SingleConsentAutoSelectMapping.csx +63 -0
  75. package/morph-idm/Workflows/consent-selection/src/SingleConsentRule.csx +11 -22
  76. package/morph-idm/Workflows/device/execute/device-ios.http +0 -6
  77. package/morph-idm/Workflows/device/execute/search.http +32 -0
  78. package/morph-idm/Workflows/person/execute/person-123.http +191 -0
  79. package/morph-idm/Workflows/person/execute/person.http +196 -0
  80. package/morph-idm/Workflows/{user → person}/person-1.0.0.json +24 -1
  81. package/morph-idm/Workflows/token/execute/token.http +14 -3
  82. package/morph-idm/Workflows/token/password-subflow.json +1 -1
  83. package/morph-idm/Workflows/token/src/AuthCodeRedeemMapping.csx +114 -0
  84. package/morph-idm/Workflows/token/src/AuthCodeValidationRule.csx +27 -0
  85. package/morph-idm/Workflows/token/src/CreateRsaJwtMapping.csx +28 -16
  86. package/morph-idm/Workflows/token/src/StatusSuccessRule.csx +27 -0
  87. package/morph-idm/Workflows/token/src/TokenCreatedRule.csx +32 -0
  88. package/morph-idm/Workflows/token/src/UserLoginGetAsFilterableMapping.csx +204 -0
  89. package/morph-idm/Workflows/token/token-1.0.0.json +109 -41
  90. package/morph-idm/Workflows/user/execute/create-user-1234567890.http +16 -4
  91. package/morph-idm/Workflows/user/execute/create-user-migration.http +179 -0
  92. package/morph-idm/Workflows/user/execute/create-user-person-password.http +78 -32
  93. package/morph-idm/Workflows/user/src/EvaluateFailedLoginMapping.csx +75 -0
  94. package/morph-idm/Workflows/user/src/FailCountMaxRule.csx +33 -0
  95. package/morph-idm/Workflows/user/src/GetPhoneFromPersonMapping.csx +139 -0
  96. package/morph-idm/Workflows/user/src/HasPasswordsRule.csx +43 -0
  97. package/morph-idm/Workflows/user/src/OtpSentSuccessRule.csx +46 -0
  98. package/morph-idm/Workflows/user/src/PasswordGeneratedSuccessRule.csx +73 -0
  99. package/morph-idm/Workflows/user/src/PhoneFetchedSuccessRule.csx +35 -0
  100. package/morph-idm/Workflows/user/src/ResetPasswordFailCountMapping.csx +88 -0
  101. package/morph-idm/Workflows/user/src/SendOtpSmsMapping.csx +357 -0
  102. package/morph-idm/Workflows/user/src/UserPasswordGeneratorMapping.csx +33 -6
  103. package/morph-idm/Workflows/user/user-1.0.0.json +365 -5
  104. package/morph-idm/Workflows/{user → user-login}/execute/user-login.http +155 -32
  105. package/morph-idm/Workflows/user-login/src/AuthCodeGeneratorMapping.csx +44 -0
  106. package/morph-idm/Workflows/{user/src/GetClientMapping.csx → user-login/src/ClientGetMapping.csx} +6 -4
  107. package/morph-idm/Workflows/{user/src/TriggerConsentSelectionAsSubFlowMapping.csx → user-login/src/ConsentSelectionSubFlowMapping.csx} +19 -20
  108. package/morph-idm/Workflows/user-login/src/DeviceSearchMapping.csx +128 -0
  109. package/morph-idm/Workflows/{user → user-login}/src/GrantValidationRule.csx +5 -1
  110. package/morph-idm/Workflows/user-login/src/HasFailCountRule.csx +32 -0
  111. package/morph-idm/Workflows/user-login/src/MaxRetriesReachedRule.csx +32 -0
  112. package/morph-idm/Workflows/user-login/src/NoSecurityImageRule.csx +33 -0
  113. package/morph-idm/Workflows/user-login/src/NoSecurityQuestionRule.csx +65 -0
  114. package/morph-idm/Workflows/user-login/src/OtpCodeGenerateMapping.csx +37 -0
  115. package/morph-idm/Workflows/{user/src/SendOtpMapping.csx → user-login/src/OtpSendMapping.csx} +13 -7
  116. package/morph-idm/Workflows/user-login/src/OtpVerifiedRule.csx +35 -0
  117. package/morph-idm/Workflows/user-login/src/PasswordFailCountResetMapping.csx +77 -0
  118. package/morph-idm/Workflows/user-login/src/PasswordFailCountUpdateMapping.csx +80 -0
  119. package/morph-idm/Workflows/user-login/src/PasswordVerifyMapping.csx +172 -0
  120. package/morph-idm/Workflows/user-login/src/PersonFetchedRule.csx +32 -0
  121. package/morph-idm/Workflows/user-login/src/PersonGetMapping.csx +61 -0
  122. package/morph-idm/Workflows/user-login/src/PersonUpdateMapping.csx +105 -0
  123. package/morph-idm/Workflows/user-login/src/PersonUpdatedRule.csx +32 -0
  124. package/morph-idm/Workflows/{user/src/SendPushMapping.csx → user-login/src/PushSendMapping.csx} +22 -11
  125. package/morph-idm/Workflows/user-login/src/PushVerifiedRule.csx +31 -0
  126. package/morph-idm/Workflows/{user/src/GetScopesByUserMapping.csx → user-login/src/ScopesByUserGetMapping.csx} +24 -22
  127. package/morph-idm/Workflows/user-login/src/TokenGenerationSuccessRule.csx +33 -0
  128. package/morph-idm/Workflows/{user/src/TriggerTokenWorkflowAsSubFlowMapping.csx → user-login/src/TokenSubFlowMapping.csx} +7 -13
  129. package/morph-idm/Workflows/user-login/src/UserFoundRule.csx +19 -0
  130. package/morph-idm/Workflows/{user/src/GetUserMapping.csx → user-login/src/UserGetMapping.csx} +5 -3
  131. package/morph-idm/Workflows/user-login/src/UserStatusActiveRule.csx +34 -0
  132. package/morph-idm/Workflows/user-login/src/UserValidHasFailCountRule.csx +39 -0
  133. package/morph-idm/Workflows/user-login/src/UserValidNoFailCountRule.csx +39 -0
  134. package/morph-idm/Workflows/user-login/user-login.1.0.0.json +1828 -0
  135. package/package.json +1 -1
  136. package/vnext.config.json +3 -3
  137. package/burgan-tech-morph-idm-runtime-0.0.1.tgz +0 -0
  138. package/morph-idm/Schemas/client/client-update-master-1.0.0.json +0 -201
  139. package/morph-idm/Workflows/client/client-update-1.0.0.json +0 -202
  140. package/morph-idm/Workflows/client-manager/client-manager-1.0.0.json +0 -217
  141. package/morph-idm/Workflows/client-manager/execute/client-manager.http +0 -214
  142. package/morph-idm/Workflows/client-manager/src/ClientCreatedRule.csx +0 -28
  143. package/morph-idm/Workflows/client-manager/src/ClientExistsRule.csx +0 -25
  144. package/morph-idm/Workflows/client-manager/src/CreateClientSubFlowMapping.csx +0 -63
  145. package/morph-idm/Workflows/client-manager/src/GetClientForManagerMapping.csx +0 -59
  146. package/morph-idm/Workflows/user/src/ApproveRule.csx +0 -16
  147. package/morph-idm/Workflows/user/src/AutoConsentCreatedRule.csx +0 -20
  148. package/morph-idm/Workflows/user/src/AutoConsentRequiredRule.csx +0 -77
  149. package/morph-idm/Workflows/user/src/CheckDeviceByUserReferenceMapping.csx +0 -66
  150. package/morph-idm/Workflows/user/src/ClientValidationFailRule.csx +0 -28
  151. package/morph-idm/Workflows/user/src/ConsentValidationRule.csx +0 -36
  152. package/morph-idm/Workflows/user/src/CreateAutoConsentMapping.csx +0 -171
  153. package/morph-idm/Workflows/user/src/DeviceFoundForLoginRule.csx +0 -32
  154. package/morph-idm/Workflows/user/src/DeviceNotFoundForLoginRule.csx +0 -31
  155. package/morph-idm/Workflows/user/src/GetConsentMapping.csx +0 -27
  156. package/morph-idm/Workflows/user/src/GetDeviceMapping.csx +0 -52
  157. package/morph-idm/Workflows/user/src/GetScopeMapping.csx +0 -139
  158. package/morph-idm/Workflows/user/src/GrantValidationFailRule.csx +0 -48
  159. package/morph-idm/Workflows/user/src/OtpVerifiedRule.csx +0 -31
  160. package/morph-idm/Workflows/user/src/PushVerifiedRule.csx +0 -31
  161. package/morph-idm/Workflows/user/src/RejectRule.csx +0 -16
  162. package/morph-idm/Workflows/user/src/ScopeValidationFailRule.csx +0 -67
  163. package/morph-idm/Workflows/user/src/ScopeValidationRule.csx +0 -67
  164. package/morph-idm/Workflows/user/src/TokenGenerationSuccessRule.csx +0 -28
  165. package/morph-idm/Workflows/user/src/UserValidationFailRule.csx +0 -36
  166. package/morph-idm/Workflows/user/src/VerifyOtpMapping.csx +0 -65
  167. package/morph-idm/Workflows/user/src/VerifyPushMapping.csx +0 -65
  168. package/morph-idm/Workflows/user/user-login.1.0.0.json +0 -1144
  169. /package/morph-idm/Workflows/{user → person}/person-cdc-worker.1.0.0.json +0 -0
  170. /package/morph-idm/Workflows/{user → person}/person-upsert-1.0.0.json +0 -0
  171. /package/morph-idm/Workflows/scope/execute/{scope-individual.http → scope-individual-1234567890-1234567890.http} +0 -0
  172. /package/morph-idm/Workflows/{user → user-login}/execute/README-LOGIN.md +0 -0
  173. /package/morph-idm/Workflows/{user → user-login}/src/ClientValidationRule.csx +0 -0
  174. /package/morph-idm/Workflows/{user → user-login}/src/ConsentSelectedRule.csx +0 -0
  175. /package/morph-idm/Workflows/{user → user-login}/src/IsIbWebClientWithDeviceRule.csx +0 -0
  176. /package/morph-idm/Workflows/{user → user-login}/src/NonIbWebClientWithDeviceRule.csx +0 -0
  177. /package/morph-idm/Workflows/{user → user-login}/src/OtpSentRule.csx +0 -0
  178. /package/morph-idm/Workflows/{user → user-login}/src/PushSentRule.csx +0 -0
  179. /package/morph-idm/Workflows/{user → user-login}/src/ScopeFetchedRule.csx +0 -0
  180. /package/morph-idm/Workflows/{user → user-login}/src/UserValidationRule.csx +0 -0
@@ -1,214 +0,0 @@
1
- ### Variables
2
- @workflow = client-manager
3
-
4
- ### ==========================================
5
- ### SCENARIO 1: Client Exists - Get Existing
6
- ### ==========================================
7
-
8
- @existingClientId = IbWeb
9
-
10
- ### Get or Create Client - Existing Client
11
- # @name getExistingClient
12
- POST {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/start?sync=true
13
- Accept-Language: tr-TR
14
- X-Request-Id: {{$guid}}
15
- X-Device-Id: {{$guid}}
16
- X-Token-Id: {{$guid}}
17
- X-Device-Info: Admin Portal/1.0
18
- X-Forwarded-For: 192.168.1.100
19
- user_reference: admin-001
20
- Content-Type: application/json
21
-
22
- {
23
- "key": "manager-{{existingClientId}}-{{$timestamp}}",
24
- "tags": [
25
- "client-manager",
26
- "get-existing"
27
- ],
28
- "attributes": {
29
- "clientId": "{{existingClientId}}"
30
- }
31
- }
32
-
33
- ###
34
- @existingInstanceId = {{getExistingClient.response.body.id}}
35
-
36
- ### Get Manager Instance State (Should be: client-ready)
37
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{existingInstanceId}}/functions/state
38
- Accept-Language: tr-TR
39
- X-Request-Id: {{$guid}}
40
- X-Device-Id: {{$guid}}
41
- X-Token-Id: {{$guid}}
42
- user_reference: admin-001
43
-
44
- ### Get Manager Instance Data (Should contain existingClient)
45
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{existingInstanceId}}/functions/data
46
- Accept-Language: tr-TR
47
- X-Request-Id: {{$guid}}
48
- X-Device-Id: {{$guid}}
49
- X-Token-Id: {{$guid}}
50
- user_reference: admin-001
51
-
52
-
53
- ### ==========================================
54
- ### SCENARIO 2: Client Not Exists - Create New
55
- ### ==========================================
56
-
57
- @newClientId = NewMobileApp
58
-
59
- ### Get or Create Client - New Client with Default Config
60
- # @name createNewClientDefault
61
- POST {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/start?sync=true
62
- Accept-Language: tr-TR
63
- X-Request-Id: {{$guid}}
64
- X-Device-Id: {{$guid}}
65
- X-Token-Id: {{$guid}}
66
- X-Device-Info: Admin Portal/1.0
67
- X-Forwarded-For: 192.168.1.100
68
- user_reference: admin-001
69
- Content-Type: application/json
70
-
71
- {
72
- "key": "manager-{{newClientId}}-{{$timestamp}}",
73
- "tags": [
74
- "client-manager",
75
- "create-new"
76
- ],
77
- "attributes": {
78
- "clientId": "{{newClientId}}"
79
- }
80
- }
81
-
82
- ###
83
- @newClientInstanceId = {{createNewClientDefault.response.body.id}}
84
-
85
- ### Get Manager Instance State (Should be: client-ready after creation)
86
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{newClientInstanceId}}/functions/state
87
- Accept-Language: tr-TR
88
- X-Request-Id: {{$guid}}
89
- X-Device-Id: {{$guid}}
90
- X-Token-Id: {{$guid}}
91
- user_reference: admin-001
92
-
93
- ### Get Manager Instance Data (Should contain createdClient)
94
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{newClientInstanceId}}/functions/data
95
- Accept-Language: tr-TR
96
- X-Request-Id: {{$guid}}
97
- X-Device-Id: {{$guid}}
98
- X-Token-Id: {{$guid}}
99
- user_reference: admin-001
100
-
101
-
102
- ### ==========================================
103
- ### SCENARIO 3: Create New Client with Full Config
104
- ### ==========================================
105
-
106
- @customClientId = CustomWebApp
107
-
108
- ### Get or Create Client - New Client with Custom Config
109
- # @name createNewClientCustom
110
- POST {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/start?sync=true
111
- Accept-Language: tr-TR
112
- X-Request-Id: {{$guid}}
113
- X-Device-Id: {{$guid}}
114
- X-Token-Id: {{$guid}}
115
- X-Device-Info: Admin Portal/1.0
116
- X-Forwarded-For: 192.168.1.100
117
- user_reference: admin-001
118
- Content-Type: application/json
119
-
120
- {
121
- "key": "manager-{{customClientId}}-{{$timestamp}}",
122
- "tags": [
123
- "client-manager",
124
- "create-custom"
125
- ],
126
- "attributes": {
127
- "clientId": "{{customClientId}}",
128
- "tags": ["web", "spa", "custom"],
129
- "clientConfig": {
130
- "allowedGrants": [
131
- "authorization_code",
132
- "refresh_token",
133
- "client_credentials"
134
- ],
135
- "clientType": "public",
136
- "applicationType": "spa",
137
- "allowedScopeGroups": [
138
- "IbCustomer",
139
- "CorporateCustomer"
140
- ],
141
- "redirectUris": [
142
- "https://myapp.com/callback",
143
- "https://myapp.com/silent-callback"
144
- ],
145
- "allowedOrigins": [
146
- "https://myapp.com"
147
- ],
148
- "tokens": [
149
- {
150
- "type": "access",
151
- "duration": "PT15M"
152
- },
153
- {
154
- "type": "refresh",
155
- "duration": "P7D"
156
- },
157
- {
158
- "type": "identity",
159
- "duration": "PT1H"
160
- }
161
- ],
162
- "pkce": {
163
- "mode": "must",
164
- "codeChallengeMethods": ["S256"],
165
- "defaultMethod": "S256"
166
- },
167
- "clientName": "Custom Web Application",
168
- "clientUri": "https://myapp.com",
169
- "logoUri": "https://myapp.com/logo.png"
170
- }
171
- }
172
- }
173
-
174
- ###
175
- @customClientInstanceId = {{createNewClientCustom.response.body.id}}
176
-
177
- ### Get Manager Instance State
178
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{customClientInstanceId}}/functions/state
179
- Accept-Language: tr-TR
180
- X-Request-Id: {{$guid}}
181
- X-Device-Id: {{$guid}}
182
- X-Token-Id: {{$guid}}
183
- user_reference: admin-001
184
-
185
- ### Get Manager Instance Data
186
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{customClientInstanceId}}/functions/data
187
- Accept-Language: tr-TR
188
- X-Request-Id: {{$guid}}
189
- X-Device-Id: {{$guid}}
190
- X-Token-Id: {{$guid}}
191
- user_reference: admin-001
192
-
193
- ### Verify the created client directly
194
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/client/instances/{{customClientId}}/functions/data
195
- Accept-Language: tr-TR
196
- X-Request-Id: {{$guid}}
197
- X-Device-Id: {{$guid}}
198
- X-Token-Id: {{$guid}}
199
- user_reference: admin-001
200
-
201
-
202
- ### ==========================================
203
- ### UTILITY ENDPOINTS
204
- ### ==========================================
205
-
206
- ### Get All Client Manager Instances
207
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances
208
- Accept-Language: tr-TR
209
- X-Request-Id: {{$guid}}
210
- X-Device-Id: {{$guid}}
211
- X-Token-Id: {{$guid}}
212
- user_reference: admin-001
213
-
214
-
@@ -1,28 +0,0 @@
1
- using System.Threading.Tasks;
2
- using BBT.Workflow.Scripting;
3
- using BBT.Workflow.Scripting.Functions;
4
-
5
- public class ClientCreatedRule : ScriptBase, IConditionMapping
6
- {
7
- public async Task<bool> Handler(ScriptContext context)
8
- {
9
- // Check if client workflow completed successfully
10
- var createdClient = context.Instance?.Data?.createdClient;
11
-
12
- if (createdClient == null)
13
- {
14
- LogWarning("ClientCreatedRule: createdClient is null");
15
- return false;
16
- }
17
-
18
- // Check if client reached a valid state (draft or active)
19
- var clientState = createdClient?.attributes?.state?.key?.ToString();
20
-
21
- bool isCreated = clientState == "draft" || clientState == "active";
22
-
23
- LogInformation($"ClientCreatedRule: Client state = '{clientState}', isCreated = {isCreated}");
24
-
25
- return isCreated;
26
- }
27
- }
28
-
@@ -1,25 +0,0 @@
1
- using System.Threading.Tasks;
2
- using BBT.Workflow.Scripting;
3
- using BBT.Workflow.Scripting.Functions;
4
-
5
- public class ClientExistsRule : ScriptBase, IConditionMapping
6
- {
7
- public async Task<bool> Handler(ScriptContext context)
8
- {
9
- // Check if client was found in the database
10
- var clientFound = context.Instance?.Data?.clientFound;
11
-
12
- if (clientFound == null)
13
- {
14
- LogWarning("ClientExistsRule: clientFound flag not set");
15
- return false;
16
- }
17
-
18
- bool exists = (bool)clientFound;
19
-
20
- LogInformation($"ClientExistsRule: Client exists = {exists}");
21
-
22
- return exists;
23
- }
24
- }
25
-
@@ -1,63 +0,0 @@
1
- using System;
2
- using System.Dynamic;
3
- using System.Threading.Tasks;
4
- using BBT.Workflow.Definitions;
5
- using BBT.Workflow.Scripting;
6
- using BBT.Workflow.Scripting.Functions;
7
-
8
- public class CreateClientSubFlowMapping : ScriptBase, ISubFlowMapping
9
- {
10
- public Task<ScriptResponse> InputHandler(ScriptContext context)
11
- {
12
- // Pass through all client configuration from input
13
- // The caller should provide full client configuration in clientConfig
14
-
15
- dynamic expandoObject = new ExpandoObject();
16
-
17
- // Get client key
18
- expandoObject.key = context.Instance?.Data?.clientId?.ToString() ?? $"client-{Guid.NewGuid()}";
19
-
20
- // Get tags if provided
21
- expandoObject.tags = context.Instance?.Data?.tags ?? new[] { "auto-created" };
22
-
23
- // Get client configuration - this should be provided by caller
24
- if (HasProperty(context.Instance?.Data, "clientConfig"))
25
- {
26
- expandoObject.attributes = context.Instance.Data.clientConfig;
27
- }
28
- else
29
- {
30
- // Default minimal client configuration
31
- expandoObject.attributes = new
32
- {
33
- allowedGrants = new[] { "authorization_code", "refresh_token" },
34
- clientType = "confidential",
35
- allowedScopeGroups = new[] { "IbCustomer" }
36
- };
37
- }
38
-
39
- LogInformation($"CreateClientSubFlowMapping: Starting client workflow with key '{expandoObject.key}'");
40
-
41
- return Task.FromResult(new ScriptResponse
42
- {
43
- Data = expandoObject,
44
- Headers = null
45
- });
46
- }
47
-
48
- public async Task<ScriptResponse> OutputHandler(ScriptContext context)
49
- {
50
- // Store the created client information
51
- LogInformation("CreateClientSubFlowMapping: Client subflow completed");
52
-
53
- return new ScriptResponse
54
- {
55
- Data = new
56
- {
57
- createdClient = context.Body
58
- },
59
- Headers = null
60
- };
61
- }
62
- }
63
-
@@ -1,59 +0,0 @@
1
- using System.Threading.Tasks;
2
- using BBT.Workflow.Definitions;
3
- using BBT.Workflow.Scripting;
4
- using BBT.Workflow.Scripting.Functions;
5
-
6
- public class GetClientForManagerMapping : ScriptBase, IMapping
7
- {
8
- public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
9
- {
10
- var triggerTask = (task as GetInstanceDataTask)!;
11
-
12
- // Get clientId from input
13
- var clientId = context.Instance?.Data?.clientId?.ToString() ?? string.Empty;
14
-
15
- LogInformation($"GetClientForManagerMapping: Looking for client '{clientId}'");
16
-
17
- triggerTask.SetKey(clientId);
18
- return Task.FromResult(new ScriptResponse());
19
- }
20
-
21
- public async Task<ScriptResponse> OutputHandler(ScriptContext context)
22
- {
23
- // Check if client was found
24
- if (HasProperty(context.Body, "data") && HasProperty(context.Body.data, "data"))
25
- {
26
- var clientData = context.Body.data.data;
27
-
28
- LogInformation($"GetClientForManagerMapping: Client found");
29
-
30
- return new ScriptResponse
31
- {
32
- Data = new
33
- {
34
- clientFound = true,
35
- existingClient = new
36
- {
37
- key = context.Body.data.key,
38
- state = context.Body.data.attributes?.state?.key,
39
- data = clientData
40
- }
41
- }
42
- };
43
- }
44
- else
45
- {
46
- LogInformation("GetClientForManagerMapping: Client not found, will create new one");
47
-
48
- return new ScriptResponse
49
- {
50
- Data = new
51
- {
52
- clientFound = false,
53
- existingClient = (object)null
54
- }
55
- };
56
- }
57
- }
58
- }
59
-
@@ -1,16 +0,0 @@
1
- using System.Threading.Tasks;
2
- using BBT.Workflow.Scripting;
3
-
4
- /// <summary>
5
- /// Rule for approve transition
6
- /// Workflow: person-upsert
7
- /// State: draft
8
- /// </summary>
9
- public class ApproveRule : IConditionMapping
10
- {
11
- public async Task<bool> Handler(ScriptContext context)
12
- {
13
- // TODO: Implement actual rule logic
14
- return true;
15
- }
16
- }
@@ -1,20 +0,0 @@
1
- using System.Threading.Tasks;
2
- using BBT.Workflow.Scripting;
3
- using BBT.Workflow.Scripting.Functions;
4
-
5
- public class AutoConsentCreatedRule : ScriptBase, IConditionMapping
6
- {
7
- public async Task<bool> Handler(ScriptContext context)
8
- {
9
- // Check if auto-consent was successfully created
10
- if (HasProperty(context.Instance?.Data, "autoConsentCreated") && context.Instance?.Data?.autoConsentCreated == true)
11
- {
12
- LogInformation("AutoConsentCreatedRule: Auto-consent created successfully");
13
- return true;
14
- }
15
-
16
- LogWarning("AutoConsentCreatedRule: Auto-consent creation failed");
17
- return false;
18
- }
19
- }
20
-
@@ -1,77 +0,0 @@
1
- using System.Collections.Generic;
2
- using System.Threading.Tasks;
3
- using BBT.Workflow.Scripting;
4
- using BBT.Workflow.Scripting.Functions;
5
-
6
- /// <summary>
7
- /// Rule to check if auto-consent creation is required.
8
- /// Returns true if:
9
- /// 1. Consent was not found (no consentSnapshot)
10
- /// 2. AND the requested scope is in the autoConsentScopes list
11
- /// </summary>
12
- public class AutoConsentRequiredRule : ScriptBase, IConditionMapping
13
- {
14
- public async Task<bool> Handler(ScriptContext context)
15
- {
16
- // Check if consent was already found - if yes, no auto-consent needed
17
- if (HasProperty(context.Instance?.Data, "consentSnapshot") && context.Instance?.Data?.consentSnapshot != null)
18
- {
19
- LogInformation("AutoConsentRequiredRule: Consent already exists, no auto-consent needed");
20
- return false;
21
- }
22
-
23
- // Check if we have auto-consent eligible scopes
24
- if (!HasProperty(context.Instance?.Data, "autoConsentScopes"))
25
- {
26
- LogWarning("AutoConsentRequiredRule: No autoConsentScopes found in instance data");
27
- return false;
28
- }
29
-
30
- var autoConsentScopes = context.Instance?.Data?.autoConsentScopes;
31
- if (autoConsentScopes == null)
32
- {
33
- LogWarning("AutoConsentRequiredRule: autoConsentScopes is null");
34
- return false;
35
- }
36
-
37
- // Get the requested scopes
38
- var requestedScopes = context.Instance?.Data?.scopes;
39
- if (requestedScopes == null)
40
- {
41
- LogWarning("AutoConsentRequiredRule: No scopes in request");
42
- return false;
43
- }
44
-
45
- // Convert autoConsentScopes to a list for comparison
46
- var autoConsentList = new List<string>();
47
- foreach (var scope in autoConsentScopes)
48
- {
49
- var scopeStr = scope?.ToString();
50
- if (!string.IsNullOrEmpty(scopeStr))
51
- {
52
- autoConsentList.Add(scopeStr);
53
- }
54
- }
55
-
56
- if (autoConsentList.Count == 0)
57
- {
58
- LogInformation("AutoConsentRequiredRule: No scopes eligible for auto-consent");
59
- return false;
60
- }
61
-
62
- // Check if any requested scope is in the auto-consent list
63
- foreach (var requestedScope in requestedScopes)
64
- {
65
- var scopeStr = requestedScope?.ToString();
66
- if (!string.IsNullOrEmpty(scopeStr) && autoConsentList.Contains(scopeStr))
67
- {
68
- LogInformation($"AutoConsentRequiredRule: Scope '{scopeStr}' is eligible for auto-consent, creating consent");
69
- return true;
70
- }
71
- }
72
-
73
- LogInformation("AutoConsentRequiredRule: No requested scopes are eligible for auto-consent");
74
- return false;
75
- }
76
- }
77
-
@@ -1,66 +0,0 @@
1
- using System.Threading.Tasks;
2
- using BBT.Workflow.Definitions;
3
- using BBT.Workflow.Scripting;
4
- using BBT.Workflow.Scripting.Functions;
5
-
6
- /// <summary>
7
- /// Mapping for checking device by user reference
8
- /// Uses GetInstanceData task to fetch device workflow instance by user_reference
9
- /// </summary>
10
- public class CheckDeviceByUserReferenceMapping : ScriptBase, IMapping
11
- {
12
- public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
13
- {
14
- var triggerTask = (task as GetInstanceDataTask)!;
15
-
16
- // Get user reference from user snapshot for device lookup
17
- var userReference = context.Instance?.Data?.userSnapshot?.person?.reference?.ToString() ?? string.Empty;
18
-
19
- // Fallback to deviceId if no user reference
20
- if (string.IsNullOrEmpty(userReference))
21
- {
22
- userReference = context.Instance?.Data?.deviceId?.ToString() ?? string.Empty;
23
- }
24
-
25
- LogInformation($"CheckDeviceByUserReferenceMapping InputHandler: Looking up device by userReference={userReference}");
26
-
27
- triggerTask.SetKey(userReference);
28
- return Task.FromResult(new ScriptResponse());
29
- }
30
-
31
- public async Task<ScriptResponse> OutputHandler(ScriptContext context)
32
- {
33
- // Check if device was found
34
- if (HasProperty(context.Body, "data") && HasProperty(context.Body.data, "data"))
35
- {
36
- var deviceData = context.Body.data.data;
37
- var instanceId = context.Body.data?.instanceId?.ToString();
38
-
39
- LogInformation($"CheckDeviceByUserReferenceMapping OutputHandler: Device found, instanceId={instanceId}");
40
-
41
- return new ScriptResponse
42
- {
43
- Data = new
44
- {
45
- deviceSnapshot = deviceData,
46
- deviceInstanceId = instanceId,
47
- deviceFound = true
48
- }
49
- };
50
- }
51
- else
52
- {
53
- LogInformation("CheckDeviceByUserReferenceMapping OutputHandler: Device not found");
54
-
55
- return new ScriptResponse
56
- {
57
- Data = new
58
- {
59
- deviceFound = false,
60
- message = "Device not found"
61
- }
62
- };
63
- }
64
- }
65
- }
66
-
@@ -1,28 +0,0 @@
1
- using System.Threading.Tasks;
2
- using BBT.Workflow.Scripting;
3
-
4
- public class ClientValidationFailRule : IConditionMapping
5
- {
6
- public async Task<bool> Handler(ScriptContext context)
7
- {
8
- try
9
- {
10
- // Get client data from task response
11
- var clientFromDb = context.Instance?.Data?.client;
12
-
13
- // Get client data from input
14
- var clientId = context.Instance?.Data?.clientId;
15
-
16
- if (clientFromDb == null)
17
- {
18
- return true;
19
- }
20
-
21
- return clientFromDb.clientId != clientId;
22
- }
23
- catch (Exception ex)
24
- {
25
- return true;
26
- }
27
- }
28
- }
@@ -1,36 +0,0 @@
1
- using System.Threading.Tasks;
2
- using BBT.Workflow.Scripting;
3
- using BBT.Workflow.Scripting.Functions;
4
- public class ConsentValidationRule : ScriptBase, IConditionMapping
5
- {
6
- public async Task<bool> Handler(ScriptContext context)
7
- {
8
- // Get consent data from task response
9
- var consentFromDb = context.Instance?.Data?.consent;
10
-
11
- // Get consent data from input
12
- var consentId = context.Instance?.Data?.consentId;
13
-
14
- if (consentFromDb == null || consentId == null)
15
- {
16
- LogWarning("Consent validation failed: Missing consent data");
17
- return false;
18
- }
19
-
20
- // Validate consent exists and is active
21
- var isActive = consentFromDb?.attributes?.state?.key == "active";
22
- var keyMatches = consentFromDb?.key == consentId;
23
-
24
- // Additional consent checks
25
- var notExpired = true;
26
- if (consentFromDb?.attributes?.expiresAt != null)
27
- {
28
- notExpired = DateTime.Parse(consentFromDb?.attributes?.expiresAt.ToString()) > DateTime.UtcNow;
29
- }
30
-
31
- LogInformation($"Consent validation: keyMatches={keyMatches}, isActive={isActive}, notExpired={notExpired}");
32
-
33
- return keyMatches && isActive && notExpired;
34
- }
35
- }
36
-