Class: EstEID::Validation

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

Constant Summary collapse

ERROR_STATUSES =
{
  'REVOKED' => 'cert_revoked',
  'UNKNOWN' => 'cert_unknown',
  'EXPIRED' => 'cert_expired',
  'SUSPENDED' => 'cert_suspended',
  '100' => '100',
  '101' => '101',
  '102' => '102',
  '103' => '103',
  '200' => '200',
  '201' => '201',
  '202' => '202',
  '203' => '203',
  '300' => '300',
  '301' => '301',
  '302' => '302',
  '303' => '303',
  '304' => '304',
  '305' => '305',
  '413' => '413',
  '503' => '503'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Validation

Returns a new instance of Validation.



30
31
32
# File 'lib/esteid/validation.rb', line 30

def initialize(request)
  @eid_public_key = request.headers[EstEID.config.public_key_header]
end

Instance Attribute Details

#eid_public_keyObject (readonly)

Returns the value of attribute eid_public_key.



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

def eid_public_key
  @eid_public_key
end

Instance Method Details

#statusObject



39
40
41
42
# File 'lib/esteid/validation.rb', line 39

def status
  return soap_error_code if soap_fault?
  certificate_status
end

#valid?Boolean

Returns:

  • (Boolean)


34
35
36
37
# File 'lib/esteid/validation.rb', line 34

def valid?
  return false unless eid_public_key_present?
  status == "GOOD"
end