Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateJWT ¶
func CreateJWT(ctx context.Context, c client.Client, saRef *ServiceAccountReference, aud []string, exp time.Duration) (string, error)
CreateJWT generates a JSON Web Token (JWT) for the specified service account in the given namespace with the provided audiences. If no audiences are provided, an error is returned. The function also loads the controller ServiceAccount token to know which audiences the controller token is intended for to also reject those. These rejections force created tokens to always target external services instead of the local Kubernetes cluster, which is the only use case for the auth library. A nil saRef means creating the token for the controller ServiceAccount.
Types ¶
type ServiceAccountReference ¶
ServiceAccountReference represents a reference to a Kubernetes ServiceAccount, including its name and namespace.
func (*ServiceAccountReference) String ¶
func (r *ServiceAccountReference) String() string
String implements the fmt.Stringer interface.