github.com/hashicorp/vault/sdk@v0.11.0/helper/pluginutil/identity_token.go (about) 1 // Copyright (c) HashiCorp, Inc. 2 // SPDX-License-Identifier: MPL-2.0 3 4 package pluginutil 5 6 import ( 7 "time" 8 ) 9 10 const redactedTokenString = "ey***" 11 12 type IdentityTokenRequest struct { 13 // Audience identifies the recipient of the token. The requested 14 // value will be in the "aud" claim. Required. 15 Audience string 16 // TTL is the requested duration that the token will be valid for. 17 // Optional with a default of 1hr. 18 TTL time.Duration 19 } 20 21 type IdentityTokenResponse struct { 22 // Token is the plugin identity token. 23 Token IdentityToken 24 // TTL is the duration that the token is valid for after truncation is applied. 25 // The TTL may be truncated depending on the lifecycle of its signing key. 26 TTL time.Duration 27 } 28 29 type IdentityToken string 30 31 // String returns a redacted token string. Use the Token() method 32 // to obtain the non-redacted token contents. 33 func (t IdentityToken) String() string { 34 return redactedTokenString 35 } 36 37 // Token returns the non-redacted token contents. 38 func (t IdentityToken) Token() string { 39 return string(t) 40 }