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.
-
#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
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/auth0/custom_domains/client.rb', line 94 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) (response.body.to_s.empty? ? nil : 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.
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/auth0/custom_domains/client.rb', line 241 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.
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/auth0/custom_domains/client.rb', line 204 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) (response.body.to_s.empty? ? nil : 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.
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/auth0/custom_domains/client.rb', line 131 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) (response.body.to_s.empty? ? nil : 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.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/auth0/custom_domains/client.rb', line 36 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) (response.body.to_s.empty? ? nil : 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.
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/auth0/custom_domains/client.rb', line 166 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) (response.body.to_s.empty? ? nil : 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.
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/auth0/custom_domains/client.rb', line 350 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) (response.body.to_s.empty? ? nil : 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:
{ "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:
{ "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
compatibleTLS policy is no longer supported.
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
# File 'lib/auth0/custom_domains/client.rb', line 308 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) (response.body.to_s.empty? ? nil : 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 about verifying custom domains that use Auth0 Managed certificates. Learn more about verifying custom domains that use Self Managed certificates.
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
# File 'lib/auth0/custom_domains/client.rb', line 399 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) (response.body.to_s.empty? ? nil : 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 |