@greensecurity/javascript-sdk 0.45.0-beta.16 → 0.45.0-beta.17
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.
- package/dist/commonjs/__tests__/vendors.test.js +1 -1
- package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
- package/dist/commonjs/__tests__/webhooks.test.js +1 -1
- package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
- package/dist/commonjs/__tests__/zones.test.js +2 -9
- package/dist/commonjs/__tests__/zones.test.js.map +1 -1
- package/dist/commonjs/funcs/usersPostAuthenticate.d.ts +37 -0
- package/dist/commonjs/funcs/usersPostAuthenticate.d.ts.map +1 -1
- package/dist/commonjs/funcs/usersPostAuthenticate.js +37 -0
- package/dist/commonjs/funcs/usersPostAuthenticate.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/components/authenticatesuccessresponse.d.ts +91 -0
- package/dist/commonjs/models/components/authenticatesuccessresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/authenticatesuccessresponse.js +100 -0
- package/dist/commonjs/models/components/authenticatesuccessresponse.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +2 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +2 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/loginemailandpassword.d.ts +34 -0
- package/dist/commonjs/models/components/loginemailandpassword.d.ts.map +1 -1
- package/dist/commonjs/models/components/loginemailandpassword.js +2 -0
- package/dist/commonjs/models/components/loginemailandpassword.js.map +1 -1
- package/dist/commonjs/models/components/loginrequirementsfromemail.d.ts +34 -0
- package/dist/commonjs/models/components/loginrequirementsfromemail.d.ts.map +1 -1
- package/dist/commonjs/models/components/loginrequirementsfromemail.js +2 -0
- package/dist/commonjs/models/components/loginrequirementsfromemail.js.map +1 -1
- package/dist/commonjs/models/components/mfarequiredresponse.d.ts +33 -0
- package/dist/commonjs/models/components/mfarequiredresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/mfarequiredresponse.js +2 -0
- package/dist/commonjs/models/components/mfarequiredresponse.js.map +1 -1
- package/dist/commonjs/models/components/passwordnotsetresponse.d.ts +34 -1
- package/dist/commonjs/models/components/passwordnotsetresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/passwordnotsetresponse.js +2 -0
- package/dist/commonjs/models/components/passwordnotsetresponse.js.map +1 -1
- package/dist/commonjs/models/components/passwordrequiredresponse.d.ts +33 -0
- package/dist/commonjs/models/components/passwordrequiredresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/passwordrequiredresponse.js +6 -0
- package/dist/commonjs/models/components/passwordrequiredresponse.js.map +1 -1
- package/dist/commonjs/models/components/samlloginrequiredresponse.d.ts +33 -0
- package/dist/commonjs/models/components/samlloginrequiredresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/samlloginrequiredresponse.js +2 -0
- package/dist/commonjs/models/components/samlloginrequiredresponse.js.map +1 -1
- package/dist/commonjs/models/components/ssocontinuation.d.ts +44 -0
- package/dist/commonjs/models/components/ssocontinuation.d.ts.map +1 -0
- package/dist/commonjs/models/components/ssocontinuation.js +56 -0
- package/dist/commonjs/models/components/ssocontinuation.js.map +1 -0
- package/dist/commonjs/models/operations/postauthenticate.d.ts +1 -1
- package/dist/commonjs/models/operations/postauthenticate.d.ts.map +1 -1
- package/dist/commonjs/models/operations/postauthenticate.js +1 -1
- package/dist/commonjs/models/operations/postauthenticate.js.map +1 -1
- package/dist/commonjs/react-query/usersPostAuthenticate.d.ts +37 -0
- package/dist/commonjs/react-query/usersPostAuthenticate.d.ts.map +1 -1
- package/dist/commonjs/react-query/usersPostAuthenticate.js +37 -0
- package/dist/commonjs/react-query/usersPostAuthenticate.js.map +1 -1
- package/dist/commonjs/sdk/users.d.ts +37 -0
- package/dist/commonjs/sdk/users.d.ts.map +1 -1
- package/dist/commonjs/sdk/users.js +37 -0
- package/dist/commonjs/sdk/users.js.map +1 -1
- package/dist/esm/__tests__/vendors.test.js +1 -1
- package/dist/esm/__tests__/vendors.test.js.map +1 -1
- package/dist/esm/__tests__/webhooks.test.js +1 -1
- package/dist/esm/__tests__/webhooks.test.js.map +1 -1
- package/dist/esm/__tests__/zones.test.js +2 -9
- package/dist/esm/__tests__/zones.test.js.map +1 -1
- package/dist/esm/funcs/usersPostAuthenticate.d.ts +37 -0
- package/dist/esm/funcs/usersPostAuthenticate.d.ts.map +1 -1
- package/dist/esm/funcs/usersPostAuthenticate.js +37 -0
- package/dist/esm/funcs/usersPostAuthenticate.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/components/authenticatesuccessresponse.d.ts +91 -0
- package/dist/esm/models/components/authenticatesuccessresponse.d.ts.map +1 -0
- package/dist/esm/models/components/authenticatesuccessresponse.js +61 -0
- package/dist/esm/models/components/authenticatesuccessresponse.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +2 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +2 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/loginemailandpassword.d.ts +34 -0
- package/dist/esm/models/components/loginemailandpassword.d.ts.map +1 -1
- package/dist/esm/models/components/loginemailandpassword.js +2 -0
- package/dist/esm/models/components/loginemailandpassword.js.map +1 -1
- package/dist/esm/models/components/loginrequirementsfromemail.d.ts +34 -0
- package/dist/esm/models/components/loginrequirementsfromemail.d.ts.map +1 -1
- package/dist/esm/models/components/loginrequirementsfromemail.js +2 -0
- package/dist/esm/models/components/loginrequirementsfromemail.js.map +1 -1
- package/dist/esm/models/components/mfarequiredresponse.d.ts +33 -0
- package/dist/esm/models/components/mfarequiredresponse.d.ts.map +1 -1
- package/dist/esm/models/components/mfarequiredresponse.js +2 -0
- package/dist/esm/models/components/mfarequiredresponse.js.map +1 -1
- package/dist/esm/models/components/passwordnotsetresponse.d.ts +34 -1
- package/dist/esm/models/components/passwordnotsetresponse.d.ts.map +1 -1
- package/dist/esm/models/components/passwordnotsetresponse.js +2 -0
- package/dist/esm/models/components/passwordnotsetresponse.js.map +1 -1
- package/dist/esm/models/components/passwordrequiredresponse.d.ts +33 -0
- package/dist/esm/models/components/passwordrequiredresponse.d.ts.map +1 -1
- package/dist/esm/models/components/passwordrequiredresponse.js +6 -0
- package/dist/esm/models/components/passwordrequiredresponse.js.map +1 -1
- package/dist/esm/models/components/samlloginrequiredresponse.d.ts +33 -0
- package/dist/esm/models/components/samlloginrequiredresponse.d.ts.map +1 -1
- package/dist/esm/models/components/samlloginrequiredresponse.js +2 -0
- package/dist/esm/models/components/samlloginrequiredresponse.js.map +1 -1
- package/dist/esm/models/components/ssocontinuation.d.ts +44 -0
- package/dist/esm/models/components/ssocontinuation.d.ts.map +1 -0
- package/dist/esm/models/components/ssocontinuation.js +19 -0
- package/dist/esm/models/components/ssocontinuation.js.map +1 -0
- package/dist/esm/models/operations/postauthenticate.d.ts +1 -1
- package/dist/esm/models/operations/postauthenticate.d.ts.map +1 -1
- package/dist/esm/models/operations/postauthenticate.js +1 -1
- package/dist/esm/models/operations/postauthenticate.js.map +1 -1
- package/dist/esm/react-query/usersPostAuthenticate.d.ts +37 -0
- package/dist/esm/react-query/usersPostAuthenticate.d.ts.map +1 -1
- package/dist/esm/react-query/usersPostAuthenticate.js +37 -0
- package/dist/esm/react-query/usersPostAuthenticate.js.map +1 -1
- package/dist/esm/sdk/users.d.ts +37 -0
- package/dist/esm/sdk/users.d.ts.map +1 -1
- package/dist/esm/sdk/users.js +37 -0
- package/dist/esm/sdk/users.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/vendors.test.ts +1 -1
- package/src/__tests__/webhooks.test.ts +1 -1
- package/src/__tests__/zones.test.ts +2 -9
- package/src/funcs/usersPostAuthenticate.ts +37 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/authenticatesuccessresponse.ts +189 -0
- package/src/models/components/index.ts +2 -0
- package/src/models/components/loginemailandpassword.ts +36 -0
- package/src/models/components/loginrequirementsfromemail.ts +36 -0
- package/src/models/components/mfarequiredresponse.ts +35 -0
- package/src/models/components/passwordnotsetresponse.ts +36 -1
- package/src/models/components/passwordrequiredresponse.ts +39 -0
- package/src/models/components/samlloginrequiredresponse.ts +35 -0
- package/src/models/components/ssocontinuation.ts +71 -0
- package/src/models/operations/postauthenticate.ts +2 -2
- package/src/react-query/usersPostAuthenticate.ts +37 -0
- package/src/sdk/users.ts +37 -0
package/src/sdk/users.ts
CHANGED
|
@@ -148,6 +148,43 @@ export class Users extends ClientSDK {
|
|
|
148
148
|
* 3. Site redirects to your selected `return_url`
|
|
149
149
|
* 4. The `user_token` will be appended as a query string parameter to your `return_url` - you must parse this token and store it
|
|
150
150
|
* 5. Fetch the user object from `/users/me` using the token
|
|
151
|
+
*
|
|
152
|
+
* ## Finishing a "Login with Green Security" flow
|
|
153
|
+
*
|
|
154
|
+
* Green Security is also a SAML2 **identity provider**. When a third-party service provider sends a user to
|
|
155
|
+
* `/saml/idp/sso` to sign in with their Green Security account, the user lands on a Green Security login screen
|
|
156
|
+
* carrying an `sso_state` query string parameter. That parameter is a signed, five-minute record of which service
|
|
157
|
+
* provider is waiting, where its assertion consumer service lives, and what `RelayState` it sent.
|
|
158
|
+
*
|
|
159
|
+
* Authentication itself is unchanged - the user may still need a password, an MFA code, a magic link or a round trip
|
|
160
|
+
* to their own SAML IdP, and every `requires` value above applies as normal. The only difference is that you must
|
|
161
|
+
* echo `sso_state` back on **every** call in the sequence, unchanged, including the follow-up that carries the
|
|
162
|
+
* `mfa_code`.
|
|
163
|
+
*
|
|
164
|
+
* Each `202` response carries the verified blob back to you in its own top-level `sso_state` field. Send back the
|
|
165
|
+
* value from the response you just received rather than the one you started with. The two are normally the same
|
|
166
|
+
* string, but re-sending your original copy is how a blob the server has already rejected gets resent, and it forces
|
|
167
|
+
* you to hold login state you would otherwise not need.
|
|
168
|
+
*
|
|
169
|
+
* 1. Read `sso_state` from the query string of the login screen you were sent to
|
|
170
|
+
* 2. Run the login exactly as you would otherwise, adding `sso_state` to each request body and taking the value for
|
|
171
|
+
* the next request from the previous `202` response
|
|
172
|
+
* 3. On the `200` response, read `sso.continue_url`
|
|
173
|
+
* 4. Navigate the browser to `sso.continue_url` - a full page navigation, not a background fetch. It answers with a
|
|
174
|
+
* self-submitting form that delivers the signed `SAMLResponse` and the original `RelayState` to the service
|
|
175
|
+
* provider
|
|
176
|
+
* 5. The service provider validates the assertion and the user is signed in on their side
|
|
177
|
+
*
|
|
178
|
+
* On the `password_reset` leg the blob is **also** appended to `redirect_url` as a query parameter, alongside
|
|
179
|
+
* `return_url`. The browser follows that redirect and leaves the JSON body behind, so anything the remaining legs of
|
|
180
|
+
* the login still need has to ride the URL. Preserve the query string exactly as given.
|
|
181
|
+
*
|
|
182
|
+
* An invalid `sso_state` never fails a login. A forged, edited or expired blob is silently dropped and the request is
|
|
183
|
+
* then treated as an ordinary login, so valid credentials still return `200` - just with no `sso` object. Check for
|
|
184
|
+
* `sso` explicitly rather than reading `200` as proof the hand-off survived. When it is absent, do not retry with the
|
|
185
|
+
* same blob; the user has to start again from the service provider. See the
|
|
186
|
+
* [Login with Green Security](https://greensecurity.apidocumentation.com/guides/sso-login-with-green-security)
|
|
187
|
+
* guide for the service provider half of this flow.
|
|
151
188
|
*/
|
|
152
189
|
async postAuthenticate(
|
|
153
190
|
request: operations.PostAuthenticateRequestBody,
|