@greensecurity/javascript-sdk 0.45.0-beta.16 → 0.45.0-beta.18

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 (137) hide show
  1. package/dist/commonjs/__tests__/vendors.test.js +1 -1
  2. package/dist/commonjs/__tests__/webhooks.test.js +1 -1
  3. package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
  4. package/dist/commonjs/__tests__/zones.test.js +2 -9
  5. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  6. package/dist/commonjs/funcs/usersPostAuthenticate.d.ts +37 -0
  7. package/dist/commonjs/funcs/usersPostAuthenticate.d.ts.map +1 -1
  8. package/dist/commonjs/funcs/usersPostAuthenticate.js +37 -0
  9. package/dist/commonjs/funcs/usersPostAuthenticate.js.map +1 -1
  10. package/dist/commonjs/lib/config.d.ts +2 -2
  11. package/dist/commonjs/lib/config.js +2 -2
  12. package/dist/commonjs/models/components/authenticatesuccessresponse.d.ts +91 -0
  13. package/dist/commonjs/models/components/authenticatesuccessresponse.d.ts.map +1 -0
  14. package/dist/commonjs/models/components/authenticatesuccessresponse.js +100 -0
  15. package/dist/commonjs/models/components/authenticatesuccessresponse.js.map +1 -0
  16. package/dist/commonjs/models/components/index.d.ts +2 -0
  17. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  18. package/dist/commonjs/models/components/index.js +2 -0
  19. package/dist/commonjs/models/components/index.js.map +1 -1
  20. package/dist/commonjs/models/components/loginemailandpassword.d.ts +34 -0
  21. package/dist/commonjs/models/components/loginemailandpassword.d.ts.map +1 -1
  22. package/dist/commonjs/models/components/loginemailandpassword.js +2 -0
  23. package/dist/commonjs/models/components/loginemailandpassword.js.map +1 -1
  24. package/dist/commonjs/models/components/loginrequirementsfromemail.d.ts +34 -0
  25. package/dist/commonjs/models/components/loginrequirementsfromemail.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/loginrequirementsfromemail.js +2 -0
  27. package/dist/commonjs/models/components/loginrequirementsfromemail.js.map +1 -1
  28. package/dist/commonjs/models/components/mfarequiredresponse.d.ts +33 -0
  29. package/dist/commonjs/models/components/mfarequiredresponse.d.ts.map +1 -1
  30. package/dist/commonjs/models/components/mfarequiredresponse.js +2 -0
  31. package/dist/commonjs/models/components/mfarequiredresponse.js.map +1 -1
  32. package/dist/commonjs/models/components/passwordnotsetresponse.d.ts +34 -1
  33. package/dist/commonjs/models/components/passwordnotsetresponse.d.ts.map +1 -1
  34. package/dist/commonjs/models/components/passwordnotsetresponse.js +2 -0
  35. package/dist/commonjs/models/components/passwordnotsetresponse.js.map +1 -1
  36. package/dist/commonjs/models/components/passwordrequiredresponse.d.ts +33 -0
  37. package/dist/commonjs/models/components/passwordrequiredresponse.d.ts.map +1 -1
  38. package/dist/commonjs/models/components/passwordrequiredresponse.js +6 -0
  39. package/dist/commonjs/models/components/passwordrequiredresponse.js.map +1 -1
  40. package/dist/commonjs/models/components/samlloginrequiredresponse.d.ts +33 -0
  41. package/dist/commonjs/models/components/samlloginrequiredresponse.d.ts.map +1 -1
  42. package/dist/commonjs/models/components/samlloginrequiredresponse.js +2 -0
  43. package/dist/commonjs/models/components/samlloginrequiredresponse.js.map +1 -1
  44. package/dist/commonjs/models/components/ssocontinuation.d.ts +44 -0
  45. package/dist/commonjs/models/components/ssocontinuation.d.ts.map +1 -0
  46. package/dist/commonjs/models/components/ssocontinuation.js +56 -0
  47. package/dist/commonjs/models/components/ssocontinuation.js.map +1 -0
  48. package/dist/commonjs/models/operations/postauthenticate.d.ts +1 -1
  49. package/dist/commonjs/models/operations/postauthenticate.d.ts.map +1 -1
  50. package/dist/commonjs/models/operations/postauthenticate.js +1 -1
  51. package/dist/commonjs/models/operations/postauthenticate.js.map +1 -1
  52. package/dist/commonjs/react-query/usersPostAuthenticate.d.ts +37 -0
  53. package/dist/commonjs/react-query/usersPostAuthenticate.d.ts.map +1 -1
  54. package/dist/commonjs/react-query/usersPostAuthenticate.js +37 -0
  55. package/dist/commonjs/react-query/usersPostAuthenticate.js.map +1 -1
  56. package/dist/commonjs/sdk/users.d.ts +37 -0
  57. package/dist/commonjs/sdk/users.d.ts.map +1 -1
  58. package/dist/commonjs/sdk/users.js +37 -0
  59. package/dist/commonjs/sdk/users.js.map +1 -1
  60. package/dist/esm/__tests__/vendors.test.js +1 -1
  61. package/dist/esm/__tests__/webhooks.test.js +1 -1
  62. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  63. package/dist/esm/__tests__/zones.test.js +2 -9
  64. package/dist/esm/__tests__/zones.test.js.map +1 -1
  65. package/dist/esm/funcs/usersPostAuthenticate.d.ts +37 -0
  66. package/dist/esm/funcs/usersPostAuthenticate.d.ts.map +1 -1
  67. package/dist/esm/funcs/usersPostAuthenticate.js +37 -0
  68. package/dist/esm/funcs/usersPostAuthenticate.js.map +1 -1
  69. package/dist/esm/lib/config.d.ts +2 -2
  70. package/dist/esm/lib/config.js +2 -2
  71. package/dist/esm/models/components/authenticatesuccessresponse.d.ts +91 -0
  72. package/dist/esm/models/components/authenticatesuccessresponse.d.ts.map +1 -0
  73. package/dist/esm/models/components/authenticatesuccessresponse.js +61 -0
  74. package/dist/esm/models/components/authenticatesuccessresponse.js.map +1 -0
  75. package/dist/esm/models/components/index.d.ts +2 -0
  76. package/dist/esm/models/components/index.d.ts.map +1 -1
  77. package/dist/esm/models/components/index.js +2 -0
  78. package/dist/esm/models/components/index.js.map +1 -1
  79. package/dist/esm/models/components/loginemailandpassword.d.ts +34 -0
  80. package/dist/esm/models/components/loginemailandpassword.d.ts.map +1 -1
  81. package/dist/esm/models/components/loginemailandpassword.js +2 -0
  82. package/dist/esm/models/components/loginemailandpassword.js.map +1 -1
  83. package/dist/esm/models/components/loginrequirementsfromemail.d.ts +34 -0
  84. package/dist/esm/models/components/loginrequirementsfromemail.d.ts.map +1 -1
  85. package/dist/esm/models/components/loginrequirementsfromemail.js +2 -0
  86. package/dist/esm/models/components/loginrequirementsfromemail.js.map +1 -1
  87. package/dist/esm/models/components/mfarequiredresponse.d.ts +33 -0
  88. package/dist/esm/models/components/mfarequiredresponse.d.ts.map +1 -1
  89. package/dist/esm/models/components/mfarequiredresponse.js +2 -0
  90. package/dist/esm/models/components/mfarequiredresponse.js.map +1 -1
  91. package/dist/esm/models/components/passwordnotsetresponse.d.ts +34 -1
  92. package/dist/esm/models/components/passwordnotsetresponse.d.ts.map +1 -1
  93. package/dist/esm/models/components/passwordnotsetresponse.js +2 -0
  94. package/dist/esm/models/components/passwordnotsetresponse.js.map +1 -1
  95. package/dist/esm/models/components/passwordrequiredresponse.d.ts +33 -0
  96. package/dist/esm/models/components/passwordrequiredresponse.d.ts.map +1 -1
  97. package/dist/esm/models/components/passwordrequiredresponse.js +6 -0
  98. package/dist/esm/models/components/passwordrequiredresponse.js.map +1 -1
  99. package/dist/esm/models/components/samlloginrequiredresponse.d.ts +33 -0
  100. package/dist/esm/models/components/samlloginrequiredresponse.d.ts.map +1 -1
  101. package/dist/esm/models/components/samlloginrequiredresponse.js +2 -0
  102. package/dist/esm/models/components/samlloginrequiredresponse.js.map +1 -1
  103. package/dist/esm/models/components/ssocontinuation.d.ts +44 -0
  104. package/dist/esm/models/components/ssocontinuation.d.ts.map +1 -0
  105. package/dist/esm/models/components/ssocontinuation.js +19 -0
  106. package/dist/esm/models/components/ssocontinuation.js.map +1 -0
  107. package/dist/esm/models/operations/postauthenticate.d.ts +1 -1
  108. package/dist/esm/models/operations/postauthenticate.d.ts.map +1 -1
  109. package/dist/esm/models/operations/postauthenticate.js +1 -1
  110. package/dist/esm/models/operations/postauthenticate.js.map +1 -1
  111. package/dist/esm/react-query/usersPostAuthenticate.d.ts +37 -0
  112. package/dist/esm/react-query/usersPostAuthenticate.d.ts.map +1 -1
  113. package/dist/esm/react-query/usersPostAuthenticate.js +37 -0
  114. package/dist/esm/react-query/usersPostAuthenticate.js.map +1 -1
  115. package/dist/esm/sdk/users.d.ts +37 -0
  116. package/dist/esm/sdk/users.d.ts.map +1 -1
  117. package/dist/esm/sdk/users.js +37 -0
  118. package/dist/esm/sdk/users.js.map +1 -1
  119. package/jsr.json +1 -1
  120. package/package.json +1 -1
  121. package/src/__tests__/vendors.test.ts +1 -1
  122. package/src/__tests__/webhooks.test.ts +1 -1
  123. package/src/__tests__/zones.test.ts +2 -9
  124. package/src/funcs/usersPostAuthenticate.ts +37 -0
  125. package/src/lib/config.ts +2 -2
  126. package/src/models/components/authenticatesuccessresponse.ts +189 -0
  127. package/src/models/components/index.ts +2 -0
  128. package/src/models/components/loginemailandpassword.ts +36 -0
  129. package/src/models/components/loginrequirementsfromemail.ts +36 -0
  130. package/src/models/components/mfarequiredresponse.ts +35 -0
  131. package/src/models/components/passwordnotsetresponse.ts +36 -1
  132. package/src/models/components/passwordrequiredresponse.ts +39 -0
  133. package/src/models/components/samlloginrequiredresponse.ts +35 -0
  134. package/src/models/components/ssocontinuation.ts +71 -0
  135. package/src/models/operations/postauthenticate.ts +2 -2
  136. package/src/react-query/usersPostAuthenticate.ts +37 -0
  137. package/src/sdk/users.ts +37 -0
