Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"cliVersion": "5.92.1",
"cliVersion": "5.144.3",
"generatorName": "fernapi/fern-ruby-sdk",
"generatorVersion": "1.24.1",
"generatorConfig": {
Expand All @@ -10,9 +10,9 @@
"offsetSemantics": "page-index",
"useDefaultRequestParameterValues": true
},
"originGitCommit": "d0c167e92ed941d977b98e76601bd970b0e5ecea",
"originGitCommit": "275ad23d02d33d550693bc23ebae86dfa8ee7101",
"originGitCommitIsDirty": false,
"invokedBy": "ci",
"ciProvider": "github",
"sdkVersion": "6.3.1"
"sdkVersion": "6.4.1"
}
8 changes: 7 additions & 1 deletion .fern/replay.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 84 additions & 5 deletions lib/auth0.rb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class UpdateBruteForceSettingsRequestContent < Internal::Types::Model
field :mode, -> { Auth0::Types::BruteForceProtectionModeEnum }, optional: true, nullable: false

field :max_attempts, -> { Integer }, optional: true, nullable: false

field :form_submission_mode, -> { Auth0::Types::BruteForceProtectionFormSubmissionModeEnum }, optional: true, nullable: false
end
end
end
Expand Down
210 changes: 210 additions & 0 deletions lib/auth0/attack_protection/captcha_policies/client.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
# frozen_string_literal: true

module Auth0
module AttackProtection
module CaptchaPolicies
class Client
# @param client [Auth0::Internal::Http::RawClient]
#
# @return [void]
def initialize(client:)
@client = client
end

# Retrieve all CAPTCHA attack protection policies for the tenant, sorted by priority ascending.
#
# @param request_options [Hash]
# @param _params [Hash]
# @option request_options [String] :base_url
# @option request_options [Hash{String => Object}] :additional_headers
# @option request_options [Hash{String => Object}] :additional_query_parameters
# @option request_options [Hash{String => Object}] :additional_body_parameters
# @option request_options [Integer] :timeout_in_seconds
#
# @example
# client.attack_protection.captcha_policies.list
#
# @return [Array[Auth0::Types::AttackProtectionCaptchaPolicy]]
def list(request_options: {}, **_params)
request = Auth0::Internal::JSON::Request.new(
base_url: request_options[:base_url],
method: "GET",
path: "attack-protection/captcha/policies",
request_options: request_options
)
begin
response = @client.send(request)
rescue Net::HTTPRequestTimeout
raise Auth0::Errors::TimeoutError
end
code = response.code.to_i
if code.between?(200, 299)
(response.body.to_s.empty? ? nil : Auth0::Types::ListAttackProtectionCaptchaPoliciesResponseContent.load(response.body))
else
error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
raise error_class.new(response.body, code: code)
end
end

# Create a new CAPTCHA attack protection policy for the tenant. The maximum number of policies per tenant is
# determined by the tenant's subscription.
#
# @param request_options [Hash]
# @param params [Auth0::AttackProtection::CaptchaPolicies::Types::CreateAttackProtectionCaptchaPolicyRequestContent]
# @option request_options [String] :base_url
# @option request_options [Hash{String => Object}] :additional_headers
# @option request_options [Hash{String => Object}] :additional_query_parameters
# @option request_options [Hash{String => Object}] :additional_body_parameters
# @option request_options [Integer] :timeout_in_seconds
#
# @example
# client.attack_protection.captcha_policies.create(
# name: "name",
# priority: 1,
# match: {},
# action: {}
# )
#
# @return [Auth0::Types::AttackProtectionCaptchaPolicy]
def create(request_options: {}, **params)
params = Auth0::Internal::Types::Utils.normalize_keys(params)
request = Auth0::Internal::JSON::Request.new(
base_url: request_options[:base_url],
method: "POST",
path: "attack-protection/captcha/policies",
body: Auth0::AttackProtection::CaptchaPolicies::Types::CreateAttackProtectionCaptchaPolicyRequestContent.new(params).to_h,
request_options: request_options
)
begin
response = @client.send(request)
rescue Net::HTTPRequestTimeout
raise Auth0::Errors::TimeoutError
end
code = response.code.to_i
if code.between?(200, 299)
(response.body.to_s.empty? ? nil : Auth0::Types::AttackProtectionCaptchaPolicy.load(response.body))
else
error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
raise error_class.new(response.body, code: code)
end
end

# Retrieve a single CAPTCHA attack protection policy for the tenant by ID.
#
# @param request_options [Hash]
# @param params [Hash]
# @option request_options [String] :base_url
# @option request_options [Hash{String => Object}] :additional_headers
# @option request_options [Hash{String => Object}] :additional_query_parameters
# @option request_options [Hash{String => Object}] :additional_body_parameters
# @option request_options [Integer] :timeout_in_seconds
# @option params [String] :id
#
# @example
# client.attack_protection.captcha_policies.get(id: "id")
#
# @return [Auth0::Types::AttackProtectionCaptchaPolicy]
def get(request_options: {}, **params)
params = Auth0::Internal::Types::Utils.normalize_keys(params)
request = Auth0::Internal::JSON::Request.new(
base_url: request_options[:base_url],
method: "GET",
path: "attack-protection/captcha/policies/#{URI.encode_uri_component(params[:id].to_s)}",
request_options: request_options
)
begin
response = @client.send(request)
rescue Net::HTTPRequestTimeout
raise Auth0::Errors::TimeoutError
end
code = response.code.to_i
if code.between?(200, 299)
(response.body.to_s.empty? ? nil : Auth0::Types::AttackProtectionCaptchaPolicy.load(response.body))
else
error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
raise error_class.new(response.body, code: code)
end
end

