Class: Shakha::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/shakha/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



16
17
18
19
# File 'lib/shakha/config.rb', line 16

def initialize
  @session_lifetime = 30.days
  @issuer = "https://shakha.dev"
end

Instance Attribute Details

#app_originObject

Returns the value of attribute app_origin.



5
6
7
# File 'lib/shakha/config.rb', line 5

def app_origin
  @app_origin
end

#google_client_idObject

Returns the value of attribute google_client_id.



5
6
7
# File 'lib/shakha/config.rb', line 5

def google_client_id
  @google_client_id
end

#google_client_secretObject

Returns the value of attribute google_client_secret.



5
6
7
# File 'lib/shakha/config.rb', line 5

def google_client_secret
  @google_client_secret
end

#issuerObject

Returns the value of attribute issuer.



5
6
7
# File 'lib/shakha/config.rb', line 5

def issuer
  @issuer
end

#key_idObject

Returns the value of attribute key_id.



5
6
7
# File 'lib/shakha/config.rb', line 5

def key_id
  @key_id
end

#service_secretObject

Returns the value of attribute service_secret.



5
6
7
# File 'lib/shakha/config.rb', line 5

def service_secret
  @service_secret
end

#service_urlObject

Returns the value of attribute service_url.



5
6
7
# File 'lib/shakha/config.rb', line 5

def service_url
  @service_url
end

#session_lifetimeObject

Returns the value of attribute session_lifetime.



5
6
7
# File 'lib/shakha/config.rb', line 5

def session_lifetime
  @session_lifetime
end

#signing_keyObject

Returns the value of attribute signing_key.



5
6
7
# File 'lib/shakha/config.rb', line 5

def signing_key
  @signing_key
end

#verification_keyObject

Returns the value of attribute verification_key.



5
6
7
# File 'lib/shakha/config.rb', line 5

def verification_key
  @verification_key
end

Instance Method Details

#audienceObject



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

def audience
  client_id
end

#client_idObject



31
32
33
34
35
36
# File 'lib/shakha/config.rb', line 31

def client_id
  return @client_id if defined?(@client_id)

  origin = URI.parse(app_origin).origin
  @client_id = "origin:#{origin}"
end

#embedded?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/shakha/config.rb', line 21

def embedded?
  service_url.blank?
end

#service_base_urlObject



25
26
27
28
29
# File 'lib/shakha/config.rb', line 25

def service_base_url
  return app_origin if embedded?

  service_url.chomp("/")
end