stytch 9.11.1 → 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stytch/b2b_client.rb +21 -4
- data/lib/stytch/b2b_discovery.rb +1 -1
- data/lib/stytch/b2b_magic_links.rb +1 -2
- data/lib/stytch/b2b_oauth.rb +1 -1
- data/lib/stytch/b2b_passwords.rb +13 -2
- data/lib/stytch/b2b_rbac.rb +2 -2
- data/lib/stytch/b2b_scim.rb +1 -1
- data/lib/stytch/b2b_sessions.rb +1 -1
- data/lib/stytch/b2b_sso.rb +1 -2
- data/lib/stytch/client.rb +21 -4
- data/lib/stytch/fraud.rb +190 -0
- data/lib/stytch/magic_links.rb +1 -1
- data/lib/stytch/oauth.rb +1 -1
- data/lib/stytch/passwords.rb +2 -2
- data/lib/stytch/sessions.rb +1 -1
- data/lib/stytch/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce6f59d89c33b808bfe32aad54d9d6875c6f20a75ad7d3a5540c7a39d0e4c8d5
|
4
|
+
data.tar.gz: 5dc596aa605508971900fb720bdbb945ca5767b2778038e78941c340ef516222
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b897c6d6f047534dfb93bb22feecfb6823fe3cfbf70a2e6b55d24b90e77c9f5868f45f143f1df3f1a013afd66d4e3f1e1d60212aab432b7a21838632abead94d
|
7
|
+
data.tar.gz: 11b5803a85782493d2f66e10744cec74a48679931d79600a9ed1b1ae59873caebc1a0634582c7a74daaae630ef9d0adfb16e5d04b1e99bbf24ba38d39508f36f
|
data/lib/stytch/b2b_client.rb
CHANGED
@@ -12,6 +12,7 @@ require_relative 'b2b_scim'
|
|
12
12
|
require_relative 'b2b_sessions'
|
13
13
|
require_relative 'b2b_sso'
|
14
14
|
require_relative 'b2b_totps'
|
15
|
+
require_relative 'fraud'
|
15
16
|
require_relative 'm2m'
|
16
17
|
require_relative 'project'
|
17
18
|
require_relative 'rbac_local'
|
@@ -20,12 +21,13 @@ module StytchB2B
|
|
20
21
|
class Client
|
21
22
|
ENVIRONMENTS = %i[live test].freeze
|
22
23
|
|
23
|
-
attr_reader :discovery, :m2m, :magic_links, :oauth, :otps, :organizations, :passwords, :project, :rbac, :recovery_codes, :scim, :sso, :sessions, :totps
|
24
|
+
attr_reader :discovery, :fraud, :m2m, :magic_links, :oauth, :otps, :organizations, :passwords, :project, :rbac, :recovery_codes, :scim, :sso, :sessions, :totps
|
24
25
|
|
25
|
-
def initialize(project_id:, secret:, env: nil, &block)
|
26
|
-
@api_host
|
26
|
+
def initialize(project_id:, secret:, env: nil, fraud_env: nil, &block)
|
27
|
+
@api_host = api_host(env, project_id)
|
28
|
+
@fraud_api_host = fraud_api_host(fraud_env)
|
27
29
|
@project_id = project_id
|
28
|
-
@secret
|
30
|
+
@secret = secret
|
29
31
|
@is_b2b_client = true
|
30
32
|
|
31
33
|
create_connection(&block)
|
@@ -34,6 +36,7 @@ module StytchB2B
|
|
34
36
|
@policy_cache = StytchB2B::PolicyCache.new(rbac_client: rbac)
|
35
37
|
|
36
38
|
@discovery = StytchB2B::Discovery.new(@connection)
|
39
|
+
@fraud = Stytch::Fraud.new(@fraud_connection)
|
37
40
|
@m2m = Stytch::M2M.new(@connection, @project_id, @is_b2b_client)
|
38
41
|
@magic_links = StytchB2B::MagicLinks.new(@connection)
|
39
42
|
@oauth = StytchB2B::OAuth.new(@connection)
|
@@ -69,11 +72,25 @@ module StytchB2B
|
|
69
72
|
end
|
70
73
|
end
|
71
74
|
|
75
|
+
def fraud_api_host(fraud_env)
|
76
|
+
case fraud_env
|
77
|
+
when %r{\Ahttps?://}
|
78
|
+
# If this is a string that looks like a URL, assume it's an internal development URL.
|
79
|
+
fraud_env
|
80
|
+
else
|
81
|
+
'https://telemetry.stytch.com'
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
72
85
|
def create_connection
|
73
86
|
@connection = Faraday.new(url: @api_host) do |builder|
|
74
87
|
block_given? ? yield(builder) : build_default_connection(builder)
|
75
88
|
end
|
89
|
+
@fraud_connection = Faraday.new(url: @fraud_api_host) do |builder|
|
90
|
+
block_given? ? yield(builder) : build_default_connection(builder)
|
91
|
+
end
|
76
92
|
@connection.set_basic_auth(@project_id, @secret)
|
93
|
+
@fraud_connection.set_basic_auth(@project_id, @secret)
|
77
94
|
end
|
78
95
|
|
79
96
|
def build_default_connection(builder)
|
data/lib/stytch/b2b_discovery.rb
CHANGED
@@ -370,7 +370,7 @@ module StytchB2B
|
|
370
370
|
# will be returned, and any membership can be assumed by calling the [Exchange Session](https://stytch.com/docs/b2b/api/exchange-session) endpoint.
|
371
371
|
#
|
372
372
|
# When an Intermediate Session is passed in, all relationship types - `active_member`, `pending_member`, `invited_member`,
|
373
|
-
# and `
|
373
|
+
# `eligible_to_join_by_email_domain`, and `eligible_to_join_by_oauth_tenant` - will be returned,
|
374
374
|
# and any membership can be assumed by calling the [Exchange Intermediate Session](https://stytch.com/docs/b2b/api/exchange-intermediate-session) endpoint.
|
375
375
|
#
|
376
376
|
# This endpoint requires either an `intermediate_session_token`, `session_jwt` or `session_token` be included in the request.
|
@@ -92,8 +92,7 @@ module StytchB2B
|
|
92
92
|
# The email or device involved in the authentication.
|
93
93
|
# The type of this field is +String+.
|
94
94
|
# reset_sessions::
|
95
|
-
#
|
96
|
-
# Stytch's Session product. If you are using Stytch's Session product, we revoke the Member’s other Sessions for you.
|
95
|
+
# This field is deprecated.
|
97
96
|
# The type of this field is +Boolean+.
|
98
97
|
# organization_id::
|
99
98
|
# Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
|
data/lib/stytch/b2b_oauth.rb
CHANGED
@@ -108,7 +108,7 @@ module StytchB2B
|
|
108
108
|
# The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
|
109
109
|
# The type of this field is +Organization+ (+object+).
|
110
110
|
# reset_sessions::
|
111
|
-
#
|
111
|
+
# This field is deprecated.
|
112
112
|
# The type of this field is +Boolean+.
|
113
113
|
# member_authenticated::
|
114
114
|
# Indicates whether the Member is fully authenticated. If false, the Member needs to complete an MFA step to log in to the Organization.
|
data/lib/stytch/b2b_passwords.rb
CHANGED
@@ -1032,10 +1032,21 @@ module StytchB2B
|
|
1032
1032
|
# The returned Intermediate Session Token contains a password factor associated with the Member. If this value is non-empty, the member must complete an MFA step to finish logging in to the Organization. The token can be used with the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms), [TOTP Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-totp), or [Recovery Codes Recover endpoint](https://stytch.com/docs/b2b/api/recovery-codes-recover) to complete an MFA flow and log in to the Organization. Password factors are not transferable between Organizations, so the intermediate session token is not valid for use with discovery endpoints.
|
1033
1033
|
# The type of this field is +String+.
|
1034
1034
|
# email_address::
|
1035
|
-
#
|
1035
|
+
# The email address.
|
1036
1036
|
# The type of this field is +String+.
|
1037
1037
|
# discovered_organizations::
|
1038
|
-
# (
|
1038
|
+
# An array of `discovered_organization` objects tied to the `intermediate_session_token`, `session_token`, or `session_jwt`. See the [Discovered Organization Object](https://stytch.com/docs/b2b/api/discovered-organization-object) for complete details.
|
1039
|
+
#
|
1040
|
+
# Note that Organizations will only appear here under any of the following conditions:
|
1041
|
+
# 1. The end user is already a Member of the Organization.
|
1042
|
+
# 2. The end user is invited to the Organization.
|
1043
|
+
# 3. The end user can join the Organization because:
|
1044
|
+
#
|
1045
|
+
# a) The Organization allows JIT provisioning.
|
1046
|
+
#
|
1047
|
+
# b) The Organizations' allowed domains list contains the Member's email domain.
|
1048
|
+
#
|
1049
|
+
# c) The Organization has at least one other Member with a verified email address with the same domain as the end user (to prevent phishing attacks).
|
1039
1050
|
# The type of this field is list of +DiscoveredOrganization+ (+object+).
|
1040
1051
|
# status_code::
|
1041
1052
|
# The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
|
data/lib/stytch/b2b_rbac.rb
CHANGED
@@ -20,7 +20,7 @@ module StytchB2B
|
|
20
20
|
#
|
21
21
|
# When using the backend SDKs, the RBAC Policy will be cached to allow for local evaluations, eliminating the need for an extra request to Stytch. The policy will be refreshed if an authorization check is requested and the RBAC policy was last updated more than 5 minutes ago.
|
22
22
|
#
|
23
|
-
# Resources and Roles can be created and managed within the [Dashboard](/dashboard/rbac). Additionally, [Role assignment](https://stytch.com/docs/b2b/guides/rbac/role-assignment) can be programmatically managed through certain Stytch API endpoints.
|
23
|
+
# Resources and Roles can be created and managed within the [Dashboard](https://stytch.com/docs/dashboard/rbac). Additionally, [Role assignment](https://stytch.com/docs/b2b/guides/rbac/role-assignment) can be programmatically managed through certain Stytch API endpoints.
|
24
24
|
#
|
25
25
|
# Check out the [RBAC overview](https://stytch.com/docs/b2b/guides/rbac/overview) to learn more about Stytch's RBAC permissioning model.
|
26
26
|
#
|
@@ -35,7 +35,7 @@ module StytchB2B
|
|
35
35
|
# The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
|
36
36
|
# The type of this field is +Integer+.
|
37
37
|
# policy::
|
38
|
-
# The RBAC Policy document that contains all defined Roles and Resources – which are managed in the [Dashboard](/dashboard/rbac). Read more about these entities and how they work in our [RBAC overview](https://stytch.com/docs/b2b/guides/rbac/overview).
|
38
|
+
# The RBAC Policy document that contains all defined Roles and Resources – which are managed in the [Dashboard](https://stytch.com/docs/dashboard/rbac). Read more about these entities and how they work in our [RBAC overview](https://stytch.com/docs/b2b/guides/rbac/overview).
|
39
39
|
# The type of this field is nilable +Policy+ (+object+).
|
40
40
|
def policy
|
41
41
|
headers = {}
|
data/lib/stytch/b2b_scim.rb
CHANGED
@@ -476,7 +476,7 @@ module StytchB2B
|
|
476
476
|
# The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
|
477
477
|
# The type of this field is +Integer+.
|
478
478
|
# connection::
|
479
|
-
# (
|
479
|
+
# A [SCIM Connection](https://stytch.com/docs/b2b/api/scim-connection-object) connection belonging to the organization (currently limited to one).
|
480
480
|
# The type of this field is nilable +SCIMConnection+ (+object+).
|
481
481
|
#
|
482
482
|
# == Method Options:
|
data/lib/stytch/b2b_sessions.rb
CHANGED
@@ -341,7 +341,7 @@ module StytchB2B
|
|
341
341
|
post_request('/v1/b2b/sessions/exchange', request, headers)
|
342
342
|
end
|
343
343
|
|
344
|
-
# Migrate a session from an external OIDC compliant endpoint. Stytch will call the external UserInfo endpoint defined in your Stytch Project settings in the [Dashboard](/dashboard), and then perform a lookup using the `session_token`. If the response contains a valid email address, Stytch will attempt to match that email address with an existing in your and create a Stytch Session. You will need to create the member before using this endpoint.
|
344
|
+
# Migrate a session from an external OIDC compliant endpoint. Stytch will call the external UserInfo endpoint defined in your Stytch Project settings in the [Dashboard](https://stytch.com/docs/dashboard), and then perform a lookup using the `session_token`. If the response contains a valid email address, Stytch will attempt to match that email address with an existing in your and create a Stytch Session. You will need to create the member before using this endpoint.
|
345
345
|
#
|
346
346
|
# == Parameters:
|
347
347
|
# session_token::
|
data/lib/stytch/b2b_sso.rb
CHANGED
@@ -210,8 +210,7 @@ module StytchB2B
|
|
210
210
|
# The JSON Web Token (JWT) for a given Stytch Session.
|
211
211
|
# The type of this field is +String+.
|
212
212
|
# reset_session::
|
213
|
-
#
|
214
|
-
# Stytch's Session product. If you are using Stytch's Session product, we revoke the Member’s other Sessions for you.
|
213
|
+
# This field is deprecated.
|
215
214
|
# The type of this field is +Boolean+.
|
216
215
|
# organization::
|
217
216
|
# The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
|
data/lib/stytch/client.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'crypto_wallets'
|
4
|
+
require_relative 'fraud'
|
4
5
|
require_relative 'm2m'
|
5
6
|
require_relative 'magic_links'
|
6
7
|
require_relative 'oauth'
|
@@ -16,17 +17,19 @@ module Stytch
|
|
16
17
|
class Client
|
17
18
|
ENVIRONMENTS = %i[live test].freeze
|
18
19
|
|
19
|
-
attr_reader :crypto_wallets, :m2m, :magic_links, :oauth, :otps, :passwords, :project, :sessions, :totps, :users, :webauthn
|
20
|
+
attr_reader :crypto_wallets, :fraud, :m2m, :magic_links, :oauth, :otps, :passwords, :project, :sessions, :totps, :users, :webauthn
|
20
21
|
|
21
|
-
def initialize(project_id:, secret:, env: nil, &block)
|
22
|
-
@api_host
|
22
|
+
def initialize(project_id:, secret:, env: nil, fraud_env: nil, &block)
|
23
|
+
@api_host = api_host(env, project_id)
|
24
|
+
@fraud_api_host = fraud_api_host(fraud_env)
|
23
25
|
@project_id = project_id
|
24
|
-
@secret
|
26
|
+
@secret = secret
|
25
27
|
@is_b2b_client = false
|
26
28
|
|
27
29
|
create_connection(&block)
|
28
30
|
|
29
31
|
@crypto_wallets = Stytch::CryptoWallets.new(@connection)
|
32
|
+
@fraud = Stytch::Fraud.new(@fraud_connection)
|
30
33
|
@m2m = Stytch::M2M.new(@connection, @project_id, @is_b2b_client)
|
31
34
|
@magic_links = Stytch::MagicLinks.new(@connection)
|
32
35
|
@oauth = Stytch::OAuth.new(@connection)
|
@@ -59,11 +62,25 @@ module Stytch
|
|
59
62
|
end
|
60
63
|
end
|
61
64
|
|
65
|
+
def fraud_api_host(fraud_env)
|
66
|
+
case fraud_env
|
67
|
+
when %r{\Ahttps?://}
|
68
|
+
# If this is a string that looks like a URL, assume it's an internal development URL.
|
69
|
+
fraud_env
|
70
|
+
else
|
71
|
+
'https://telemetry.stytch.com'
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
62
75
|
def create_connection
|
63
76
|
@connection = Faraday.new(url: @api_host) do |builder|
|
64
77
|
block_given? ? yield(builder) : build_default_connection(builder)
|
65
78
|
end
|
79
|
+
@fraud_connection = Faraday.new(url: @fraud_api_host) do |builder|
|
80
|
+
block_given? ? yield(builder) : build_default_connection(builder)
|
81
|
+
end
|
66
82
|
@connection.set_basic_auth(@project_id, @secret)
|
83
|
+
@fraud_connection.set_basic_auth(@project_id, @secret)
|
67
84
|
end
|
68
85
|
|
69
86
|
def build_default_connection(builder)
|
data/lib/stytch/fraud.rb
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# !!!
|
4
|
+
# WARNING: This file is autogenerated
|
5
|
+
# Only modify code within MANUAL() sections
|
6
|
+
# or your changes may be overwritten later!
|
7
|
+
# !!!
|
8
|
+
|
9
|
+
require_relative 'request_helper'
|
10
|
+
|
11
|
+
module Stytch
|
12
|
+
class Fraud
|
13
|
+
include Stytch::RequestHelper
|
14
|
+
attr_reader :fingerprint, :rules
|
15
|
+
|
16
|
+
def initialize(connection)
|
17
|
+
@connection = connection
|
18
|
+
|
19
|
+
@fingerprint = Stytch::Fraud::Fingerprint.new(@connection)
|
20
|
+
@rules = Stytch::Fraud::Rules.new(@connection)
|
21
|
+
end
|
22
|
+
|
23
|
+
class Fingerprint
|
24
|
+
include Stytch::RequestHelper
|
25
|
+
|
26
|
+
def initialize(connection)
|
27
|
+
@connection = connection
|
28
|
+
end
|
29
|
+
|
30
|
+
# Lookup the associated fingerprint for the `telemetry_id` returned from the `GetTelemetryID` function. Learn more about the different fingerprint types and verdicts in our [DFP guide](https://stytch.com/docs/fraud/guides/device-fingerprinting/overview).
|
31
|
+
#
|
32
|
+
# Make a decision based on the returned `verdict`:
|
33
|
+
# * `ALLOW` - This is a known valid device grouping or device profile that is part of the default `ALLOW` listed set of known devices by Stytch. This grouping is made up of verified device profiles that match the characteristics of known/authentic traffic origins.
|
34
|
+
# * `BLOCK` - This is a known bad or malicious device profile that is undesirable and should be blocked from completing the privileged action in question.
|
35
|
+
# * `CHALLENGE` - This is an unknown or potentially malicious device that should be put through increased friction such as 2FA or other forms of extended user verification before allowing the privileged action to proceed.
|
36
|
+
#
|
37
|
+
# If the `telemetry_id` is not found, we will return a 404 `telemetry_id_not_found` [error](https://stytch.com/docs/fraud/api/errors/404#telemetry_id_not_found). We recommend treating 404 errors as a `BLOCK`, since it could be a sign of an attacker trying to bypass DFP protections by generating fake telemetry IDs.
|
38
|
+
#
|
39
|
+
# == Parameters:
|
40
|
+
# telemetry_id::
|
41
|
+
# The telemetry ID associated with the fingerprint getting looked up.
|
42
|
+
# The type of this field is +String+.
|
43
|
+
# external_metadata::
|
44
|
+
# External identifiers that you wish to associate with the given telemetry ID. You will be able to search for fingerprint results by these identifiers in the DFP analytics dashboard. External metadata fields may not exceed 65 characters. They may only contain alphanumerics and the characters `_` `-` `+` `.` or `@`.
|
45
|
+
# The type of this field is nilable +Metadata+ (+object+).
|
46
|
+
#
|
47
|
+
# == Returns:
|
48
|
+
# An object with the following fields:
|
49
|
+
# request_id::
|
50
|
+
# Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
|
51
|
+
# The type of this field is +String+.
|
52
|
+
# telemetry_id::
|
53
|
+
# The telemetry ID associated with the fingerprint getting looked up.
|
54
|
+
# The type of this field is +String+.
|
55
|
+
# fingerprints::
|
56
|
+
# A Stytch fingerprint consists of the following identifiers:
|
57
|
+
# The type of this field is +Fingerprints+ (+object+).
|
58
|
+
# verdict::
|
59
|
+
# The metadata associated with each fingerprint
|
60
|
+
# The type of this field is +Verdict+ (+object+).
|
61
|
+
# external_metadata::
|
62
|
+
# External identifiers that you wish to associate with the given telemetry ID. You will be able to search for fingerprint results by these identifiers in the DFP analytics dashboard. External metadata fields may not exceed 65 characters. They may only contain alphanumerics and the characters `_` `-` `+` `.` or `@`.
|
63
|
+
# The type of this field is +Metadata+ (+object+).
|
64
|
+
# created_at::
|
65
|
+
# The time when the fingerprint was taken. Values conform to the RFC 3339 standard and are expressed in UTC, e.g. `2021-12-29T12:33:09Z`.
|
66
|
+
# The type of this field is +String+.
|
67
|
+
# expires_at::
|
68
|
+
# The timestamp when the fingerprint expires. Values conform to the RFC 3339 standard and are expressed in UTC, e.g. `2021-12-29T12:33:09Z`.
|
69
|
+
# The type of this field is +String+.
|
70
|
+
# status_code::
|
71
|
+
# The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
|
72
|
+
# The type of this field is +Integer+.
|
73
|
+
# properties::
|
74
|
+
# Additional information about the user's browser and network.
|
75
|
+
# The type of this field is nilable +Properties+ (+object+).
|
76
|
+
def lookup(
|
77
|
+
telemetry_id:,
|
78
|
+
external_metadata: nil
|
79
|
+
)
|
80
|
+
headers = {}
|
81
|
+
request = {
|
82
|
+
telemetry_id: telemetry_id
|
83
|
+
}
|
84
|
+
request[:external_metadata] = external_metadata unless external_metadata.nil?
|
85
|
+
|
86
|
+
post_request('/v1/fingerprint/lookup', request, headers)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
class Rules
|
91
|
+
include Stytch::RequestHelper
|
92
|
+
|
93
|
+
def initialize(connection)
|
94
|
+
@connection = connection
|
95
|
+
end
|
96
|
+
|
97
|
+
# Set a rule for a particular `visitor_id`, `browser_id`, `visitor_fingerprint`, `browser_fingerprint`, `hardware_fingerprint`, or `network_fingerprint`. This is helpful in cases where you want to allow or block a specific user or fingerprint. You should be careful when setting rules for `browser_fingerprint`, `hardware_fingerprint`, or `network_fingerprint` as they can be shared across multiple users, and you could affect more users than intended.
|
98
|
+
#
|
99
|
+
# Rules are applied in the order specified above. For example, if an end user has an `ALLOW` rule set for their `visitor_id` but a `BLOCK` rule set for their `hardware_fingerprint`, they will receive an `ALLOW` verdict because the `visitor_id` rule takes precedence.
|
100
|
+
#
|
101
|
+
# == Parameters:
|
102
|
+
# action::
|
103
|
+
# The action that should be returned by a fingerprint lookup for that fingerprint or ID with a `RULE_MATCH` reason. The following values are valid: `ALLOW`, `BLOCK`, `CHALLENGE`, or `NONE`. If a `NONE` action is specified, it will clear the stored rule.
|
104
|
+
# The type of this field is +RuleAction+ (string enum).
|
105
|
+
# visitor_id::
|
106
|
+
# The visitor ID we want to set a rule for. Only one fingerprint or ID can be specified in the request.
|
107
|
+
# The type of this field is nilable +String+.
|
108
|
+
# browser_id::
|
109
|
+
# The browser ID we want to set a rule for. Only one fingerprint or ID can be specified in the request.
|
110
|
+
# The type of this field is nilable +String+.
|
111
|
+
# visitor_fingerprint::
|
112
|
+
# The visitor fingerprint we want to set a rule for. Only one fingerprint or ID can be specified in the request.
|
113
|
+
# The type of this field is nilable +String+.
|
114
|
+
# browser_fingerprint::
|
115
|
+
# The browser fingerprint we want to set a rule for. Only one fingerprint or ID can be specified in the request.
|
116
|
+
# The type of this field is nilable +String+.
|
117
|
+
# hardware_fingerprint::
|
118
|
+
# The hardware fingerprint we want to set a rule for. Only one fingerprint or ID can be specified in the request.
|
119
|
+
# The type of this field is nilable +String+.
|
120
|
+
# network_fingerprint::
|
121
|
+
# The network fingerprint we want to set a rule for. Only one fingerprint or ID can be specified in the request.
|
122
|
+
# The type of this field is nilable +String+.
|
123
|
+
# expires_in_minutes::
|
124
|
+
# The number of minutes until this rule expires. If no `expires_in_minutes` is specified, then the rule is kept permanently.
|
125
|
+
# The type of this field is nilable +Integer+.
|
126
|
+
# description::
|
127
|
+
# An optional description for the rule.
|
128
|
+
# The type of this field is nilable +String+.
|
129
|
+
#
|
130
|
+
# == Returns:
|
131
|
+
# An object with the following fields:
|
132
|
+
# request_id::
|
133
|
+
# Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
|
134
|
+
# The type of this field is +String+.
|
135
|
+
# action::
|
136
|
+
# The action that will be returned for the specified fingerprint or ID.
|
137
|
+
# The type of this field is +RuleAction+ (string enum).
|
138
|
+
# status_code::
|
139
|
+
# The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
|
140
|
+
# The type of this field is +Integer+.
|
141
|
+
# visitor_id::
|
142
|
+
# The cookie stored on the user's device that uniquely identifies them.
|
143
|
+
# The type of this field is nilable +String+.
|
144
|
+
# browser_id::
|
145
|
+
# Combination of VisitorID and NetworkFingerprint to create a clear identifier of a browser.
|
146
|
+
# The type of this field is nilable +String+.
|
147
|
+
# visitor_fingerprint::
|
148
|
+
# Cookie-less way of identifying a unique user.
|
149
|
+
# The type of this field is nilable +String+.
|
150
|
+
# browser_fingerprint::
|
151
|
+
# Combination of signals to identify a browser and its specific version.
|
152
|
+
# The type of this field is nilable +String+.
|
153
|
+
# hardware_fingerprint::
|
154
|
+
# Combinations of signals to identify an operating system and architecture.
|
155
|
+
# The type of this field is nilable +String+.
|
156
|
+
# network_fingerprint::
|
157
|
+
# Combination of signals associated with a specific network commonly known as TLS fingerprinting.
|
158
|
+
# The type of this field is nilable +String+.
|
159
|
+
# expires_at::
|
160
|
+
# The timestamp when the rule expires. Values conform to the RFC 3339 standard and are expressed in UTC, e.g. `2021-12-29T12:33:09Z`.
|
161
|
+
# The type of this field is nilable +String+.
|
162
|
+
def set(
|
163
|
+
action:,
|
164
|
+
visitor_id: nil,
|
165
|
+
browser_id: nil,
|
166
|
+
visitor_fingerprint: nil,
|
167
|
+
browser_fingerprint: nil,
|
168
|
+
hardware_fingerprint: nil,
|
169
|
+
network_fingerprint: nil,
|
170
|
+
expires_in_minutes: nil,
|
171
|
+
description: nil
|
172
|
+
)
|
173
|
+
headers = {}
|
174
|
+
request = {
|
175
|
+
action: action
|
176
|
+
}
|
177
|
+
request[:visitor_id] = visitor_id unless visitor_id.nil?
|
178
|
+
request[:browser_id] = browser_id unless browser_id.nil?
|
179
|
+
request[:visitor_fingerprint] = visitor_fingerprint unless visitor_fingerprint.nil?
|
180
|
+
request[:browser_fingerprint] = browser_fingerprint unless browser_fingerprint.nil?
|
181
|
+
request[:hardware_fingerprint] = hardware_fingerprint unless hardware_fingerprint.nil?
|
182
|
+
request[:network_fingerprint] = network_fingerprint unless network_fingerprint.nil?
|
183
|
+
request[:expires_in_minutes] = expires_in_minutes unless expires_in_minutes.nil?
|
184
|
+
request[:description] = description unless description.nil?
|
185
|
+
|
186
|
+
post_request('/v1/rules/set', request, headers)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
data/lib/stytch/magic_links.rb
CHANGED
@@ -27,7 +27,7 @@ module Stytch
|
|
27
27
|
#
|
28
28
|
# The redirect URL will look like `https://example.com/authenticate?stytch_token_type=magic_links&token=rM_kw42CWBhsHLF62V75jELMbvJ87njMe3tFVj7Qupu7`
|
29
29
|
#
|
30
|
-
# In the redirect URL, the `stytch_token_type` will be `magic_link`. See [here](https://stytch.com/docs/
|
30
|
+
# In the redirect URL, the `stytch_token_type` will be `magic_link`. See [here](https://stytch.com/docs/workspace-management/redirect-urls) for more detail.
|
31
31
|
# The type of this field is +String+.
|
32
32
|
# attributes::
|
33
33
|
# Provided attributes help with fraud detection.
|
data/lib/stytch/oauth.rb
CHANGED
@@ -72,7 +72,7 @@ module Stytch
|
|
72
72
|
#
|
73
73
|
# The redirect URL will look like `https://example.com/authenticate?stytch_token_type=oauth&token=rM_kw42CWBhsHLF62V75jELMbvJ87njMe3tFVj7Qupu7`
|
74
74
|
#
|
75
|
-
# In the redirect URL, the `stytch_token_type` will be `oauth`. See [here](https://stytch.com/docs/
|
75
|
+
# In the redirect URL, the `stytch_token_type` will be `oauth`. See [here](https://stytch.com/docs/workspace-management/redirect-urls) for more detail.
|
76
76
|
# The type of this field is +String+.
|
77
77
|
# session_token::
|
78
78
|
# Reuse an existing session instead of creating a new one. If you provide us with a `session_token`, then we'll update the session represented by this session token with this OAuth factor. If this `session_token` belongs to a different user than the OAuth token, the session_jwt will be ignored. This endpoint will error if both `session_token` and `session_jwt` are provided.
|
data/lib/stytch/passwords.rb
CHANGED
@@ -387,7 +387,7 @@ module Stytch
|
|
387
387
|
# login_redirect_url::
|
388
388
|
# The URL Stytch redirects to after the OAuth flow is completed for a user that already exists. This URL should be a route in your application which will run `oauth.authenticate` (see below) and finish the login.
|
389
389
|
#
|
390
|
-
# The URL must be configured as a Login URL in the [Redirect URL page](/dashboard/redirect-urls). If the field is not specified, the default Login URL will be used.
|
390
|
+
# The URL must be configured as a Login URL in the [Redirect URL page](https://stytch.com/docs/dashboard/redirect-urls). If the field is not specified, the default Login URL will be used.
|
391
391
|
# The type of this field is nilable +String+.
|
392
392
|
# locale::
|
393
393
|
# Used to determine which language to use when sending the user this delivery method. Parameter is a [IETF BCP 47 language tag](https://www.w3.org/International/articles/language-tags/), e.g. `"en"`.
|
@@ -453,7 +453,7 @@ module Stytch
|
|
453
453
|
#
|
454
454
|
# In the redirect URL, the `stytch_token_type` will be `login` or `reset_password`.
|
455
455
|
#
|
456
|
-
# See examples and read more about redirect URLs [here](https://stytch.com/docs/
|
456
|
+
# See examples and read more about redirect URLs [here](https://stytch.com/docs/workspace-management/redirect-urls).
|
457
457
|
# The type of this field is +String+.
|
458
458
|
# password::
|
459
459
|
# The password for the user. Any UTF8 character is allowed, e.g. spaces, emojis, non-English characers, etc.
|
data/lib/stytch/sessions.rb
CHANGED
@@ -156,7 +156,7 @@ module Stytch
|
|
156
156
|
post_request('/v1/sessions/revoke', request, headers)
|
157
157
|
end
|
158
158
|
|
159
|
-
# Migrate a session from an external OIDC compliant endpoint. Stytch will call the external UserInfo endpoint defined in your Stytch Project settings in the [Dashboard](/dashboard), and then perform a lookup using the `session_token`. If the response contains a valid email address, Stytch will attempt to match that email address with an existing User and create a Stytch Session. You will need to create the user before using this endpoint.
|
159
|
+
# Migrate a session from an external OIDC compliant endpoint. Stytch will call the external UserInfo endpoint defined in your Stytch Project settings in the [Dashboard](https://stytch.com/docs/dashboard), and then perform a lookup using the `session_token`. If the response contains a valid email address, Stytch will attempt to match that email address with an existing User and create a Stytch Session. You will need to create the user before using this endpoint.
|
160
160
|
#
|
161
161
|
# == Parameters:
|
162
162
|
# session_token::
|
data/lib/stytch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stytch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 10.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- stytch
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -100,7 +100,7 @@ dependencies:
|
|
100
100
|
- - '='
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: 2.24.0
|
103
|
-
description:
|
103
|
+
description:
|
104
104
|
email:
|
105
105
|
- support@stytch.com
|
106
106
|
executables: []
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/stytch/client.rb
|
141
141
|
- lib/stytch/crypto_wallets.rb
|
142
142
|
- lib/stytch/errors.rb
|
143
|
+
- lib/stytch/fraud.rb
|
143
144
|
- lib/stytch/m2m.rb
|
144
145
|
- lib/stytch/magic_links.rb
|
145
146
|
- lib/stytch/method_options.rb
|
@@ -162,7 +163,7 @@ licenses:
|
|
162
163
|
metadata:
|
163
164
|
homepage_uri: https://stytch.com
|
164
165
|
source_code_uri: https://github.com/stytchauth/stytch-ruby
|
165
|
-
post_install_message:
|
166
|
+
post_install_message:
|
166
167
|
rdoc_options: []
|
167
168
|
require_paths:
|
168
169
|
- lib
|
@@ -178,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
179
|
version: '0'
|
179
180
|
requirements: []
|
180
181
|
rubygems_version: 3.2.3
|
181
|
-
signing_key:
|
182
|
+
signing_key:
|
182
183
|
specification_version: 4
|
183
184
|
summary: Stytch Ruby Gem
|
184
185
|
test_files: []
|