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, options = {}) ⇒ Secret
Lookup information about the current token.
-
#lookup_accessor(accessor, options = {}) ⇒ Object
Lookup information about the given token accessor.
-
#lookup_self ⇒ Secret
Lookup information about the given token.
-
#renew(token, increment = 0, options = {}) ⇒ Secret
Renew the given authentication token.
-
#renew_self(increment = 0, options = {}) ⇒ Secret
Renews a lease associated with the calling token.
-
#revoke(token, options = {}) ⇒ true
(also: #revoke_tree)
Revoke the token and all its children.
-
#revoke_accessor(accessor, options = {}) ⇒ true
Revoke exactly the orphans at the id.
-
#revoke_orphan(token, options = {}) ⇒ true
Revoke exactly the orphans at the id.
-
#revoke_self ⇒ Object
Revokes the token used to call it.
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, options = {}) ⇒ Secret
Lookup information about the current token.
111 112 113 114 115 116 117 |
# File 'lib/vault/api/auth_token.rb', line 111 def lookup(token, = {}) headers = extract_headers!() json = client.post("/v1/auth/token/lookup", JSON.fast_generate( token: token, ), headers) return Secret.decode(json) end |
#lookup_accessor(accessor, options = {}) ⇒ Object
Lookup information about the given token accessor.
126 127 128 129 130 131 132 |
# File 'lib/vault/api/auth_token.rb', line 126 def lookup_accessor(accessor, = {}) headers = extract_headers!() json = client.post("/v1/auth/token/lookup-accessor", JSON.fast_generate( accessor: accessor, ), headers) return Secret.decode(json) end |
#lookup_self ⇒ Secret
Lookup information about the given token.
140 141 142 143 |
# File 'lib/vault/api/auth_token.rb', line 140 def lookup_self json = client.get("/v1/auth/token/lookup-self") return Secret.decode(json) end |
#renew(token, increment = 0, options = {}) ⇒ Secret
Renew the given authentication token.
155 156 157 158 159 160 161 162 |
# File 'lib/vault/api/auth_token.rb', line 155 def renew(token, increment = 0, = {}) headers = extract_headers!() json = client.put("/v1/auth/token/renew", JSON.fast_generate( token: token, increment: increment, ), headers) return Secret.decode(json) end |
#renew_self(increment = 0, options = {}) ⇒ Secret
Renews a lease associated with the calling token.
172 173 174 175 176 177 178 |
# File 'lib/vault/api/auth_token.rb', line 172 def renew_self(increment = 0, = {}) headers = extract_headers!() json = client.put("/v1/auth/token/renew-self", JSON.fast_generate( increment: increment, ), headers) return Secret.decode(json) end |
#revoke(token, options = {}) ⇒ true Also known as: revoke_tree
Revoke the token and all its children.
233 234 235 236 237 238 239 |
# File 'lib/vault/api/auth_token.rb', line 233 def revoke(token, = {}) headers = extract_headers!() client.put("/v1/auth/token/revoke", JSON.fast_generate( token: token, ), headers) return true end |
#revoke_accessor(accessor, options = {}) ⇒ true
Revoke exactly the orphans at the id.
216 217 218 219 220 221 222 |
# File 'lib/vault/api/auth_token.rb', line 216 def revoke_accessor(accessor, = {}) headers = extract_headers!() client.put("/v1/auth/token/revoke-accessor", JSON.fast_generate( accessor: accessor, ), headers) return true end |
#revoke_orphan(token, options = {}) ⇒ true
Revoke exactly the orphans at the id.
199 200 201 202 203 204 205 |
# File 'lib/vault/api/auth_token.rb', line 199 def revoke_orphan(token, = {}) headers = extract_headers!() client.put("/v1/auth/token/revoke-orphan", JSON.fast_generate( token: token, ), headers) return true end |
#revoke_self ⇒ Object
Revokes the token used to call it.
186 187 188 |
# File 'lib/vault/api/auth_token.rb', line 186 def revoke_self client.post("/v1/auth/token/revoke-self") end |