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