Class: Vault::AuthToken
Instance Attribute Summary
Attributes inherited from Request
Instance Method Summary collapse
-
#accessors(options = {}) ⇒ Array<Secret>
Lists all token accessors.
-
#create(options = {}) ⇒ Secret
Create an authentication token.
-
#create_orphan(options = {}) ⇒ Secret
Create an orphaned authentication token.
-
#create_with_role(name, options = {}) ⇒ Secret
Create an orphaned authentication token.
-
#lookup(token) ⇒ Secret
Lookup information about the current token.
-
#lookup_accessor(accessor) ⇒ Object
Lookup information about the given token accessor.
-
#lookup_self ⇒ Secret
Lookup information about the given token.
-
#renew(id, increment = 0) ⇒ Secret
Renew the given authentication token.
-
#renew_self(increment = 0) ⇒ Secret
Renews a lease associated with the callign token.
-
#revoke_orphan(id) ⇒ true
Revoke exactly the orphans at the id.
-
#revoke_prefix(prefix) ⇒ true
Revoke all auth at the given prefix.
-
#revoke_self ⇒ Object
Revokes the token used to call it.
-
#revoke_tree(id) ⇒ true
Revoke all auths in the tree.
Methods inherited from Request
Methods included from EncodePath
Constructor Details
This class inherits a constructor from Vault::Request
Instance Method Details
#accessors(options = {}) ⇒ Array<Secret>
Lists all token accessors.
25 26 27 28 29 |
# File 'lib/vault/api/auth_token.rb', line 25 def accessors( = {}) headers = extract_headers!() json = client.list("/v1/auth/token/accessors", , headers) return Secret.decode(json) end |
#create(options = {}) ⇒ Secret
Create an authentication token. Note that the parameters specified below are not validated and passed directly to the Vault server. Depending on the version of Vault in operation, some of these options may not work, and newer options may be available that are not listed here.
67 68 69 70 71 |
# File 'lib/vault/api/auth_token.rb', line 67 def create( = {}) headers = extract_headers!() json = client.post("/v1/auth/token/create", JSON.fast_generate(), headers) return Secret.decode(json) end |
#create_orphan(options = {}) ⇒ Secret
Create an orphaned authentication token.
82 83 84 85 86 |
# File 'lib/vault/api/auth_token.rb', line 82 def create_orphan( = {}) headers = extract_headers!() json = client.post("/v1/auth/token/create-orphan", JSON.fast_generate(), headers) return Secret.decode(json) end |
#create_with_role(name, options = {}) ⇒ Secret
Create an orphaned authentication token.
96 97 98 99 100 |
# File 'lib/vault/api/auth_token.rb', line 96 def create_with_role(name, = {}) headers = extract_headers!() json = client.post("/v1/auth/token/create/#{encode_path(name)}", JSON.fast_generate(), headers) return Secret.decode(json) end |
#lookup(token) ⇒ Secret
Lookup information about the current token.
110 111 112 113 |
# File 'lib/vault/api/auth_token.rb', line 110 def lookup(token) json = client.get("/v1/auth/token/lookup/#{encode_path(token)}") return Secret.decode(json) end |
#lookup_accessor(accessor) ⇒ Object
Lookup information about the given token accessor.
119 120 121 122 123 124 |
# File 'lib/vault/api/auth_token.rb', line 119 def lookup_accessor(accessor) json = client.post("/v1/auth/token/lookup-accessor", JSON.fast_generate( accessor: accessor, )) return Secret.decode(json) end |
#lookup_self ⇒ Secret
Lookup information about the given token.
132 133 134 135 |
# File 'lib/vault/api/auth_token.rb', line 132 def lookup_self json = client.get("/v1/auth/token/lookup-self") return Secret.decode(json) end |
#renew(id, increment = 0) ⇒ Secret
Renew the given authentication token.
147 148 149 150 151 152 |
# File 'lib/vault/api/auth_token.rb', line 147 def renew(id, increment = 0) json = client.put("/v1/auth/token/renew/#{id}", JSON.fast_generate( increment: increment, )) return Secret.decode(json) end |
#renew_self(increment = 0) ⇒ Secret
Renews a lease associated with the callign token.
162 163 164 165 166 167 |
# File 'lib/vault/api/auth_token.rb', line 162 def renew_self(increment = 0) json = client.put("/v1/auth/token/renew-self", JSON.fast_generate( increment: increment, )) return Secret.decode(json) end |
#revoke_orphan(id) ⇒ true
Revoke exactly the orphans at the id.
188 189 190 191 |
# File 'lib/vault/api/auth_token.rb', line 188 def revoke_orphan(id) client.put("/v1/auth/token/revoke-orphan/#{id}", nil) return true end |
#revoke_prefix(prefix) ⇒ true
Revoke all auth at the given prefix.
202 203 204 205 |
# File 'lib/vault/api/auth_token.rb', line 202 def revoke_prefix(prefix) client.put("/v1/auth/token/revoke-prefix/#{prefix}", nil) return true end |
#revoke_self ⇒ Object
Revokes the token used to call it.
175 176 177 |
# File 'lib/vault/api/auth_token.rb', line 175 def revoke_self client.post("/v1/auth/token/revoke-self") end |
#revoke_tree(id) ⇒ true
Revoke all auths in the tree.
216 217 218 219 |
# File 'lib/vault/api/auth_token.rb', line 216 def revoke_tree(id) client.put("/v1/auth/token/revoke/#{id}", nil) return true end |