Class: Auth0::Guardian::Factors::PushNotification::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/auth0/guardian/factors/push_notification/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ void

Parameters:



11
12
13
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 11

def initialize(client:)
  @client = client
end

Instance Method Details

#get_apns_provider(request_options: {}, **params) ⇒ Auth0::Types::GetGuardianFactorsProviderApnsResponseContent

Retrieve configuration details for the multi-factor authentication APNS provider associated with your tenant.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 27

def get_apns_provider(request_options: {}, **params)
  Auth0::Internal::Types::Utils.normalize_keys(params)
  request = Auth0::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "guardian/factors/push-notification/providers/apns",
    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)
    Auth0::Types::GetGuardianFactorsProviderApnsResponseContent.load(response.body)
  else
    error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_selected_provider(request_options: {}, **params) ⇒ Auth0::Types::GetGuardianFactorsProviderPushNotificationResponseContent

Modify the push notification provider configured for your tenant. For more information, review <a href=“auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-push-notifications-for-mfa”>Configure Push Notifications for MFA</a>.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 375

def get_selected_provider(request_options: {}, **params)
  Auth0::Internal::Types::Utils.normalize_keys(params)
  request = Auth0::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "guardian/factors/push-notification/selected-provider",
    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)
    Auth0::Types::GetGuardianFactorsProviderPushNotificationResponseContent.load(response.body)
  else
    error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_sns_provider(request_options: {}, **params) ⇒ Auth0::Types::GetGuardianFactorsProviderSnsResponseContent

Retrieve configuration details for an AWS SNS push notification provider that has been enabled for MFA. To learn more, review <a href=“auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-push-notifications-for-mfa”>Configure Push Notifications for MFA</a>.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 270

def get_sns_provider(request_options: {}, **params)
  Auth0::Internal::Types::Utils.normalize_keys(params)
  request = Auth0::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "guardian/factors/push-notification/providers/sns",
    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)
    Auth0::Types::GetGuardianFactorsProviderSnsResponseContent.load(response.body)
  else
    error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#set_apns_provider(request_options: {}, **params) ⇒ Auth0::Types::SetGuardianFactorsProviderPushNotificationApnsResponseContent

Overwrite all configuration details of the multi-factor authentication APNS provider associated with your tenant.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 61

def set_apns_provider(request_options: {}, **params)
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
  request = Auth0::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PUT",
    path: "guardian/factors/push-notification/providers/apns",
    body: Auth0::Guardian::Factors::PushNotification::Types::SetGuardianFactorsProviderPushNotificationApnsRequestContent.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)
    Auth0::Types::SetGuardianFactorsProviderPushNotificationApnsResponseContent.load(response.body)
  else
    error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#set_fcm_provider(request_options: {}, **params) ⇒ Hash[String, Object]

Overwrite all configuration details of the multi-factor authentication FCM provider associated with your tenant.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:

  • (Hash[String, Object])


130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 130

def set_fcm_provider(request_options: {}, **params)
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
  request = Auth0::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PUT",
    path: "guardian/factors/push-notification/providers/fcm",
    body: Auth0::Guardian::Factors::PushNotification::Types::SetGuardianFactorsProviderPushNotificationFcmRequestContent.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)
    Auth0::Types::SetGuardianFactorsProviderPushNotificationFcmResponseContent.load(response.body)
  else
    error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#set_fcmv1provider(request_options: {}, **params) ⇒ Hash[String, Object]

Overwrite all configuration details of the multi-factor authentication FCMV1 provider associated with your tenant.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:

  • (Hash[String, Object])


199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 199

def set_fcmv1provider(request_options: {}, **params)
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
  request = Auth0::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PUT",
    path: "guardian/factors/push-notification/providers/fcmv1",
    body: Auth0::Guardian::Factors::PushNotification::Types::SetGuardianFactorsProviderPushNotificationFcmv1RequestContent.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)
    Auth0::Types::SetGuardianFactorsProviderPushNotificationFcmv1ResponseContent.load(response.body)
  else
    error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#set_provider(request_options: {}, **params) ⇒ Auth0::Types::SetGuardianFactorsProviderPushNotificationResponseContent

