Module: Keycloak::API::KeycloakAPIExtensionResources

Extended by:
ActiveSupport::Concern
Includes:
Concerns::APIUtil
Included in:
Client
Defined in:
lib/keycloak/api/keycloak_api_extension_resources.rb

Instance Method Summary collapse

Methods included from Concerns::APIUtil

#admin_realm_url, #delete, #get, #post, #put, #realm_url

Instance Method Details

#api_extension_resources_urlObject



8
9
10
# File 'lib/keycloak/api/keycloak_api_extension_resources.rb', line 8

def api_extension_resources_url
  realm_url + "/keycloak-api-extension/"
end

#if_otp_exists(user_id) ⇒ Object

Returns Boolean.

Parameters:

  • user_id (String)

    user id

Returns:

  • Boolean



14
15
16
17
# File 'lib/keycloak/api/keycloak_api_extension_resources.rb', line 14

def if_otp_exists(user_id)
  url = api_extension_resources_url + "users/#{user_id}/if-otp-exists"
  JSON.parse(get(url))["status"]
end

#validate_otp(user_id, otp) ⇒ Object

Returns Boolean.

Parameters:

  • user_id (String)

    user id

  • otp (String)

    otp

Returns:

  • Boolean



22
23
24
25
# File 'lib/keycloak/api/keycloak_api_extension_resources.rb', line 22

def validate_otp(user_id, otp)
  url = api_extension_resources_url + "users/#{user_id}/validate-otp"
  JSON.parse(post(url, otp: otp))["status"]
end