Module: KeycloakRails

Extended by:
Dry::Configurable
Defined in:
lib/keycloak_rails.rb,
lib/keycloak_rails/curl.rb,
lib/keycloak_rails/user.rb,
lib/keycloak_rails/client.rb,
lib/keycloak_rails/engine.rb,
lib/keycloak_rails/version.rb,
lib/app/models/keycloak_rails/sso.rb,
lib/keycloak_rails/controller/helpers.rb,
lib/keycloak_rails/controller/unlocks.rb,
lib/keycloak_rails/controller/omniauth.rb,
lib/keycloak_rails/controller/sessions.rb,
lib/keycloak_rails/controller/passwords.rb,
lib/keycloak_rails/controller/magic_links.rb,
lib/keycloak_rails/controller/registrations.rb,
lib/app/models/keycloak_rails/concerns/sso_recipient.rb,
lib/generators/keycloak_rails/config/config_generator.rb,
lib/generators/keycloak_rails/install/install_generator.rb

Defined Under Namespace

Modules: Controller, Generators, SsoRecipient Classes: Client, Curl, Engine, Sso, User

Constant Summary collapse

VERSION =
'1.0.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

Returns the value of attribute destroy_refresh_cookie_proc.



38
39
40
# File 'lib/keycloak_rails.rb', line 38

def destroy_refresh_cookie_proc
  @destroy_refresh_cookie_proc
end

Returns the value of attribute destroy_session_cookie_proc.



38
39
40
# File 'lib/keycloak_rails.rb', line 38

def destroy_session_cookie_proc
  @destroy_session_cookie_proc
end

Returns the value of attribute refresh_cookie_proc.



38
39
40
# File 'lib/keycloak_rails.rb', line 38

def refresh_cookie_proc
  @refresh_cookie_proc
end

Returns the value of attribute session_cookie_proc.



38
39
40
# File 'lib/keycloak_rails.rb', line 38

def session_cookie_proc
  @session_cookie_proc
end

Class Method Details



44
45
46
# File 'lib/keycloak_rails.rb', line 44

def current_refresh_cookie
  refresh_cookie_proc.call
end


40
41
42
# File 'lib/keycloak_rails.rb', line 40

def current_session_cookie
  session_cookie_proc.call
end

.destroy_auth_cookiesObject



48
49
50
51
# File 'lib/keycloak_rails.rb', line 48

def destroy_auth_cookies
  destroy_session_cookie_proc.call
  destroy_refresh_cookie_proc.call
end

.fetch_openid_configurationObject

Raises:

  • (StandardError)


57
58
59
60
61
62
63
# File 'lib/keycloak_rails.rb', line 57

def fetch_openid_configuration
  request = Curl.new.get(path: "realms/#{realm}/.well-known/openid-configuration",
                         headers: { 'Content-Type': 'application/x-www-form-urlencoded' })
  raise StandardError, request[:response] unless request[:status] == :ok

  request[:response]
end

.openid_configObject



53
54
55
# File 'lib/keycloak_rails.rb', line 53

def openid_config
  @openid_config ||= fetch_openid_configuration
end