Module: Keycloak

Defined in:
lib/keycloak-api-rails.rb,
lib/keycloak-api-rails/helper.rb,
lib/keycloak-api-rails/railtie.rb,
lib/keycloak-api-rails/service.rb,
lib/keycloak-api-rails/version.rb,
lib/keycloak-api-rails/middleware.rb,
lib/keycloak-api-rails/http_client.rb,
lib/keycloak-api-rails/configuration.rb,
lib/keycloak-api-rails/authentication.rb,
lib/keycloak-api-rails/public_key_resolver.rb,
lib/keycloak-api-rails/public_key_cached_resolver.rb

Defined Under Namespace

Modules: Authentication Classes: Configuration, HTTPClient, Helper, Middleware, PublicKeyCachedResolver, PublicKeyResolver, Railtie, Service

Constant Summary collapse

VERSION =
"0.12.4"

Class Method Summary collapse

Class Method Details

.configObject



24
25
26
# File 'lib/keycloak-api-rails.rb', line 24

def self.config
  @configuration
end

.configure {|@configuration ||= Keycloak::Configuration.new| ... } ⇒ Object

Yields:



20
21
22
# File 'lib/keycloak-api-rails.rb', line 20

def self.configure
  yield @configuration ||= Keycloak::Configuration.new
end

.http_clientObject



28
29
30
# File 'lib/keycloak-api-rails.rb', line 28

def self.http_client
  @http_client ||= Keycloak::HTTPClient.new(config, logger)
end

.load_configurationObject



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/keycloak-api-rails.rb', line 44

def self.load_configuration
  configure do |config|
    config.server_url                             = nil
    config.realm_id                               = nil
    config.logger                                 = ::Logger.new(STDOUT)
    config.skip_paths                             = {}
    config.opt_in                                 = false
    config.token_expiration_tolerance_in_seconds  = 10
    config.public_key_cache_ttl                   = 86400
    config.custom_attributes                      = []
  end
end

.loggerObject



40
41
42
# File 'lib/keycloak-api-rails.rb', line 40

def self.logger
  config.logger
end

.public_key_resolverObject



32
33
34
# File 'lib/keycloak-api-rails.rb', line 32

def self.public_key_resolver
  @public_key_resolver ||= PublicKeyCachedResolver.from_configuration(http_client, config)
end

.serviceObject



36
37
38
# File 'lib/keycloak-api-rails.rb', line 36

def self.service
  @service ||= Keycloak::Service.new(public_key_resolver)
end