Class: Auth0::CustomDomains::Client
- Inherits:
-
Object
- Object
- Auth0::CustomDomains::Client
- Defined in:
- lib/auth0/custom_domains/client.rb
Instance Method Summary collapse
-
#create(request_options: {}, **params) ⇒ Auth0::Types::CreateCustomDomainResponseContent
Create a new custom domain.
-
#delete(request_options: {}, **params) ⇒ untyped
Delete a custom domain and stop serving requests for it.
-
#get(request_options: {}, **params) ⇒ Auth0::Types::GetCustomDomainResponseContent
Retrieve a custom domain configuration and status.
-
#get_default(request_options: {}, **_params) ⇒ Auth0::Types::GetDefaultDomainResponseContent
Retrieve the tenant’s default domain.
- #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Array[Auth0::Types::CustomDomain]
Retrieve details on [custom domains](auth0.com/docs/custom-domains).
-
#set_default(request_options: {}, **params) ⇒ Auth0::Types::UpdateDefaultDomainResponseContent
Set the default custom domain for the tenant.
-
#test(request_options: {}, **params) ⇒ Auth0::Types::TestCustomDomainResponseContent
Run the test process on a custom domain.
-
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateCustomDomainResponseContent
Update a custom domain.
-
#verify(request_options: {}, **params) ⇒ Auth0::Types::VerifyCustomDomainResponseContent
Run the verification process on a custom domain.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/auth0/custom_domains/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Auth0::Types::CreateCustomDomainResponseContent
Create a new custom domain.
Note: The custom domain will need to be verified before it will accept requests.
Optional attributes that can be updated:
-
custom_client_ip_header
-
tls_policy
TLS Policies:
-
recommended - for modern usage this includes TLS 1.2 only
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/auth0/custom_domains/client.rb', line 80 def create(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "custom-domains", body: Auth0::CustomDomains::Types::CreateCustomDomainRequestContent.new(params).to_h, 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::CreateCustomDomainResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete(request_options: {}, **params) ⇒ untyped
Delete a custom domain and stop serving requests for it.
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/auth0/custom_domains/client.rb', line 215 def delete(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "custom-domains/#{URI.encode_uri_component(params[:id].to_s)}", 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 |
#get(request_options: {}, **params) ⇒ Auth0::Types::GetCustomDomainResponseContent
Retrieve a custom domain configuration and status.
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/auth0/custom_domains/client.rb', line 181 def get(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "custom-domains/#{URI.encode_uri_component(params[:id].to_s)}", 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::GetCustomDomainResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_default(request_options: {}, **_params) ⇒ Auth0::Types::GetDefaultDomainResponseContent
Retrieve the tenant’s default domain.
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/auth0/custom_domains/client.rb', line 114 def get_default(request_options: {}, **_params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "custom-domains/default", 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::GetDefaultDomainResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list(request_options: {}, **params) ⇒ Array[Auth0::Types::CustomDomain]
Retrieve details on [custom domains](auth0.com/docs/custom-domains).
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/auth0/custom_domains/client.rb', line 28 def list(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["q"] = params[:q] if params.key?(:q) query_params["fields"] = params[:fields] if params.key?(:fields) query_params["include_fields"] = params[:include_fields] if params.key?(:include_fields) query_params["sort"] = params[:sort] if params.key?(:sort) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "custom-domains", query: query_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::ListCustomDomainsResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#set_default(request_options: {}, **params) ⇒ Auth0::Types::UpdateDefaultDomainResponseContent
Set the default custom domain for the tenant.
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/auth0/custom_domains/client.rb', line 146 def set_default(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "PATCH", path: "custom-domains/default", body: Auth0::CustomDomains::Types::SetDefaultCustomDomainRequestContent.new(params).to_h, 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::UpdateDefaultDomainResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#test(request_options: {}, **params) ⇒ Auth0::Types::TestCustomDomainResponseContent
Run the test process on a custom domain.
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/auth0/custom_domains/client.rb', line 318 def test(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "custom-domains/#{URI.encode_uri_component(params[:id].to_s)}/test", 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::TestCustomDomainResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateCustomDomainResponseContent
Update a custom domain.
These are the attributes that can be updated:
-
custom_client_ip_header
-
tls_policy
**Updating CUSTOM_CLIENT_IP_HEADER for a custom domain**
To update the ‘custom_client_ip_header` for a domain, the body to send should be:
“‘json { “custom_client_ip_header”: “cf-connecting-ip” } “`
**Updating TLS_POLICY for a custom domain**
To update the ‘tls_policy` for a domain, the body to send should be:
“‘json { “tls_policy”: “recommended” } “`
TLS Policies:
-
recommended - for modern usage this includes TLS 1.2 only
Some considerations:
-
The TLS ciphers and protocols available in each TLS policy follow industry recommendations, and may be updated
occasionally.
-
The ‘compatible` TLS policy is no longer supported.
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/auth0/custom_domains/client.rb', line 279 def update(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request_data = Auth0::CustomDomains::Types::UpdateCustomDomainRequestContent.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: [:base_url], method: "PATCH", path: "custom-domains/#{URI.encode_uri_component(params[:id].to_s)}", body: body, 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::UpdateCustomDomainResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#verify(request_options: {}, **params) ⇒ Auth0::Types::VerifyCustomDomainResponseContent
Run the verification process on a custom domain.
Note: Check the ‘status` field to see its verification status. Once verification is complete, it may take up to 10 minutes before the custom domain can start accepting requests.
For ‘self_managed_certs`, when the custom domain is verified for the first time, the response will also include the `cname_api_key` which you will need to configure your proxy. This key must be kept secret, and is used to validate the proxy requests.
[Learn more](auth0.com/docs/custom-domains#step-2-verify-ownership) about verifying custom domains that use Auth0 Managed certificates. [Learn more](auth0.com/docs/custom-domains/self-managed-certificates#step-2-verify-ownership) about verifying custom domains that use Self Managed certificates.
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/auth0/custom_domains/client.rb', line 364 def verify(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "custom-domains/#{URI.encode_uri_component(params[:id].to_s)}/verify", 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::VerifyCustomDomainResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |