Class: Auth0::Guardian::Policies::Client
- Inherits:
-
Object
- Object
- Auth0::Guardian::Policies::Client
- Defined in:
- lib/auth0/guardian/policies/client.rb
Instance Method Summary collapse
- #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Array[Auth0::Types::MfaPolicyEnum]
Retrieve the <a href=“auth0.com/docs/secure/multi-factor-authentication/enable-mfa”>multi-factor authentication (MFA) policies</a> configured for your tenant.
-
#set(request_options: {}, **params) ⇒ Array[Auth0::Types::MfaPolicyEnum]
Set <a href=“auth0.com/docs/secure/multi-factor-authentication/enable-mfa”>multi-factor authentication (MFA) policies</a> for your tenant.
Constructor Details
#initialize(client:) ⇒ void
10 11 12 |
# File 'lib/auth0/guardian/policies/client.rb', line 10 def initialize(client:) @client = client end |
Instance Method Details
#list(request_options: {}, **params) ⇒ Array[Auth0::Types::MfaPolicyEnum]
Retrieve the <a href=“auth0.com/docs/secure/multi-factor-authentication/enable-mfa”>multi-factor authentication (MFA) policies</a> configured for your tenant.
The following policies are supported: <ul> <li>all-applications policy prompts with MFA for all logins.</li> <li>confidence-score policy prompts with MFA only for low confidence logins.</li> </ul>
Note: The confidence-score policy is part of the <a href=“auth0.com/docs/secure/multi-factor-authentication/adaptive-mfa”>Adaptive MFA feature</a>. Adaptive MFA requires an add-on for the Enterprise plan; review <a href=“auth0.com/pricing”>Auth0 Pricing</a> for more details.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/auth0/guardian/policies/client.rb', line 37 def list(request_options: {}, **params) Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "guardian/policies", 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) Auth0::Types::ListGuardianPoliciesResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#set(request_options: {}, **params) ⇒ Array[Auth0::Types::MfaPolicyEnum]
Set <a href=“auth0.com/docs/secure/multi-factor-authentication/enable-mfa”>multi-factor authentication (MFA) policies</a> for your tenant.
The following policies are supported: <ul> <li>all-applications policy prompts with MFA for all logins.</li> <li>confidence-score policy prompts with MFA only for low confidence logins.</li> </ul>
Note: The confidence-score policy is part of the <a href=“auth0.com/docs/secure/multi-factor-authentication/adaptive-mfa”>Adaptive MFA feature</a>. Adaptive MFA requires an add-on for the Enterprise plan; review <a href=“auth0.com/pricing”>Auth0 Pricing</a> for more details.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/auth0/guardian/policies/client.rb', line 82 def set(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "guardian/policies", body: params, 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) Auth0::Types::SetGuardianPoliciesResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |