Documentation
¶
Overview ¶
Kubernetes HTTP auth client interface for reading client IDs and building requests.
Index ¶
Constants ¶
View Source
const ( // DefaultIDHeader is the default header key used via // Interface.WithHeader. This constant is exported so that the // middleware can also use it as a default value. DefaultIDHeader = "X-Client-Id" )
Variables ¶
View Source
var ( // LongLivedTokenOptions contains values that match the default // behavior for long-lived (no expiry) service account tokens. LongLivedTokenOptions = &Options{ IDHeader: DefaultIDHeader, TokenPath: "/var/run/secrets/kubernetes.io/serviceaccount/token", TokenExpiry: -1 * time.Second, } // ExpiringTokenOptions contains values that match those used // in the tutorial at // https://learnk8s.io/microservices-authentication-kubernetes. ExpiringTokenOptions = &Options{ IDHeader: DefaultIDHeader, TokenPath: "/var/run/secrets/tokens/api-token", TokenExpiry: 5 * time.Minute, } )
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface interface { IDer WithHeaderer }
Interface provides methods for working with client IDs as provided by service account tokens.
type Options ¶
type Options struct { // IDHeader is the header key used when building a request // via Interface.WithHeader. IDHeader string // TokenPath is the file path from which the client ID will be // read via Interface.ID. TokenPath string // TokenExpiry defines the expected expiry time of the token // read from TokenPath. A TokenExpiry value that is less than // zero will build a long lived token reader that caches the // token value indefinitely. TokenExpiry time.Duration }
Options may be passed to New when creating a client Interface.
Click to show internal directories.
Click to hide internal directories.