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.
28 29 30 31 32 |
# File 'lib/vault/api/auth_token.rb', line 28 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.
70 71 72 73 74 |
# File 'lib/vault/api/auth_token.rb', line 70 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.
85 86 87 88 89 |
# File 'lib/vault/api/auth_token.rb', line 85 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.
99 100 101 102 103 |
# File 'lib/vault/api/auth_token.rb', line 99 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.
114 115 116 117 118 119 120 |
# File 'lib/vault/api/auth_token.rb', line 114 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.
129 130 131 132 133 134 135 |
# File 'lib/vault/api/auth_token.rb', line 129 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.
143 144 145 146 |
# File 'lib/vault/api/auth_token.rb', line 143 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.
158 159 160 161 162 163 164 165 |
# File 'lib/vault/api/auth_token.rb', line 158 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.
175 176 177 178 179 180 181 |
# File 'lib/vault/api/auth_token.rb', line 175 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.
236 237 238 239 240 241 242 |
# File 'lib/vault/api/auth_token.rb', line 236 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.
219 220 221 222 223 224 225 |
# File 'lib/vault/api/auth_token.rb', line 219 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.
202 203 204 205 206 207 208 |
# File 'lib/vault/api/auth_token.rb', line 202 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.
189 190 191 |
# File 'lib/vault/api/auth_token.rb', line 189 def revoke_self client.post("/v1/auth/token/revoke-self") end |