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.

Examples:

client.guardian.factors.push_notification.get_apns_provider

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:



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

def get_apns_provider(request_options: {}, **_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)
    (response.body.to_s.empty? ? nil : 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 Configure Push Notifications for MFA.

Examples:

client.guardian.factors.push_notification.get_selected_provider

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:



407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 407

def get_selected_provider(request_options: {}, **_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)
    (response.body.to_s.empty? ? nil : 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 Configure Push Notifications for MFA.

Examples:

client.guardian.factors.push_notification.get_sns_provider

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:



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 292

def get_sns_provider(request_options: {}, **_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)
    (response.body.to_s.empty? ? nil : 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.

Examples:

client.guardian.factors.push_notification.set_apns_provider

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:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 66

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)
    (response.body.to_s.empty? ? nil : 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.

Examples:

client.guardian.factors.push_notification.set_fcm_provider

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])


141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 141

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)
    (response.body.to_s.empty? ? nil : 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.

Examples:

client.guardian.factors.push_notification.set_fcmv1provider

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])


216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 216

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)
    (response.body.to_s.empty? ? nil : 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 Configure Push Notifications for MFA.

Examples:

client.guardian.factors.push_notification.set_provider(provider: "guardian")

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:



444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 444

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)
    (response.body.to_s.empty? ? nil : 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 AWS SNS push notification provider configuration (subscription required).

Examples:

client.guardian.factors.push_notification.set_sns_provider

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:



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 329

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)
    (response.body.to_s.empty? ? nil : 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.

Examples:

client.guardian.factors.push_notification.update_apns_provider

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:



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 103

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)
    (response.body.to_s.empty? ? nil : 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.

Examples:

client.guardian.factors.push_notification.update_fcm_provider

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])


178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 178

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)
    (response.body.to_s.empty? ? nil : 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.

Examples:

client.guardian.factors.push_notification.update_fcmv1provider

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])


253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 253

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)
    (response.body.to_s.empty? ? nil : 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 AWS SNS push notification provider configuration (subscription required).

Examples:

client.guardian.factors.push_notification.update_sns_provider

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:



368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/auth0/guardian/factors/push_notification/client.rb', line 368

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)
    (response.body.to_s.empty? ? nil : 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