Module: KeycloakOauth::Endpoints

Included in:
Connection
Defined in:
lib/keycloak_oauth/endpoints.rb

Constant Summary collapse

DEFAULT_RESPONSE_TYPE =
'code'.freeze

Instance Method Summary collapse

Instance Method Details

#authentication_endpointObject



12
13
14
# File 'lib/keycloak_oauth/endpoints.rb', line 12

def authentication_endpoint
  "#{auth_url}/realms/#{realm}/protocol/openid-connect/token"
end

#authorization_endpoint(options: {}) ⇒ Object



5
6
7
8
9
10
# File 'lib/keycloak_oauth/endpoints.rb', line 5

def authorization_endpoint(options: {})
  endpoint = "#{auth_url}/realms/#{realm}/protocol/openid-connect/auth?client_id=#{client_id}"
  endpoint += "&response_type=#{options[:response_type] || DEFAULT_RESPONSE_TYPE}"
  endpoint += "&redirect_uri=#{options[:redirect_uri]}" if options[:redirect_uri].present?
  endpoint
end

#logout_endpointObject



20
21
22
# File 'lib/keycloak_oauth/endpoints.rb', line 20

def logout_endpoint
  "#{auth_url}/realms/#{realm}/protocol/openid-connect/logout"
end

#put_execute_actions_email_endpoint(user_id) ⇒ Object



28
29
30
# File 'lib/keycloak_oauth/endpoints.rb', line 28

def put_execute_actions_email_endpoint(user_id)
  "#{auth_url}/admin/realms/#{realm}/users/#{user_id}/execute-actions-email"
end

#user_info_endpointObject



16
17
18
# File 'lib/keycloak_oauth/endpoints.rb', line 16

def 
  "#{auth_url}/realms/#{realm}/protocol/openid-connect/userinfo"
end

#users_endpointObject



24
25
26
# File 'lib/keycloak_oauth/endpoints.rb', line 24

def users_endpoint
  "#{auth_url}/admin/realms/#{realm}/users"
end