Modify the push notification provider configured for your tenant. For more information, review <a href=“auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-push-notifications-for-mfa”>Configure Push Notifications for MFA</a>.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 410

def set_provider(request_options: {}, **params)
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
  request = Auth0::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PUT",
    path: "guardian/factors/push-notification/selected-provider",
    body: Auth0::Guardian::Factors::PushNotification::Types::SetGuardianFactorsProviderPushNotificationRequestContent.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)
    Auth0::Types::SetGuardianFactorsProviderPushNotificationResponseContent.load(response.body)
  else
    error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#set_sns_provider(request_options: {}, **params) ⇒ Auth0::Types::SetGuardianFactorsProviderPushNotificationSnsResponseContent

Configure the <a href=“auth0.com/docs/multifactor-authentication/developer/sns-configuration”>AWS SNS push notification provider configuration</a> (subscription required).

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 304

def set_sns_provider(request_options: {}, **params)
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
  request = Auth0::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PUT",
    path: "guardian/factors/push-notification/providers/sns",
    body: Auth0::Guardian::Factors::PushNotification::Types::SetGuardianFactorsProviderPushNotificationSnsRequestContent.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)
    Auth0::Types::SetGuardianFactorsProviderPushNotificationSnsResponseContent.load(response.body)
  else
    error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#update_apns_provider(request_options: {}, **params) ⇒ Auth0::Types::UpdateGuardianFactorsProviderPushNotificationApnsResponseContent

Modify configuration details of the multi-factor authentication APNS provider associated with your tenant.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 95

def update_apns_provider(request_options: {}, **params)
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
  request = Auth0::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PATCH",
    path: "guardian/factors/push-notification/providers/apns",
    body: Auth0::Guardian::Factors::PushNotification::Types::UpdateGuardianFactorsProviderPushNotificationApnsRequestContent.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)
    Auth0::Types::UpdateGuardianFactorsProviderPushNotificationApnsResponseContent.load(response.body)
  else
    error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#update_fcm_provider(request_options: {}, **params) ⇒ Hash[String, Object]

Modify configuration details of the multi-factor authentication FCM provider associated with your tenant.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:

  • (Hash[String, Object])


164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 164

def update_fcm_provider(request_options: {}, **params)
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
  request = Auth0::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PATCH",
    path: "guardian/factors/push-notification/providers/fcm",
    body: Auth0::Guardian::Factors::PushNotification::Types::UpdateGuardianFactorsProviderPushNotificationFcmRequestContent.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)
    Auth0::Types::UpdateGuardianFactorsProviderPushNotificationFcmResponseContent.load(response.body)
  else
    error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#update_fcmv1provider(request_options: {}, **params) ⇒ Hash[String, Object]

Modify configuration details of the multi-factor authentication FCMV1 provider associated with your tenant.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:

  • (Hash[String, Object])


233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 233

def update_fcmv1provider(request_options: {}, **params)
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
  request = Auth0::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PATCH",
    path: "guardian/factors/push-notification/providers/fcmv1",
    body: Auth0::Guardian::Factors::PushNotification::Types::UpdateGuardianFactorsProviderPushNotificationFcmv1RequestContent.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)
    Auth0::Types::UpdateGuardianFactorsProviderPushNotificationFcmv1ResponseContent.load(response.body)
  else
    error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#update_sns_provider(request_options: {}, **params) ⇒ Auth0::Types::UpdateGuardianFactorsProviderPushNotificationSnsResponseContent

Configure the <a href=“auth0.com/docs/multifactor-authentication/developer/sns-configuration”>AWS SNS push notification provider configuration</a> (subscription required).

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 339

def update_sns_provider(request_options: {}, **params)
  params = Auth0::Internal::Types::Utils.normalize_keys(params)
  request = Auth0::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PATCH",
    path: "guardian/factors/push-notification/providers/sns",
    body: Auth0::Guardian::Factors::PushNotification::Types::UpdateGuardianFactorsProviderPushNotificationSnsRequestContent.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)
    Auth0::Types::UpdateGuardianFactorsProviderPushNotificationSnsResponseContent.load(response.body)
  else
    error_class = Auth0::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end