@@ -100,6 +100,43 @@ export declare class Users extends ClientSDK {
100
100
  * 3. Site redirects to your selected `return_url`
101
101
  * 4. The `user_token` will be appended as a query string parameter to your `return_url` - you must parse this token and store it
102
102
  * 5. Fetch the user object from `/users/me` using the token
103
+ *
104
+ * ## Finishing a "Login with Green Security" flow
105
+ *
106
+ * Green Security is also a SAML2 **identity provider**. When a third-party service provider sends a user to
107
+ * `/saml/idp/sso` to sign in with their Green Security account, the user lands on a Green Security login screen
108
+ * carrying an `sso_state` query string parameter. That parameter is a signed, five-minute record of which service
109
+ * provider is waiting, where its assertion consumer service lives, and what `RelayState` it sent.
110
+ *
111
+ * Authentication itself is unchanged - the user may still need a password, an MFA code, a magic link or a round trip
112
+ * to their own SAML IdP, and every `requires` value above applies as normal. The only difference is that you must
113
+ * echo `sso_state` back on **every** call in the sequence, unchanged, including the follow-up that carries the
114
+ * `mfa_code`.
115
+ *
116
+ * Each `202` response carries the verified blob back to you in its own top-level `sso_state` field. Send back the
117
+ * value from the response you just received rather than the one you started with. The two are normally the same
118
+ * string, but re-sending your original copy is how a blob the server has already rejected gets resent, and it forces
119
+ * you to hold login state you would otherwise not need.
120
+ *
121
+ * 1. Read `sso_state` from the query string of the login screen you were sent to
122
+ * 2. Run the login exactly as you would otherwise, adding `sso_state` to each request body and taking the value for
123
+ * the next request from the previous `202` response
124
+ * 3. On the `200` response, read `sso.continue_url`
125
+ * 4. Navigate the browser to `sso.continue_url` - a full page navigation, not a background fetch. It answers with a
126
+ * self-submitting form that delivers the signed `SAMLResponse` and the original `RelayState` to the service
127
+ * provider
128
+ * 5. The service provider validates the assertion and the user is signed in on their side
129
+ *
130
+ * On the `password_reset` leg the blob is **also** appended to `redirect_url` as a query parameter, alongside
131
+ * `return_url`. The browser follows that redirect and leaves the JSON body behind, so anything the remaining legs of
132
+ * the login still need has to ride the URL. Preserve the query string exactly as given.
133
+ *
134
+ * An invalid `sso_state` never fails a login. A forged, edited or expired blob is silently dropped and the request is
135
+ * then treated as an ordinary login, so valid credentials still return `200` - just with no `sso` object. Check for
136
+ * `sso` explicitly rather than reading `200` as proof the hand-off survived. When it is absent, do not retry with the
137
+ * same blob; the user has to start again from the service provider. See the
138
+ * [Login with Green Security](https://greensecurity.apidocumentation.com/guides/sso-login-with-green-security)
139
+ * guide for the service provider half of this flow.
103
140
  */
104
141
  postAuthenticate(request: operations.PostAuthenticateRequestBody, options?: RequestOptions): Promise<operations.PostAuthenticateResponse>;
105
142
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../src/sdk/users.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAG5D,qBAAa,KAAM,SAAQ,SAAS;IAClC;;;;;;;;;;;;;;;;;OAiBG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;OAKG;IACG,wBAAwB,CAC5B,OAAO,EAAE,UAAU,CAAC,+BAA+B,EACnD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,kDAAkD,CAAC;CAO1E"}
@@ -120,6 +120,43 @@ export class Users extends ClientSDK {
120
120
  * 3. Site redirects to your selected `return_url`
121
121
  * 4. The `user_token` will be appended as a query string parameter to your `return_url` - you must parse this token and store it
122
122
  * 5. Fetch the user object from `/users/me` using the token
123
+ *
124
+ * ## Finishing a "Login with Green Security" flow
125
+ *
126
+ * Green Security is also a SAML2 **identity provider**. When a third-party service provider sends a user to
127
+ * `/saml/idp/sso` to sign in with their Green Security account, the user lands on a Green Security login screen
128
+ * carrying an `sso_state` query string parameter. That parameter is a signed, five-minute record of which service
129
+ * provider is waiting, where its assertion consumer service lives, and what `RelayState` it sent.
130
+ *
131
+ * Authentication itself is unchanged - the user may still need a password, an MFA code, a magic link or a round trip
132
+ * to their own SAML IdP, and every `requires` value above applies as normal. The only difference is that you must
133
+ * echo `sso_state` back on **every** call in the sequence, unchanged, including the follow-up that carries the
134
+ * `mfa_code`.
135
+ *
136
+ * Each `202` response carries the verified blob back to you in its own top-level `sso_state` field. Send back the
137
+ * value from the response you just received rather than the one you started with. The two are normally the same
138
+ * string, but re-sending your original copy is how a blob the server has already rejected gets resent, and it forces
139
+ * you to hold login state you would otherwise not need.
140
+ *
141
+ * 1. Read `sso_state` from the query string of the login screen you were sent to
142
+ * 2. Run the login exactly as you would otherwise, adding `sso_state` to each request body and taking the value for
143
+ * the next request from the previous `202` response
144
+ * 3. On the `200` response, read `sso.continue_url`
145
+ * 4. Navigate the browser to `sso.continue_url` - a full page navigation, not a background fetch. It answers with a
146
+ * self-submitting form that delivers the signed `SAMLResponse` and the original `RelayState` to the service
147
+ * provider
148
+ * 5. The service provider validates the assertion and the user is signed in on their side
149
+ *
150
+ * On the `password_reset` leg the blob is **also** appended to `redirect_url` as a query parameter, alongside
151
+ * `return_url`. The browser follows that redirect and leaves the JSON body behind, so anything the remaining legs of
152
+ * the login still need has to ride the URL. Preserve the query string exactly as given.
153
+ *
154
+ * An invalid `sso_state` never fails a login. A forged, edited or expired blob is silently dropped and the request is
155
+ * then treated as an ordinary login, so valid credentials still return `200` - just with no `sso` object. Check for
156
+ * `sso` explicitly rather than reading `200` as proof the hand-off survived. When it is absent, do not retry with the
157
+ * same blob; the user has to start again from the service provider. See the
158
+ * [Login with Green Security](https://greensecurity.apidocumentation.com/guides/sso-login-with-green-security)
159
+ * guide for the service provider half of this flow.
123
160
  */
124
161
  async postAuthenticate(request, options) {
125
162
  return unwrapAsync(usersPostAuthenticate(this, request, options));
@@ -1 +1 @@
1
- {"version":3,"file":"users.js","sourceRoot":"","sources":["../../../src/sdk/users.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB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OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@greensecurity/javascript-sdk",
5
- "version": "0.45.0-beta.16",
5
+ "version": "0.45.0-beta.18",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greensecurity/javascript-sdk",
3
- "version": "0.45.0-beta.16",
3
+ "version": "0.45.0-beta.18",
4
4
  "author": "Green Security LLC",
5
5
  "type": "module",
6
6
  "tshy": {
@@ -121,7 +121,7 @@ test("Vendors List Vendor Credits", async () => {
121
121
  page: 1,
122
122
  useUrlParams: false,
123
123
  },
124
- creditBalance: 6030.32,
124
+ creditBalance: 3532.73,
125
125
  });
126
126
  });
127
127
 
@@ -20,7 +20,7 @@ test("Webhooks List All Webhook Endpoints", async () => {
20
20
  const testWebhookListForVendorUserResult = await greenSecurity.webhooks
21
21
  .listAllWebhookEndpoints({
22
22
  itemsPerPage: 25,
23
- desc: true,
23
+ desc: 0,
24
24
  sort: "",
25
25
  });
26
26
  expect(testWebhookListForVendorUserResult).toBeDefined();
@@ -39,14 +39,7 @@ test("Zones List Or Search Security Zones", async () => {
39
39
  facility: {},
40
40
  },
41
41
  {
42
- facility: {
43
- contacts: null,
44
- vendorGuestPolicy: {
45
- enabled: true,
46
- vendorGuestLimitAndOr: "and",
47
- vendorGuestRequireEmail: false,
48
- },
49
- },
42
+ facility: {},
50
43
  },
51
44
  ],
52
45
  });
@@ -65,7 +58,7 @@ test("Zones Security Zone Checkin", async () => {
65
58
 
66
59
  const result = await greenSecurity.zones.securityZoneCheckin({
67
60
  qrCode: "<value>",
68
- zoneId: 679291,
61
+ zoneId: 997849,
69
62
  });
70
63
  expect(result).toBeDefined();
71
64
  expect(result).toEqual({});
@@ -60,6 +60,43 @@ import { Result } from "../types/fp.js";
60
60
  * 3. Site redirects to your selected `return_url`
61
61
  * 4. The `user_token` will be appended as a query string parameter to your `return_url` - you must parse this token and store it
62
62
  * 5. Fetch the user object from `/users/me` using the token
63
+ *
64
+ * ## Finishing a "Login with Green Security" flow
65
+ *
66
+ * Green Security is also a SAML2 **identity provider**. When a third-party service provider sends a user to
67
+ * `/saml/idp/sso` to sign in with their Green Security account, the user lands on a Green Security login screen
68
+ * carrying an `sso_state` query string parameter. That parameter is a signed, five-minute record of which service
69
+ * provider is waiting, where its assertion consumer service lives, and what `RelayState` it sent.
70
+ *
71
+ * Authentication itself is unchanged - the user may still need a password, an MFA code, a magic link or a round trip
72
+ * to their own SAML IdP, and every `requires` value above applies as normal. The only difference is that you must
73
+ * echo `sso_state` back on **every** call in the sequence, unchanged, including the follow-up that carries the
74
+ * `mfa_code`.
75
+ *
76
+ * Each `202` response carries the verified blob back to you in its own top-level `sso_state` field. Send back the
77
+ * value from the response you just received rather than the one you started with. The two are normally the same
78
+ * string, but re-sending your original copy is how a blob the server has already rejected gets resent, and it forces
79
+ * you to hold login state you would otherwise not need.
80
+ *
81
+ * 1. Read `sso_state` from the query string of the login screen you were sent to
82
+ * 2. Run the login exactly as you would otherwise, adding `sso_state` to each request body and taking the value for
83
+ * the next request from the previous `202` response
84
+ * 3. On the `200` response, read `sso.continue_url`
85
+ * 4. Navigate the browser to `sso.continue_url` - a full page navigation, not a background fetch. It answers with a
86
+ * self-submitting form that delivers the signed `SAMLResponse` and the original `RelayState` to the service
87
+ * provider
88
+ * 5. The service provider validates the assertion and the user is signed in on their side
89
+ *
90
+ * On the `password_reset` leg the blob is **also** appended to `redirect_url` as a query parameter, alongside
91
+ * `return_url`. The browser follows that redirect and leaves the JSON body behind, so anything the remaining legs of
92
+ * the login still need has to ride the URL. Preserve the query string exactly as given.
93
+ *
94
+ * An invalid `sso_state` never fails a login. A forged, edited or expired blob is silently dropped and the request is
95
+ * then treated as an ordinary login, so valid credentials still return `200` - just with no `sso` object. Check for
96
+ * `sso` explicitly rather than reading `200` as proof the hand-off survived. When it is absent, do not retry with the
97
+ * same blob; the user has to start again from the service provider. See the
98
+ * [Login with Green Security](https://greensecurity.apidocumentation.com/guides/sso-login-with-green-security)
99
+ * guide for the service provider half of this flow.
63
100
  */
64
101
  export function usersPostAuthenticate(
65
102
  client: GreenSecurityCore,
package/src/lib/config.ts CHANGED
@@ -80,8 +80,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
80
80
  export const SDK_METADATA = {
81
81
  language: "typescript",
82
82
  openapiDocVersion: "0.45.0",
83
- sdkVersion: "0.45.0-beta.16",
83
+ sdkVersion: "0.45.0-beta.18",
84
84
  genVersion: "2.935.1",
85
85
  userAgent:
86
- "speakeasy-sdk/typescript 0.45.0-beta.16 2.935.1 0.45.0 @greensecurity/javascript-sdk",
86
+ "speakeasy-sdk/typescript 0.45.0-beta.18 2.935.1 0.45.0 @greensecurity/javascript-sdk",
87
87
  } as const;
@@ -0,0 +1,189 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import * as openEnums from "../../types/enums.js";
9
+ import { OpenEnum } from "../../types/enums.js";
10
+ import { Result as SafeParseResult } from "../../types/fp.js";
11
+ import * as types from "../../types/primitives.js";
12
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
13
+ import { Company, Company$inboundSchema } from "./company.js";
14
+ import { Contact, Contact$inboundSchema } from "./contact.js";
15
+ import {
16
+ SsoContinuation,
17
+ SsoContinuation$inboundSchema,
18
+ } from "./ssocontinuation.js";
19
+ import { UserDetails, UserDetails$inboundSchema } from "./userdetails.js";
20
+ import { Vendor, Vendor$inboundSchema } from "./vendor.js";
21
+
22
+ /**
23
+ * A `permanent` user token can be used to access any API endpoint as the logged in user. A `one time` token is used to authenticate the user once.
24
+ */
25
+ export const AuthenticateSuccessResponseTokenType = {
26
+ Permanent: "permanent",
27
+ OneTime: "one time",
28
+ } as const;
29
+ /**
30
+ * A `permanent` user token can be used to access any API endpoint as the logged in user. A `one time` token is used to authenticate the user once.
31
+ */
32
+ export type AuthenticateSuccessResponseTokenType = OpenEnum<
33
+ typeof AuthenticateSuccessResponseTokenType
34
+ >;
35
+
36
+ export type AuthenticateSuccessResponseUserToken = {
37
+ /**
38
+ * This token can be passed in authorization headers for this user.
39
+ */
40
+ token: string;
41
+ /**
42
+ * A `permanent` user token can be used to access any API endpoint as the logged in user. A `one time` token is used to authenticate the user once.
43
+ */
44
+ tokenType: AuthenticateSuccessResponseTokenType;
45
+ };
46
+
47
+ export type AuthenticateSuccessResponseInventoryManager = {};
48
+
49
+ /**
50
+ * A completed login. Identical to the `User` object returned everywhere
51
+ *
52
+ * @remarks
53
+ * else, plus an `sso` object when the request carried a valid `sso_state`
54
+ * and the login therefore has a SAML flow waiting to be finished.
55
+ */
56
+ export type AuthenticateSuccessResponse = {
57
+ /**
58
+ * A `gatekeeper` is a special type of service user. This type of service user is assigned to Kiosks and Apps to verify Vendors using APIs that have some access to facility data.
59
+ */
60
+ isGatekeeper?: boolean | undefined;
61
+ success: boolean;
62
+ /**
63
+ * Core user profile fields returned by user detail and update endpoints.
64
+ */
65
+ user: UserDetails;
66
+ userToken: AuthenticateSuccessResponseUserToken;
67
+ /**
68
+ * Vendor details
69
+ */
70
+ vendor?: Vendor | undefined;
71
+ inventoryManager?: AuthenticateSuccessResponseInventoryManager | undefined;
72
+ /**
73
+ * This object represents a contact at the system or facility level. Use it to verify vendors, create appointments, or check in visitors.
74
+ */
75
+ contact?: Contact | null | undefined;
76
+ /**
77
+ * A simplified representation of a Company, typically used in list views.
78
+ */
79
+ company?: Company | null | undefined;
80
+ /**
81
+ * Where to send the browser to finish a "Login with Green Security" flow.
82
+ *
83
+ * @remarks
84
+ *
85
+ * Present on a `200` from `POST /users/authenticate` only when the request
86
+ * carried a valid, unexpired `sso_state`. Its absence means the login
87
+ * succeeded but the SAML flow did not resume — treat the login as an
88
+ * ordinary one rather than retrying.
89
+ *
90
+ * This object is additive. The login itself is unaffected by it: the
91
+ * caller's own permanent token is in `user_token` exactly as it would be on
92
+ * any other successful authentication, and it is not the token embedded in
93
+ * `continue_url`.
94
+ */
95
+ sso?: SsoContinuation | undefined;
96
+ };
97
+
98
+ /** @internal */
99
+ export const AuthenticateSuccessResponseTokenType$inboundSchema: z.ZodType<
100
+ AuthenticateSuccessResponseTokenType,
101
+ z.ZodTypeDef,
102
+ unknown
103
+ > = openEnums.inboundSchema(AuthenticateSuccessResponseTokenType);
104
+
105
+ /** @internal */
106
+ export const AuthenticateSuccessResponseUserToken$inboundSchema: z.ZodType<
107
+ AuthenticateSuccessResponseUserToken,
108
+ z.ZodTypeDef,
109
+ unknown
110
+ > = z.object({
111
+ token: types.string(),
112
+ token_type: AuthenticateSuccessResponseTokenType$inboundSchema.default(
113
+ "permanent",
114
+ ),
115
+ }).transform((v) => {
116
+ return remap$(v, {
117
+ "token_type": "tokenType",
118
+ });
119
+ });
120
+
121
+ export function authenticateSuccessResponseUserTokenFromJSON(
122
+ jsonString: string,
123
+ ): SafeParseResult<AuthenticateSuccessResponseUserToken, SDKValidationError> {
124
+ return safeParse(
125
+ jsonString,
126
+ (x) =>
127
+ AuthenticateSuccessResponseUserToken$inboundSchema.parse(JSON.parse(x)),
128
+ `Failed to parse 'AuthenticateSuccessResponseUserToken' from JSON`,
129
+ );
130
+ }
131
+
132
+ /** @internal */
133
+ export const AuthenticateSuccessResponseInventoryManager$inboundSchema:
134
+ z.ZodType<
135
+ AuthenticateSuccessResponseInventoryManager,
136
+ z.ZodTypeDef,
137
+ unknown
138
+ > = z.object({});
139
+
140
+ export function authenticateSuccessResponseInventoryManagerFromJSON(
141
+ jsonString: string,
142
+ ): SafeParseResult<
143
+ AuthenticateSuccessResponseInventoryManager,
144
+ SDKValidationError
145
+ > {
146
+ return safeParse(
147
+ jsonString,
148
+ (x) =>
149
+ AuthenticateSuccessResponseInventoryManager$inboundSchema.parse(
150
+ JSON.parse(x),
151
+ ),
152
+ `Failed to parse 'AuthenticateSuccessResponseInventoryManager' from JSON`,
153
+ );
154
+ }
155
+
156
+ /** @internal */
157
+ export const AuthenticateSuccessResponse$inboundSchema: z.ZodType<
158
+ AuthenticateSuccessResponse,
159
+ z.ZodTypeDef,
160
+ unknown
161
+ > = z.object({
162
+ is_gatekeeper: types.optional(types.boolean()),
163
+ success: types.boolean(),
164
+ user: UserDetails$inboundSchema,
165
+ user_token: z.lazy(() => AuthenticateSuccessResponseUserToken$inboundSchema),
166
+ vendor: types.optional(Vendor$inboundSchema),
167
+ inventory_manager: types.optional(
168
+ z.lazy(() => AuthenticateSuccessResponseInventoryManager$inboundSchema),
169
+ ),
170
+ contact: z.nullable(Contact$inboundSchema).optional(),
171
+ company: z.nullable(Company$inboundSchema).optional(),
172
+ sso: types.optional(SsoContinuation$inboundSchema),
173
+ }).transform((v) => {
174
+ return remap$(v, {
175
+ "is_gatekeeper": "isGatekeeper",
176
+ "user_token": "userToken",
177
+ "inventory_manager": "inventoryManager",
178
+ });
179
+ });
180
+
181
+ export function authenticateSuccessResponseFromJSON(
182
+ jsonString: string,
183
+ ): SafeParseResult<AuthenticateSuccessResponse, SDKValidationError> {
184
+ return safeParse(
185
+ jsonString,
186
+ (x) => AuthenticateSuccessResponse$inboundSchema.parse(JSON.parse(x)),
187
+ `Failed to parse 'AuthenticateSuccessResponse' from JSON`,
188
+ );
189
+ }
@@ -5,6 +5,7 @@
5
5
  export * from "./activestatus.js";
6
6
  export * from "./alert.js";
7
7
  export * from "./appointmentsummary.js";
8
+ export * from "./authenticatesuccessresponse.js";
8
9
  export * from "./backgroundcheckresult.js";
9
10
  export * from "./company.js";
10
11
  export * from "./companycredentiallistitem.js";
@@ -89,6 +90,7 @@ export * from "./screeningansweractionsummary.js";
89
90
  export * from "./screeningquestion.js";
90
91
  export * from "./screeningresponse.js";
91
92
  export * from "./security.js";
93
+ export * from "./ssocontinuation.js";
92
94
  export * from "./standingappointment.js";
93
95
  export * from "./state.js";
94
96
  export * from "./subscription.js";
@@ -21,6 +21,39 @@ export type LoginEmailAndPassword = {
21
21
  * Password as entered by the user
22
22
  */
23
23
  password: string;
24
+ /**
25
+ * Opaque, signed state that Green Security issues when a third-party service
26
+ *
27
+ * @remarks
28
+ * provider starts a "Login with Green Security" SAML flow at
29
+ * `/saml/idp/sso`. The login screen receives it as the `sso_state` query
30
+ * string parameter and must pass it back, byte for byte, on every call to
31
+ * this endpoint for the remainder of the login journey — including the
32
+ * second call that carries an `mfa_code`.
33
+ *
34
+ * The blob is signed, not encrypted, and it expires five minutes after the
35
+ * service provider's request arrives. Do not parse it, shorten it, decode
36
+ * it, or re-encode it.
37
+ *
38
+ * **An invalid blob does not fail the login.** This is the opposite of what
39
+ * most integrators assume, so it is worth stating plainly: a forged, edited
40
+ * or expired `sso_state` is silently discarded, and the request then
41
+ * proceeds as an ordinary login. Valid credentials still authenticate and
42
+ * still return `200` — just with no `sso` object, leaving the user signed in
43
+ * to Green Security with no way back to the service provider that sent them.
44
+ * Never treat a `200` as proof that the SSO hand-off survived; check for
45
+ * `sso` explicitly.
46
+ *
47
+ * Every `202` response echoes the *verified* blob back in its own
48
+ * `sso_state` field. Always send back the value from the response you just
49
+ * received rather than the one you started with, so that a blob the server
50
+ * has already rejected is never resent, and so a client does not have to
51
+ * hold state of its own across the login journey.
52
+ *
53
+ * Omit this field entirely for an ordinary login that did not originate
54
+ * from a service provider.
55
+ */
56
+ ssoState?: string | undefined;
24
57
  };
25
58
 
26
59
  /** @internal */
@@ -28,6 +61,7 @@ export type LoginEmailAndPassword$Outbound = {
28
61
  email: string;
29
62
  mfa_code?: string | undefined;
30
63
  password: string;
64
+ sso_state?: string | undefined;
31
65
  };
32
66
 
33
67
  /** @internal */
@@ -39,9 +73,11 @@ export const LoginEmailAndPassword$outboundSchema: z.ZodType<
39
73
  email: z.string(),
40
74
  mfaCode: z.string().optional(),
41
75
  password: z.string(),
76
+ ssoState: z.string().optional(),
42
77
  }).transform((v) => {
43
78
  return remap$(v, {
44
79
  mfaCode: "mfa_code",
80
+ ssoState: "sso_state",
45
81
  });
46
82
  });
47
83
 
@@ -17,12 +17,46 @@ export type LoginRequirementsFromEmail = {
17
17
  * A proper URI where the user should be sent after completing a SAML login. This is encoded into the response you will get if the user requires a SAML login.
18
18
  */
19
19
  returnUrl: string;
20
+ /**
21
+ * Opaque, signed state that Green Security issues when a third-party service
22
+ *
23
+ * @remarks
24
+ * provider starts a "Login with Green Security" SAML flow at
25
+ * `/saml/idp/sso`. The login screen receives it as the `sso_state` query
26
+ * string parameter and must pass it back, byte for byte, on every call to
27
+ * this endpoint for the remainder of the login journey — including the
28
+ * second call that carries an `mfa_code`.
29
+ *
30
+ * The blob is signed, not encrypted, and it expires five minutes after the
31
+ * service provider's request arrives. Do not parse it, shorten it, decode
32
+ * it, or re-encode it.
33
+ *
34
+ * **An invalid blob does not fail the login.** This is the opposite of what
35
+ * most integrators assume, so it is worth stating plainly: a forged, edited
36
+ * or expired `sso_state` is silently discarded, and the request then
37
+ * proceeds as an ordinary login. Valid credentials still authenticate and
38
+ * still return `200` — just with no `sso` object, leaving the user signed in
39
+ * to Green Security with no way back to the service provider that sent them.
40
+ * Never treat a `200` as proof that the SSO hand-off survived; check for
41
+ * `sso` explicitly.
42
+ *
43
+ * Every `202` response echoes the *verified* blob back in its own
44
+ * `sso_state` field. Always send back the value from the response you just
45
+ * received rather than the one you started with, so that a blob the server
46
+ * has already rejected is never resent, and so a client does not have to
47
+ * hold state of its own across the login journey.
48
+ *
49
+ * Omit this field entirely for an ordinary login that did not originate
50
+ * from a service provider.
51
+ */
52
+ ssoState?: string | undefined;
20
53
  };
21
54
 
22
55
  /** @internal */
23
56
  export type LoginRequirementsFromEmail$Outbound = {
24
57
  email: string;
25
58
  return_url: string;
59
+ sso_state?: string | undefined;
26
60
  };
27
61
 
28
62
  /** @internal */
@@ -33,9 +67,11 @@ export const LoginRequirementsFromEmail$outboundSchema: z.ZodType<
33
67
  > = z.object({
34
68
  email: z.string(),
35
69
  returnUrl: z.string(),
70
+ ssoState: z.string().optional(),
36
71
  }).transform((v) => {
37
72
  return remap$(v, {
38
73
  returnUrl: "return_url",
74
+ ssoState: "sso_state",
39
75
  });
40
76
  });
41
77
 
@@ -36,6 +36,39 @@ export type MfaRequiredResponse = {
36
36
  */
37
37
  mobilePhone?: string | undefined;
38
38
  mfaMethod?: MfaMethod | undefined;
39
+ /**
40
+ * Opaque, signed state that Green Security issues when a third-party service
41
+ *
42
+ * @remarks
43
+ * provider starts a "Login with Green Security" SAML flow at
44
+ * `/saml/idp/sso`. The login screen receives it as the `sso_state` query
45
+ * string parameter and must pass it back, byte for byte, on every call to
46
+ * this endpoint for the remainder of the login journey — including the
47
+ * second call that carries an `mfa_code`.
48
+ *
49
+ * The blob is signed, not encrypted, and it expires five minutes after the
50
+ * service provider's request arrives. Do not parse it, shorten it, decode
51
+ * it, or re-encode it.
52
+ *
53
+ * **An invalid blob does not fail the login.** This is the opposite of what
54
+ * most integrators assume, so it is worth stating plainly: a forged, edited
55
+ * or expired `sso_state` is silently discarded, and the request then
56
+ * proceeds as an ordinary login. Valid credentials still authenticate and
57
+ * still return `200` — just with no `sso` object, leaving the user signed in
58
+ * to Green Security with no way back to the service provider that sent them.
59
+ * Never treat a `200` as proof that the SSO hand-off survived; check for
60
+ * `sso` explicitly.
61
+ *
62
+ * Every `202` response echoes the *verified* blob back in its own
63
+ * `sso_state` field. Always send back the value from the response you just
64
+ * received rather than the one you started with, so that a blob the server
65
+ * has already rejected is never resent, and so a client does not have to
66
+ * hold state of its own across the login journey.
67
+ *
68
+ * Omit this field entirely for an ordinary login that did not originate
69
+ * from a service provider.
70
+ */
71
+ ssoState?: string | undefined;
39
72
  };
40
73
 
41
74
  /** @internal */
@@ -56,10 +89,12 @@ export const MfaRequiredResponse$inboundSchema: z.ZodType<
56
89
  error: types.string(),
57
90
  mobile_phone: types.optional(types.string()),
58
91
  mfa_method: types.optional(MfaMethod$inboundSchema),
92
+ sso_state: types.optional(types.string()),
59
93
  }).transform((v) => {
60
94
  return remap$(v, {
61
95
  "mobile_phone": "mobilePhone",
62
96
  "mfa_method": "mfaMethod",
97
+ "sso_state": "ssoState",
63
98
  });
64
99
  });
65
100