Class: Conjur::API::CertAuthenticator
- Inherits:
-
Object
- Object
- Conjur::API::CertAuthenticator
- Includes:
- TokenExpiration
- Defined in:
- lib/conjur/api/authn_cert.rb
Overview
Authenticator that uses mutual TLS (authn-cert) to obtain Conjur access tokens. The client certificate is presented during the TLS handshake; an empty POST to the authn-cert endpoint returns a Conjur access token.
Two modes:
- Request mode:
host_idis provided; Conjur validates the cert matches the host. - SPIFFE mode:
host_idis nil; Conjur derives the host from the cert's SPIFFE SAN URI.
Constant Summary
Constants included from TokenExpiration
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#cert ⇒ Object
readonly
Returns the value of attribute cert.
-
#host_id ⇒ Object
readonly
Returns the value of attribute host_id.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#service_id ⇒ Object
readonly
Returns the value of attribute service_id.
Attributes included from TokenExpiration
Instance Method Summary collapse
-
#initialize(account, service_id, cert, key, host_id = nil) ⇒ CertAuthenticator
constructor
A new instance of CertAuthenticator.
- #refresh_token ⇒ Object
Methods included from TokenExpiration
#gettime, #needs_token_refresh?, #token_age, #update_token_born
Constructor Details
#initialize(account, service_id, cert, key, host_id = nil) ⇒ CertAuthenticator
Returns a new instance of CertAuthenticator.
20 21 22 23 24 25 26 27 |
# File 'lib/conjur/api/authn_cert.rb', line 20 def initialize(account, service_id, cert, key, host_id = nil) @account = account @service_id = service_id @cert = cert @key = key @host_id = host_id update_token_born end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
18 19 20 |
# File 'lib/conjur/api/authn_cert.rb', line 18 def account @account end |
#cert ⇒ Object (readonly)
Returns the value of attribute cert.
18 19 20 |
# File 'lib/conjur/api/authn_cert.rb', line 18 def cert @cert end |
#host_id ⇒ Object (readonly)
Returns the value of attribute host_id.
18 19 20 |
# File 'lib/conjur/api/authn_cert.rb', line 18 def host_id @host_id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
18 19 20 |
# File 'lib/conjur/api/authn_cert.rb', line 18 def key @key end |
#service_id ⇒ Object (readonly)
Returns the value of attribute service_id.
18 19 20 |
# File 'lib/conjur/api/authn_cert.rb', line 18 def service_id @service_id end |
Instance Method Details
#refresh_token ⇒ Object
29 30 31 32 33 |
# File 'lib/conjur/api/authn_cert.rb', line 29 def refresh_token Conjur::API.authenticate_cert(service_id, cert, key, account: account, host_id: host_id).tap do update_token_born end end |