Class: Sphragis::Configuration
- Inherits:
-
Object
- Object
- Sphragis::Configuration
- Defined in:
- lib/sphragis/configuration.rb
Instance Attribute Summary collapse
-
#certificate_label ⇒ Object
Fortify configuration.
-
#default_provider ⇒ Object
Returns the value of attribute default_provider.
-
#fortify_library_path ⇒ Object
Fortify configuration.
-
#harica_api_key ⇒ Object
Harica configuration.
-
#harica_certificate_id ⇒ Object
Harica configuration.
-
#harica_environment ⇒ Object
Harica configuration.
-
#harica_password ⇒ Object
Harica configuration.
-
#harica_username ⇒ Object
Harica configuration.
-
#itsme_client_id ⇒ Object
Itsme configuration.
-
#itsme_client_secret ⇒ Object
Itsme configuration.
-
#itsme_environment ⇒ Object
Itsme configuration.
-
#itsme_user_email ⇒ Object
Itsme configuration.
-
#token_pin ⇒ Object
Fortify configuration.
-
#token_slot ⇒ Object
Fortify configuration.
Instance Method Summary collapse
-
#available_providers ⇒ Array<Symbol>
Get available providers based on configuration.
-
#fortify_configured? ⇒ Boolean
Check if Fortify is configured.
-
#harica_configured? ⇒ Boolean
Check if Harica is configured.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#itsme_configured? ⇒ Boolean
Check if Itsme is configured.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/sphragis/configuration.rb', line 18 def initialize # Default provider @default_provider = ENV.fetch("SIGNATURE_PROVIDER", "fortify").to_sym # Fortify configuration @fortify_library_path = ENV.fetch("FORTIFY_LIBRARY_PATH", "/usr/lib/fortify/libfortify.so") @token_pin = ENV["FORTIFY_TOKEN_PIN"] @token_slot = ENV.fetch("FORTIFY_TOKEN_SLOT", "0").to_i @certificate_label = ENV.fetch("FORTIFY_CERTIFICATE_LABEL", "Signing Certificate") # Harica configuration @harica_api_key = ENV["HARICA_API_KEY"] @harica_certificate_id = ENV["HARICA_CERTIFICATE_ID"] @harica_username = ENV["HARICA_USERNAME"] @harica_password = ENV["HARICA_PASSWORD"] @harica_environment = ENV.fetch("HARICA_ENVIRONMENT", "production") # Itsme configuration @itsme_client_id = ENV["ITSME_CLIENT_ID"] @itsme_client_secret = ENV["ITSME_CLIENT_SECRET"] @itsme_user_email = ENV["ITSME_USER_EMAIL"] @itsme_environment = ENV.fetch("ITSME_ENVIRONMENT", "production") end |
Instance Attribute Details
#certificate_label ⇒ Object
Fortify configuration
8 9 10 |
# File 'lib/sphragis/configuration.rb', line 8 def certificate_label @certificate_label end |
#default_provider ⇒ Object
Returns the value of attribute default_provider.
5 6 7 |
# File 'lib/sphragis/configuration.rb', line 5 def default_provider @default_provider end |
#fortify_library_path ⇒ Object
Fortify configuration
8 9 10 |
# File 'lib/sphragis/configuration.rb', line 8 def fortify_library_path @fortify_library_path end |
#harica_api_key ⇒ Object
Harica configuration
11 12 13 |
# File 'lib/sphragis/configuration.rb', line 11 def harica_api_key @harica_api_key end |
#harica_certificate_id ⇒ Object
Harica configuration
11 12 13 |
# File 'lib/sphragis/configuration.rb', line 11 def harica_certificate_id @harica_certificate_id end |
#harica_environment ⇒ Object
Harica configuration
11 12 13 |
# File 'lib/sphragis/configuration.rb', line 11 def harica_environment @harica_environment end |
#harica_password ⇒ Object
Harica configuration
11 12 13 |
# File 'lib/sphragis/configuration.rb', line 11 def harica_password @harica_password end |
#harica_username ⇒ Object
Harica configuration
11 12 13 |
# File 'lib/sphragis/configuration.rb', line 11 def harica_username @harica_username end |
#itsme_client_id ⇒ Object
Itsme configuration
15 16 17 |
# File 'lib/sphragis/configuration.rb', line 15 def itsme_client_id @itsme_client_id end |
#itsme_client_secret ⇒ Object
Itsme configuration
15 16 17 |
# File 'lib/sphragis/configuration.rb', line 15 def itsme_client_secret @itsme_client_secret end |
#itsme_environment ⇒ Object
Itsme configuration
15 16 17 |
# File 'lib/sphragis/configuration.rb', line 15 def itsme_environment @itsme_environment end |
#itsme_user_email ⇒ Object
Itsme configuration
15 16 17 |
# File 'lib/sphragis/configuration.rb', line 15 def itsme_user_email @itsme_user_email end |
#token_pin ⇒ Object
Fortify configuration
8 9 10 |
# File 'lib/sphragis/configuration.rb', line 8 def token_pin @token_pin end |
#token_slot ⇒ Object
Fortify configuration
8 9 10 |
# File 'lib/sphragis/configuration.rb', line 8 def token_slot @token_slot end |
Instance Method Details
#available_providers ⇒ Array<Symbol>
Get available providers based on configuration
44 45 46 47 48 49 50 |
# File 'lib/sphragis/configuration.rb', line 44 def available_providers providers = [] providers << :fortify if fortify_configured? providers << :harica if harica_configured? providers << :itsme if itsme_configured? providers end |
#fortify_configured? ⇒ Boolean
Check if Fortify is configured
53 54 55 |
# File 'lib/sphragis/configuration.rb', line 53 def fortify_configured? !fortify_library_path.nil? && !token_pin.nil? end |
#harica_configured? ⇒ Boolean
Check if Harica is configured
58 59 60 |
# File 'lib/sphragis/configuration.rb', line 58 def harica_configured? !harica_api_key.nil? && !harica_certificate_id.nil? && !harica_username.nil? end |
#itsme_configured? ⇒ Boolean
Check if Itsme is configured
63 64 65 |
# File 'lib/sphragis/configuration.rb', line 63 def itsme_configured? !itsme_client_id.nil? && !itsme_client_secret.nil? && !itsme_user_email.nil? end |