Class: Drillbit::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#allowed_api_subdomainsObject



35
36
37
# File 'lib/drillbit/configuration.rb', line 35

def allowed_api_subdomains
  @allowed_api_subdomains || ['api']
end

#allowed_subdomainsObject



31
32
33
# File 'lib/drillbit/configuration.rb', line 31

def allowed_subdomains
  @allowed_subdomains || ['api']
end

#application_nameObject

Returns the value of attribute application_name.



17
18
19
# File 'lib/drillbit/configuration.rb', line 17

def application_name
  @application_name
end

#available_token_rolesObject



43
44
45
# File 'lib/drillbit/configuration.rb', line 43

def available_token_roles
  @available_token_roles || %w{standard admin password_reset email_verification}
end

#default_api_versionObject



47
48
49
# File 'lib/drillbit/configuration.rb', line 47

def default_api_version
  @default_api_version || '1'
end

#default_token_audienceObject



39
40
41
# File 'lib/drillbit/configuration.rb', line 39

def default_token_audience
  @default_token_audience || 'public'
end

#default_token_expiration_in_minutesObject



63
64
65
# File 'lib/drillbit/configuration.rb', line 63

def default_token_expiration_in_minutes
  @default_token_expiration_in_minutes || (7 * 24 * 60)
end

#default_token_issuerObject



55
56
57
# File 'lib/drillbit/configuration.rb', line 55

def default_token_issuer
  @default_token_issuer || 'drillbit'
end

#default_token_rolesObject



51
52
53
# File 'lib/drillbit/configuration.rb', line 51

def default_token_roles
  @default_token_roles || %w{standard}
end

#default_token_subjectObject



59
60
61
# File 'lib/drillbit/configuration.rb', line 59

def default_token_subject
  @default_token_subject || 'User'
end

#token_private_keyObject



67
68
69
70
71
72
# File 'lib/drillbit/configuration.rb', line 67

def token_private_key
  return unless @token_private_key
  return @token_private_key if @token_private_key.respond_to?(:sign)

  OpenSSL::PKey::RSA.new(@token_private_key)
end

#token_typeObject



74
75
76
# File 'lib/drillbit/configuration.rb', line 74

def token_type
  @token_type || 'JWE'
end

Instance Method Details

#to_hObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/drillbit/configuration.rb', line 19

def to_h
  {
    allowed_api_subdomains:              allowed_api_subdomains,
    allowed_subdomains:                  allowed_subdomains,
    application_name:                    application_name,
    default_api_version:                 default_api_version,
    default_token_issuer:                default_token_issuer,
    default_token_subject:               default_token_subject,
    default_token_expiration_in_minutes: token_expiration_in_minutes,
  }
end