Class: PrxAuth::Rails::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/prx_auth/rails/configuration.rb

Constant Summary collapse

DEFAULT_ID_HOST =
"id.prx.org"
DEFAULT_CERT_PATH =
"api/v1/certs"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/prx_auth/rails/configuration.rb', line 12

def initialize
  @install_middleware = true
  @prx_client_id = nil
  @prx_scope = nil
  @id_host = DEFAULT_ID_HOST
  @cert_path = DEFAULT_CERT_PATH

  # infer default namespace from app name
  @namespace =
    if defined?(::Rails)
      klass = ::Rails.application.class
      parent_name = if ::Rails::VERSION::MAJOR >= 6
        klass.module_parent_name
      else
        klass.parent_name
      end
      klass_name = if parent_name.present?
        parent_name
      else
        klass.name
      end

      klass_name.underscore.intern
    end
end

Instance Attribute Details

#cert_pathObject

Returns the value of attribute cert_path.



2
3
4
# File 'lib/prx_auth/rails/configuration.rb', line 2

def cert_path
  @cert_path
end

#id_hostObject

Returns the value of attribute id_host.



2
3
4
# File 'lib/prx_auth/rails/configuration.rb', line 2

def id_host
  @id_host
end

#install_middlewareObject

Returns the value of attribute install_middleware.



2
3
4
# File 'lib/prx_auth/rails/configuration.rb', line 2

def install_middleware
  @install_middleware
end

#namespaceObject

Returns the value of attribute namespace.



2
3
4
# File 'lib/prx_auth/rails/configuration.rb', line 2

def namespace
  @namespace
end

#prx_client_idObject

Returns the value of attribute prx_client_id.



2
3
4
# File 'lib/prx_auth/rails/configuration.rb', line 2

def prx_client_id
  @prx_client_id
end

#prx_scopeObject

Returns the value of attribute prx_scope.



2
3
4
# File 'lib/prx_auth/rails/configuration.rb', line 2

def prx_scope
  @prx_scope
end