Class: RestPki::Authentication

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(restpki_client) ⇒ Authentication

Returns a new instance of Authentication.



9
10
11
12
13
14
# File 'lib/rest_pki/authentication.rb', line 9

def initialize(restpki_client)
    @restpki_client = restpki_client
    @certificate_info = nil
    @done = false
    @ignore_revocation_status_unknown = false
end

Instance Attribute Details

#ignore_revocation_status_unknownObject

Returns the value of attribute ignore_revocation_status_unknown.



7
8
9
# File 'lib/rest_pki/authentication.rb', line 7

def ignore_revocation_status_unknown
  @ignore_revocation_status_unknown
end

Instance Method Details

#certificate_infoObject



36
37
38
39
40
41
# File 'lib/rest_pki/authentication.rb', line 36

def certificate_info
    unless @done
        raise 'The field "certificate_info" can only be accessed after calling the complete_with_webpki method'
    end
    @certificate_info
end

#complete_with_webpki(token) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/rest_pki/authentication.rb', line 25

def complete_with_webpki(token)
    response = @restpki_client.post("Api/Authentications/#{token}/Finalize", nil, 'authentication_model')
    
    unless response['certificate'].nil?
        @certificate_info = response['certificate']
    end
    @done = true

    ValidationResults.new(response['validationResults'])
end

#start_with_webpki(security_context_id) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/rest_pki/authentication.rb', line 16

def start_with_webpki(security_context_id)
    request = {
        securityContextId: security_context_id,
        ignoreRevocationStatusUnknown: @ignore_revocation_status_unknown
    }
    response = @restpki_client.post('Api/Authentications', request, 'authentication_model')
    response['token']
end