Class: EstEID::Authentication

Inherits:
Object
  • Object
show all
Defined in:
lib/esteid/authentication.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Authentication

Returns a new instance of Authentication.



5
6
7
# File 'lib/esteid/authentication.rb', line 5

def initialize(request)
  @eid_cert = request.headers[EstEID.config.certificate_header]
end

Instance Attribute Details

#eid_certObject (readonly)

Returns the value of attribute eid_cert.



3
4
5
# File 'lib/esteid/authentication.rb', line 3

def eid_cert
  @eid_cert
end

Instance Method Details

#first_nameObject



18
19
20
21
# File 'lib/esteid/authentication.rb', line 18

def first_name
  return unless valid?
  normalize(data_hash["GN"])
end

#identity_codeObject



13
14
15
16
# File 'lib/esteid/authentication.rb', line 13

def identity_code
  return unless valid?
  data_hash["serialNumber"].gsub('PNOEE-', '')
end

#last_nameObject



23
24
25
26
# File 'lib/esteid/authentication.rb', line 23

def last_name
  return unless valid?
  normalize(data_hash["SN"])
end

#valid?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/esteid/authentication.rb', line 9

def valid?
  eid_cert_present?
end