@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
@@ -23,7 +23,7 @@ public class CreateAutoConsentMapping : ScriptBase, ISubFlowMapping
23
23
  var clientId = context.Instance?.Data?.clientId?.ToString() ?? string.Empty;
24
24
 
25
25
  // Get the first auto-consent eligible scope
26
- var autoConsentEligibleScopes = context.Instance?.Data?.autoConsentEligibleScopes;
26
+ var autoConsentEligibleScopes = context.Instance?.Data.consentSnapshot.autoConsentEligibleScopes;
27
27
  var selectedScopeKey = string.Empty;
28
28
  var selectedGroupKey = string.Empty;
29
29
 
@@ -31,8 +31,8 @@ public class CreateAutoConsentMapping : ScriptBase, ISubFlowMapping
31
31
  {
32
32
  foreach (var scope in autoConsentEligibleScopes)
33
33
  {
34
- selectedScopeKey = scope?.scopeKey?.ToString();
35
- selectedGroupKey = scope?.groupKey?.ToString();
34
+ selectedScopeKey = scope?.scopeKey?.ToString() ?? string.Empty;
35
+ selectedGroupKey = scope?.groupKey?.ToString() ?? string.Empty;
36
36
  if (!string.IsNullOrEmpty(selectedScopeKey))
37
37
  {
38
38
  break; // Use the first eligible scope
@@ -48,8 +48,8 @@ public class CreateAutoConsentMapping : ScriptBase, ISubFlowMapping
48
48
  {
49
49
  foreach (var scope in scopes)
50
50
  {
51
- selectedScopeKey = scope?.key?.ToString();
52
- selectedGroupKey = scope?.groupKey?.ToString();
51
+ selectedScopeKey = scope?.key?.ToString() ?? string.Empty;
52
+ selectedGroupKey = scope?.groupKey?.ToString() ?? string.Empty;
53
53
  if (!string.IsNullOrEmpty(selectedScopeKey))
54
54
  {
55
55
  break;
@@ -65,41 +65,41 @@ public class CreateAutoConsentMapping : ScriptBase, ISubFlowMapping
65
65
  expandoObject.key = consentKey;
66
66
  expandoObject.tags = new List<string> { "auto-consent", "consent-selection-flow" };
67
67
 
68
- // Build attributes for consent
68
+ // Build attributes for consent using ExpandoObject
69
69
  var attributes = new ExpandoObject() as IDictionary<string, object>;
70
70
 
71
71
  // User reference
72
- attributes["user"] = new {
73
- domain = "morph-idm",
74
- workflow = "user",
75
- key = userKey,
76
- version = "1.0.0"
77
- };
72
+ dynamic userRef = new ExpandoObject();
73
+ userRef.domain = "morph-idm";
74
+ userRef.workflow = "user";
75
+ userRef.key = userKey;
76
+ userRef.version = "1.0.0";
77
+ attributes["user"] = userRef;
78
78
 
79
79
  // Client reference
80
- attributes["client"] = new {
81
- domain = "morph-idm",
82
- workflow = "client",
83
- key = clientId,
84
- version = "1.0.0"
85
- };
80
+ dynamic clientRef = new ExpandoObject();
81
+ clientRef.domain = "morph-idm";
82
+ clientRef.workflow = "client";
83
+ clientRef.key = clientId;
84
+ clientRef.version = "1.0.0";
85
+ attributes["client"] = clientRef;
86
86
 
87
87
  // Scope reference
88
- attributes["scope"] = new {
89
- domain = "morph-idm",
90
- workflow = "scope",
91
- key = selectedScopeKey,
92
- version = "1.0.0"
93
- };
88
+ dynamic scopeRef = new ExpandoObject();
89
+ scopeRef.domain = "morph-idm";
90
+ scopeRef.workflow = "scope";
91
+ scopeRef.key = selectedScopeKey;
92
+ scopeRef.version = "1.0.0";
93
+ attributes["scope"] = scopeRef;
94
94
 
95
95
  // Default position
96
96
  attributes["position"] = "self-access";
97
97
 
98
98
  // Default roles for auto-consent
99
- attributes["roles"] = new List<object>
100
- {
101
- new { role = "idm.self-access", allowance = "allow" }
102
- };
99
+ dynamic roleItem = new ExpandoObject();
100
+ roleItem.role = "idm.self-access";
101
+ roleItem.allowance = "allow";
102
+ attributes["roles"] = new List<object> { roleItem };
103
103
 
104
104
  // Set consent timestamps
105
105
  attributes["grantedAt"] = DateTime.UtcNow.ToString("o");
@@ -122,29 +122,29 @@ public class CreateAutoConsentMapping : ScriptBase, ISubFlowMapping
122
122
  public async Task<ScriptResponse> OutputHandler(ScriptContext context)
123
123
  {
124
124
  // Extract the created consent info from subflow response
125
- var consentKey = context.Body?.key?.ToString();
126
- var consentState = context.Body?.state?.ToString();
125
+ var consentKey = context.Body?.key?.ToString() ?? string.Empty;
126
+ var consentState = context.Body?.state?.ToString() ?? string.Empty;
127
127
 
128
128
  LogInformation($"CreateAutoConsentMapping OutputHandler: Auto-consent created - key={consentKey}, state={consentState}");
129
129
 
130
- // Store the created consent info
130
+ // Store the created consent info using ExpandoObject
131
+ dynamic result = new ExpandoObject();
132
+ result.autoConsentCreated = true;
133
+ result.autoConsentKey = consentKey;
134
+ result.autoConsentState = consentState;
135
+
136
+ dynamic selectedConsent = new ExpandoObject();
137
+ selectedConsent.key = consentKey;
138
+ selectedConsent.roles = context.Body?.data?.roles;
139
+ selectedConsent.expiresAt = context.Body?.data?.expiresAt;
140
+
141
+ result.selectedConsent = selectedConsent;
142
+ result.selectedConsentKey = consentKey;
143
+
131
144
  return new ScriptResponse
132
145
  {
133
- Data = new
134
- {
135
- autoConsentCreated = true,
136
- autoConsentKey = consentKey,
137
- autoConsentState = consentState,
138
- selectedConsent = new
139
- {
140
- key = consentKey,
141
- roles = context.Body?.data?.roles,
142
- expiresAt = context.Body?.data?.expiresAt
143
- },
144
- selectedConsentKey = consentKey
145
- },
146
+ Data = result,
146
147
  Headers = null
147
148
  };
148
149
  }
149
150
  }
150
-
@@ -10,21 +10,25 @@ public class MultipleConsentsRule : ScriptBase, IConditionMapping
10
10
  {
11
11
  public async Task<bool> Handler(ScriptContext context)
12
12
  {
13
- if (!HasProperty(context.Instance?.Data, "consentCount"))
13
+ if (!HasProperty(context.Instance?.Data, "consentSnapshot"))
14
14
  {
15
- LogWarning("MultipleConsentsRule: consentCount not found");
15
+ LogWarning("MultipleConsentsRule: consentSnapshot not found");
16
+ return false;
17
+ }
18
+ if (!HasProperty(context.Instance?.Data.consentSnapshot, "consents"))
19
+ {
20
+ LogWarning("MultipleConsentsRule: consents not found");
16
21
  return false;
17
22
  }
18
23
 
19
- var consentCount = (int)(context.Instance?.Data?.consentCount ?? 0);
20
-
21
- if (consentCount > 1)
24
+ var consents = context.Instance?.Data.consentSnapshot.consents as List<object>;
25
+ if (consents?.Count > 1)
22
26
  {
23
- LogInformation($"MultipleConsentsRule: {consentCount} consents found, user selection required");
27
+ LogInformation($"MultipleConsentsRule: {consents?.Count ?? 0} consents found, user selection required");
24
28
  return true;
25
29
  }
26
-
27
- LogInformation($"MultipleConsentsRule: consentCount={consentCount}, not multiple");
30
+
31
+ LogInformation($"MultipleConsentsRule: consents={consents?.Count ?? 0}, not multiple");
28
32
  return false;
29
33
  }
30
34
  }
@@ -10,34 +10,18 @@ public class NoConsentEligibleRule : ScriptBase, IConditionMapping
10
10
  {
11
11
  public async Task<bool> Handler(ScriptContext context)
12
12
  {
13
- if (!HasProperty(context.Instance?.Data, "consentCount"))
13
+ if (!HasProperty(context.Instance?.Data, "consentSnapshot"))
14
14
  {
15
- LogWarning("NoConsentEligibleRule: consentCount not found");
16
- return false;
17
- }
18
-
19
- var consentCount = (int)(context.Instance?.Data?.consentCount ?? 0);
20
-
21
- if (consentCount > 0)
22
- {
23
- LogInformation($"NoConsentEligibleRule: consentCount={consentCount}, consents exist");
24
- return false;
25
- }
26
-
27
- // Check auto-consent eligibility
28
- var hasAutoConsentEligible = false;
29
- if (HasProperty(context.Instance?.Data, "hasAutoConsentEligible"))
30
- {
31
- hasAutoConsentEligible = context.Instance?.Data?.hasAutoConsentEligible == true;
15
+ LogWarning("NoConsentEligibleRule: consentSnapshot not found");
16
+ return true;
32
17
  }
33
-
34
- if (hasAutoConsentEligible)
18
+ if (!HasProperty(context.Instance?.Data.consentSnapshot, "consents"))
35
19
  {
36
- LogInformation("NoConsentEligibleRule: No consents but auto-consent eligible, creating auto-consent");
20
+ LogWarning("NoConsentEligibleRule: consents not found");
37
21
  return true;
38
22
  }
39
23
 
40
- LogInformation("NoConsentEligibleRule: No consents and not eligible for auto-consent");
24
+ LogInformation("NoConsentEligibleRule: There are consents available");
41
25
  return false;
42
26
  }
43
27
  }
@@ -0,0 +1,63 @@
1
+ using System.Dynamic;
2
+ using System.Threading.Tasks;
3
+ using BBT.Workflow.Definitions;
4
+ using BBT.Workflow.Scripting;
5
+ using BBT.Workflow.Scripting.Functions;
6
+
7
+ /// <summary>
8
+ /// Mapping for auto-selecting the single consent.
9
+ /// When there's exactly one consent, this mapping automatically selects it.
10
+ /// </summary>
11
+ public class SingleConsentAutoSelectMapping : ScriptBase, IMapping
12
+ {
13
+ public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
14
+ {
15
+ // No input preparation needed for this mapping
16
+ return Task.FromResult(new ScriptResponse());
17
+ }
18
+
19
+ public async Task<ScriptResponse> OutputHandler(ScriptContext context)
20
+ {
21
+ dynamic result = new ExpandoObject();
22
+
23
+ if (!HasProperty(context.Instance?.Data, "consentSnapshot"))
24
+ {
25
+ LogWarning("SingleConsentAutoSelectMapping: consentSnapshot not found");
26
+ result.selectionError = "consentSnapshot not found";
27
+ return new ScriptResponse { Data = result };
28
+ }
29
+
30
+ if (!HasProperty(context.Instance?.Data?.consentSnapshot, "consents"))
31
+ {
32
+ LogWarning("SingleConsentAutoSelectMapping: consents not found");
33
+ result.selectionError = "consents not found";
34
+ return new ScriptResponse { Data = result };
35
+ }
36
+
37
+ var consents = context.Instance?.Data?.consentSnapshot.consents;
38
+ dynamic selectedConsent = null;
39
+ string selectedConsentKey = string.Empty;
40
+
41
+ // Get the first (and only) consent
42
+ foreach (var consent in consents)
43
+ {
44
+ selectedConsent = consent;
45
+ selectedConsentKey = consent?.consentKey?.ToString() ?? string.Empty;
46
+ break;
47
+ }
48
+
49
+ if (selectedConsent == null)
50
+ {
51
+ LogWarning("SingleConsentAutoSelectMapping: No consent found in list");
52
+ result.selectionError = "No consent found";
53
+ return new ScriptResponse { Data = result };
54
+ }
55
+
56
+ LogInformation($"SingleConsentAutoSelectMapping: Auto-selected single consent: {selectedConsentKey}");
57
+
58
+ result.selectedConsent = selectedConsent;
59
+ result.selectedConsentKey = selectedConsentKey;
60
+
61
+ return new ScriptResponse { Data = result };
62
+ }
63
+ }
@@ -10,35 +10,24 @@ public class SingleConsentRule : ScriptBase, IConditionMapping
10
10
  {
11
11
  public async Task<bool> Handler(ScriptContext context)
12
12
  {
13
- if (!HasProperty(context.Instance?.Data, "consentCount"))
13
+ if (!HasProperty(context.Instance?.Data, "consentSnapshot"))
14
14
  {
15
- LogWarning("SingleConsentRule: consentCount not found");
15
+ LogWarning("SingleConsentRule: consentSnapshot not found");
16
+ return false;
17
+ }
18
+ if (!HasProperty(context.Instance?.Data.consentSnapshot, "consents"))
19
+ {
20
+ LogWarning("SingleConsentRule: consents not found");
16
21
  return false;
17
22
  }
18
23
 
19
- var consentCount = (int)(context.Instance?.Data?.consentCount ?? 0);
20
-
21
- if (consentCount == 1)
24
+ var consents = context.Instance?.Data.consentSnapshot.consents as List<object>;
25
+ if (consents?.Count == 1)
22
26
  {
23
- // Auto-select the single consent
24
- var consents = context.Instance?.Data?.consents;
25
- if (consents != null)
26
- {
27
- foreach (var consent in consents)
28
- {
29
- var consentKey = consent?.key?.ToString();
30
- LogInformation($"SingleConsentRule: Auto-selecting single consent: {consentKey}");
31
-
32
- // Store selected consent
33
- context.Instance.Data.selectedConsent = consent;
34
- context.Instance.Data.selectedConsentKey = consentKey;
35
- break;
36
- }
37
- }
27
+
38
28
  return true;
39
29
  }
40
-
41
- LogInformation($"SingleConsentRule: consentCount={consentCount}, not single");
30
+ LogInformation($"SingleConsentRule: consents={consents?.Count ?? 0}, not single");
42
31
  return false;
43
32
  }
44
33
  }
@@ -44,12 +44,6 @@ Content-Type: application/json
44
44
  "environment": "production",
45
45
  "bundleId": "com.bank.mobilebanking",
46
46
  "updatedAt": "{{$datetime iso8601}}"
47
- },
48
- "registeredAt": "{{$datetime iso8601}}",
49
- "lastSeenAt": "{{$datetime iso8601}}",
50
- "metadata": {
51
- "appBuildNumber": "1234",
52
- "jailbroken": false
53
47
  }
54
48
  }
55
49
  }
@@ -0,0 +1,32 @@
1
+ ### Variables
2
+ @workflow = device
3
+
4
+ ### Search Device Instances (Current Filter Format)
5
+ GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances?filter=attributes=deviceId=like:i1
6
+ Accept-Language: tr-TR
7
+ X-Request-Id: {{$guid}}
8
+ X-Device-Id: admin-portal
9
+ X-Token-Id: {{$guid}}
10
+ user_reference: admin-001
11
+
12
+ ### ============================================
13
+ ### NEW JSON FILTER FORMAT (Upcoming Version)
14
+ ### ============================================
15
+
16
+ ### Search Devices with OR condition - Active or Pending status
17
+ # Filter JSON: {"or":[{"attributes":{"status":{"eq":"active"}}},{"attributes":{"status":{"eq":"pending"}}}]}
18
+ GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances?filter=%7B%22or%22%3A%5B%7B%22attributes%22%3A%7B%22status%22%3A%7B%22eq%22%3A%22active%22%7D%7D%7D%2C%7B%22attributes%22%3A%7B%22status%22%3A%7B%22eq%22%3A%22pending%22%7D%7D%7D%5D%7D&page=1&pageSize=10
19
+ Accept-Language: tr-TR
20
+ X-Request-Id: {{$guid}}
21
+ X-Device-Id: admin-portal
22
+ X-Token-Id: {{$guid}}
23
+ user_reference: admin-001
24
+
25
+ ### Search Devices with AND + OR conditions - iOS devices that are active or registered
26
+ # Filter JSON: {"and":[{"attributes":{"platform":{"eq":"iOS"}}},{"or":[{"attributes":{"status":{"eq":"active"}}},{"attributes":{"status":{"eq":"registered"}}}]}]}
27
+ GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances?filter=%7B%22and%22%3A%5B%7B%22attributes%22%3A%7B%22platform%22%3A%7B%22eq%22%3A%22iOS%22%7D%7D%7D%2C%7B%22or%22%3A%5B%7B%22attributes%22%3A%7B%22status%22%3A%7B%22eq%22%3A%22active%22%7D%7D%7D%2C%7B%22attributes%22%3A%7B%22status%22%3A%7B%22eq%22%3A%22registered%22%7D%7D%7D%5D%7D%5D%7D&page=1&pageSize=10
28
+ Accept-Language: tr-TR
29
+ X-Request-Id: {{$guid}}
30
+ X-Device-Id: admin-portal
31
+ X-Token-Id: {{$guid}}
32
+ user_reference: admin-001
@@ -0,0 +1,191 @@
1
+ ### Variables
2
+ @workflow = person
3
+ @key = 123
4
+
5
+ ###############################################################################
6
+ # Person Workflow - CRUD Operations for Person Entity
7
+ ###############################################################################
8
+
9
+ ### Start Person - Create a new person in draft state
10
+ # @name startPerson
11
+ POST {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/start?sync=true
12
+ Accept-Language: tr-TR
13
+ X-Request-Id: {{$guid}}
14
+ X-Device-Id: admin-portal
15
+ X-Token-Id: {{$guid}}
16
+ X-Device-Info: Admin Portal/1.0
17
+ X-Forwarded-For: 192.168.1.100
18
+ user_reference: admin-001
19
+ Content-Type: application/json
20
+
21
+ {
22
+ "key": "{{key}}",
23
+ "tags": [
24
+ "person",
25
+ "customer"
26
+ ],
27
+ "attributes": {
28
+ "name": {
29
+ "first": "Ahmet",
30
+ "last": "Yılmaz"
31
+ },
32
+ "emails": [
33
+ {
34
+ "address": "ahmet.yilmaz@example.com",
35
+ "validations": [
36
+ {
37
+ "source": "otp",
38
+ "validatedAt": "{{$datetime iso8601}}",
39
+ "validatingProcess": "email-verification-workflow",
40
+ "status": "valid"
41
+ }
42
+ ],
43
+ "useForAlerts": true
44
+ }
45
+ ],
46
+ "mobilePhonesNumbers": [
47
+ {
48
+ "countryCode": "+90",
49
+ "areaCode": "532",
50
+ "number": "1234567",
51
+ "validations": [
52
+ {
53
+ "source": "otp",
54
+ "validatedAt": "{{$datetime iso8601}}",
55
+ "validatingProcess": "phone-verification-workflow",
56
+ "status": "valid"
57
+ }
58
+ ],
59
+ "useForOTP": true
60
+ }
61
+ ],
62
+ "securityQuestion": [
63
+ ],
64
+ "antiPishingImage": "sunset-beach-palm"
65
+ }
66
+ }
67
+
68
+ ###
69
+ @personInstanceId = {{startPerson.response.body.id}}
70
+ @personKey = {{startPerson.response.body.key}}
71
+
72
+ ### Publish Person - Activate the person (draft -> active)
73
+ # @name publishPerson
74
+ PATCH {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{personInstanceId}}/transitions/publish?sync=true
75
+ Accept-Language: tr-TR
76
+ X-Request-Id: {{$guid}}
77
+ X-Device-Id: admin-portal
78
+ X-Token-Id: {{$guid}}
79
+ X-Device-Info: Admin Portal/1.0
80
+ X-Forwarded-For: 192.168.1.100
81
+ user_reference: admin-001
82
+ Content-Type: application/json
83
+
84
+ {
85
+ "attributes": {
86
+ "publishedBy": "admin-001",
87
+ "publishedAt": "{{$datetime iso8601}}",
88
+ "notes": "Person verified and activated"
89
+ }
90
+ }
91
+
92
+ ### Update Person - Update person data (available in any state: draft, active, passive)
93
+ # @name updatePerson
94
+ PATCH {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{personInstanceId}}/transitions/update?sync=true
95
+ Accept-Language: tr-TR
96
+ X-Request-Id: {{$guid}}
97
+ X-Device-Id: admin-portal
98
+ X-Token-Id: {{$guid}}
99
+ X-Device-Info: Admin Portal/1.0
100
+ X-Forwarded-For: 192.168.1.100
101
+ user_reference: admin-001
102
+ Content-Type: application/json
103
+
104
+ {
105
+ "attributes": {
106
+ "securityQuestion": [
107
+ {
108
+ "question": "İlk okulunuzun adı nedir?",
109
+ "answer": "$argon2id$v=19$m=65536,t=3,p=4$c29tZXNhbHQ$newHashedAnswer",
110
+ "algorithm": "argon2",
111
+ "lastUpdatedDate": "{{$datetime iso8601}}"
112
+ }
113
+ ],
114
+ "antiPishingImage": "mountain-sunrise"
115
+ }
116
+ }
117
+
118
+ ### Get Person Instance State
119
+ # @name getPersonState
120
+ GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{personInstanceId}}/functions/state
121
+ Accept-Language: tr-TR
122
+ X-Request-Id: {{$guid}}
123
+ X-Device-Id: admin-portal
124
+ X-Token-Id: {{$guid}}
125
+ user_reference: admin-001
126
+
127
+ ### Get Person Instance Data
128
+ # @name getPersonData
129
+ GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{personInstanceId}}/functions/data
130
+ Accept-Language: tr-TR
131
+ X-Request-Id: {{$guid}}
132
+ X-Device-Id: admin-portal
133
+ X-Token-Id: {{$guid}}
134
+ user_reference: admin-001
135
+
136
+ ### Deactivate Person - Set person to passive state (active -> passive)
137
+ # @name deactivatePerson
138
+ PATCH {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{personInstanceId}}/transitions/passive?sync=true
139
+ Accept-Language: tr-TR
140
+ X-Request-Id: {{$guid}}
141
+ X-Device-Id: admin-portal
142
+ X-Token-Id: {{$guid}}
143
+ X-Device-Info: Admin Portal/1.0
144
+ X-Forwarded-For: 192.168.1.100
145
+ user_reference: admin-001
146
+ Content-Type: application/json
147
+
148
+ {
149
+ "attributes": {
150
+ "deactivatedBy": "admin-001",
151
+ "deactivatedAt": "{{$datetime iso8601}}",
152
+ "reason": "Customer request"
153
+ }
154
+ }
155
+
156
+ ### Reactivate Person - Restore person to active state (passive -> active)
157
+ # @name reactivatePerson
158
+ PATCH {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{personInstanceId}}/transitions/reactivate?sync=true
159
+ Accept-Language: tr-TR
160
+ X-Request-Id: {{$guid}}
161
+ X-Device-Id: admin-portal
162
+ X-Token-Id: {{$guid}}
163
+ X-Device-Info: Admin Portal/1.0
164
+ X-Forwarded-For: 192.168.1.100
165
+ user_reference: admin-001
166
+ Content-Type: application/json
167
+
168
+ {
169
+ "attributes": {
170
+ "reactivatedBy": "admin-001",
171
+ "reactivatedAt": "{{$datetime iso8601}}",
172
+ "reason": "Customer requested reactivation"
173
+ }
174
+ }
175
+
176
+ ### Get Person by Key
177
+ GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{personKey}}/functions/data
178
+ Accept-Language: tr-TR
179
+ X-Request-Id: {{$guid}}
180
+ X-Device-Id: admin-portal
181
+ X-Token-Id: {{$guid}}
182
+ user_reference: admin-001
183
+
184
+ ### List All Persons
185
+ GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances
186
+ Accept-Language: tr-TR
187
+ X-Request-Id: {{$guid}}
188
+ X-Device-Id: admin-portal
189
+ X-Token-Id: {{$guid}}
190
+ user_reference: admin-001
191
+