Class: EstEID::Authentication
- Inherits:
-
Object
- Object
- EstEID::Authentication
- Defined in:
- lib/esteid/authentication.rb
Instance Attribute Summary collapse
-
#eid_cert ⇒ Object
readonly
Returns the value of attribute eid_cert.
Instance Method Summary collapse
- #first_name ⇒ Object
- #identity_code ⇒ Object
-
#initialize(request) ⇒ Authentication
constructor
A new instance of Authentication.
- #last_name ⇒ Object
- #valid? ⇒ Boolean
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_cert ⇒ Object (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_name ⇒ Object
18 19 20 21 |
# File 'lib/esteid/authentication.rb', line 18 def first_name return unless valid? normalize(data_hash["GN"]) end |
#identity_code ⇒ Object
13 14 15 16 |
# File 'lib/esteid/authentication.rb', line 13 def identity_code return unless valid? data_hash["serialNumber"].gsub('PNOEE-', '') end |
#last_name ⇒ Object
23 24 25 26 |
# File 'lib/esteid/authentication.rb', line 23 def last_name return unless valid? normalize(data_hash["SN"]) end |
#valid? ⇒ Boolean
9 10 11 |
# File 'lib/esteid/authentication.rb', line 9 def valid? eid_cert_present? end |