# Delete a CAPTCHA attack protection policy for the tenant.
#
# @param request_options [Hash]
# @param params [Hash]
# @option request_options [String] :base_url
# @option request_options [Hash{String => Object}] :additional_headers
# @option request_options [Hash{String => Object}] :additional_query_parameters
# @option request_options [Hash{String => Object}] :additional_body_parameters
# @option request_options [Integer] :timeout_in_seconds
# @option params [String] :id
#
# @example
# client.attack_protection.captcha_policies.delete(id: "id")
#
# @return [untyped]
def delete(request_options: {}, **params)
params = Auth0::Internal::Types::Utils.normalize_keys(params)
request = Auth0::Internal::JSON::Request.new(
base_url: request_options[:base_url],
method: "DELETE",
path: "attack-protection/captcha/policies/#{URI.encode_uri_component(params[:id].to_s)}",
request_options: request_options
)
begin
response = @client.send(request)
rescue Net::HTTPRequestTimeout
raise Auth0::Errors::TimeoutError
end
code = response.code.to_i
return if code.between?(200, 299)

error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
raise error_class.new(response.body, code: code)
end

# Partially update a CAPTCHA attack protection policy. Only the provided fields are modified. A provided match
# or action replaces the stored value in full rather than merging with it; within action, a provider secret or
# API key that is omitted from a provided provider block keeps its stored value.
#
# @param request_options [Hash]
# @param params [Auth0::AttackProtection::CaptchaPolicies::Types::UpdateAttackProtectionCaptchaPolicyRequestContent]
# @option request_options [String] :base_url
# @option request_options [Hash{String => Object}] :additional_headers
# @option request_options [Hash{String => Object}] :additional_query_parameters
# @option request_options [Hash{String => Object}] :additional_body_parameters
# @option request_options [Integer] :timeout_in_seconds
# @option params [String] :id
#
# @example
# client.attack_protection.captcha_policies.update(id: "id")
#
# @return [Auth0::Types::AttackProtectionCaptchaPolicy]
def update(request_options: {}, **params)
params = Auth0::Internal::Types::Utils.normalize_keys(params)
request_data = Auth0::AttackProtection::CaptchaPolicies::Types::UpdateAttackProtectionCaptchaPolicyRequestContent.new(params).to_h
non_body_param_names = %w[id]
body = request_data.except(*non_body_param_names)

request = Auth0::Internal::JSON::Request.new(
base_url: request_options[:base_url],
method: "PATCH",
path: "attack-protection/captcha/policies/#{URI.encode_uri_component(params[:id].to_s)}",
body: body,
request_options: request_options
)
begin
response = @client.send(request)
rescue Net::HTTPRequestTimeout
raise Auth0::Errors::TimeoutError
end
code = response.code.to_i
if code.between?(200, 299)
(response.body.to_s.empty? ? nil : Auth0::Types::AttackProtectionCaptchaPolicy.load(response.body))
else
error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
raise error_class.new(response.body, code: code)
end
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

module Auth0
module AttackProtection
module CaptchaPolicies
module Types
class CreateAttackProtectionCaptchaPolicyRequestContent < Internal::Types::Model
field :name, -> { String }, optional: false, nullable: false

field :description, -> { String }, optional: true, nullable: false

field :priority, -> { Integer }, optional: false, nullable: false

field :match, -> { Auth0::Types::AttackProtectionCaptchaPolicyMatch }, optional: false, nullable: false

field :action, -> { Auth0::Types::AttackProtectionCaptchaPolicyActionInput }, optional: false, nullable: false
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

module Auth0
module AttackProtection
module CaptchaPolicies
module Types
class UpdateAttackProtectionCaptchaPolicyRequestContent < Internal::Types::Model
field :id, -> { String }, optional: false, nullable: false

field :name, -> { String }, optional: true, nullable: false

field :description, -> { String }, optional: true, nullable: false

field :priority, -> { Integer }, optional: true, nullable: false

field :match, -> { Auth0::Types::AttackProtectionCaptchaPolicyMatch }, optional: true, nullable: false

field :action, -> { Auth0::Types::AttackProtectionCaptchaPolicyActionInput }, optional: true, nullable: false
end
end
end
end
end
5 changes: 5 additions & 0 deletions lib/auth0/attack_protection/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ def captcha
@captcha ||= Auth0::AttackProtection::Captcha::Client.new(client: @client)
end

# @return [Auth0::CaptchaPolicies::Client]
def captcha_policies
@captcha_policies ||= Auth0::AttackProtection::CaptchaPolicies::Client.new(client: @client)
end

# @return [Auth0::PhoneProviderProtection::Client]
def phone_provider_protection
@phone_provider_protection ||= Auth0::AttackProtection::PhoneProviderProtection::Client.new(client: @client)
Expand Down
5 changes: 5 additions & 0 deletions lib/auth0/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ def client_grants
@client_grants ||= Auth0::ClientGrants::Client.new(client: @raw_client)
end

# @return [Auth0::ClientProfiles::Client]
def client_profiles
@client_profiles ||= Auth0::ClientProfiles::Client.new(client: @raw_client)
end

# @return [Auth0::Clients::Client]
def clients
@clients ||= Auth0::Clients::Client.new(client: @raw_client)
Expand Down
Loading
Loading