Class: VIISP::Auth::Configuration

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

Constant Summary collapse

CERTS_PATH =
File.expand_path('../../../../certs', __FILE__).freeze
DEFAULT_PROVIDERS =
%w[
  auth.lt.identity.card
  auth.lt.bank
  auth.signatureProvider
  auth.login.pass
  auth.lt.government.employee.card
  auth.stork
  auth.tsl.identity.card
].freeze
DEFAULT_ATTRIBUTES =
%w[
  lt-personal-code
  lt-company-code
  lt-government-employee-code
  stork-eid
  tsl-serial-number
  login
].freeze
DEFAULT_USER_INFORMATION =
%w[
  firstName
  lastName
  address
  email
  phoneNumber
  birthday
  companyName
].freeze
PRODUCTION_ENDPOINT =
'https://www.epaslaugos.lt/portal/authenticationServices/auth'
PRODUCTION_PORTAL_ENDPOINT =
'https://www.epaslaugos.lt/portal/external/services/authentication/v2/'
TEST_PID =
'VSID000000000113'
TEST_ENDPOINT =
'https://www.epaslaugos.lt/portal-test/services/AuthenticationServiceProxy'
TEST_PORTAL_ENDPOINT =
'https://www.epaslaugos.lt/portal-test/external/services/authentication/v2/'
DEFAULT_OPEN_TIMEOUT =
3
DEFAULT_READ_TIMEOUT =
10

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



62
63
64
65
66
67
68
69
# File 'lib/viisp/auth/configuration.rb', line 62

def initialize
  @providers = DEFAULT_PROVIDERS
  @attributes = DEFAULT_ATTRIBUTES
  @user_information = DEFAULT_USER_INFORMATION

  @open_timeout = DEFAULT_OPEN_TIMEOUT
  @read_timeout = DEFAULT_READ_TIMEOUT
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



15
16
17
# File 'lib/viisp/auth/configuration.rb', line 15

def attributes
  @attributes
end

#endpointObject



81
82
83
84
85
# File 'lib/viisp/auth/configuration.rb', line 81

def endpoint
  return @endpoint if @endpoint
  return TEST_ENDPOINT if test?
  PRODUCTION_ENDPOINT
end

#open_timeoutObject

Returns the value of attribute open_timeout.



19
20
21
# File 'lib/viisp/auth/configuration.rb', line 19

def open_timeout
  @open_timeout
end

#pidObject



71
72
73
74
75
# File 'lib/viisp/auth/configuration.rb', line 71

def pid
  return @pid if @pid
  return TEST_PID if test?
  error('pid not configured')
end

#portal_endpointObject



87
88
89
90
91
# File 'lib/viisp/auth/configuration.rb', line 87

def portal_endpoint
  return @portal_endpoint if @portal_endpoint
  return TEST_PORTAL_ENDPOINT if test?
  PRODUCTION_PORTAL_ENDPOINT
end

#postback_urlObject



77
78
79
# File 'lib/viisp/auth/configuration.rb', line 77

def postback_url
  @postback_url || error('postback_url not configured')
end

#private_keyObject



93
94
95
96
97
# File 'lib/viisp/auth/configuration.rb', line 93

def private_key
  return @private_key if @private_key
  return test_private_key if test?
  error('private key not configured')
end

#providersObject

Returns the value of attribute providers.



14
15
16
# File 'lib/viisp/auth/configuration.rb', line 14

def providers
  @providers
end

#read_timeoutObject

Returns the value of attribute read_timeout.



18
19
20
# File 'lib/viisp/auth/configuration.rb', line 18

def read_timeout
  @read_timeout
end

#service_certObject



99
100
101
# File 'lib/viisp/auth/configuration.rb', line 99

def service_cert
  @service_cert || builtin_service_cert
end

#test=(value) ⇒ Object (writeonly)

Sets the attribute test

Parameters:

  • value

    the value to set the attribute test to.



10
11
12
# File 'lib/viisp/auth/configuration.rb', line 10

def test=(value)
  @test = value
end

#user_informationObject

Returns the value of attribute user_information.



16
17
18
# File 'lib/viisp/auth/configuration.rb', line 16

def user_information
  @user_information
end

Instance Method Details

#test?Boolean

Returns:

  • (Boolean)


103
104
105
# File 'lib/viisp/auth/configuration.rb', line 103

def test?
  @test
end