Documentation ¶
Index ¶
- Constants
- func EnsureOIDCServiceAccountExistsForResource(ctx context.Context, serviceAccountLister corev1listers.ServiceAccountLister, ...) error
- func GetAudience(gvk schema.GroupVersionKind, objectMeta metav1.ObjectMeta) string
- func GetJWTFromHeader(header http.Header) string
- func GetOIDCServiceAccountForResource(gvk schema.GroupVersionKind, objectMeta metav1.ObjectMeta) *v1.ServiceAccount
- func GetOIDCServiceAccountNameForResource(gvk schema.GroupVersionKind, objectMeta metav1.ObjectMeta) string
- func SetAuthHeader(jwt string, header http.Header)
- type IDToken
- type OIDCTokenProvider
- type OIDCTokenVerifier
Constants ¶
const (
AuthHeaderKey = "Authorization"
)
Variables ¶
This section is empty.
Functions ¶
func EnsureOIDCServiceAccountExistsForResource ¶
func EnsureOIDCServiceAccountExistsForResource(ctx context.Context, serviceAccountLister corev1listers.ServiceAccountLister, kubeclient kubernetes.Interface, gvk schema.GroupVersionKind, objectMeta metav1.ObjectMeta) error
EnsureOIDCServiceAccountExistsForResource makes sure the given resource has an OIDC service account with an owner reference to the resource set.
func GetAudience ¶
func GetAudience(gvk schema.GroupVersionKind, objectMeta metav1.ObjectMeta) string
GetAudience returns the audience string for the given object in the format <group>/<kind>/<namespace>/<name>
func GetJWTFromHeader ¶
GetJWTFromHeader Returns the JWT from the Authorization header
func GetOIDCServiceAccountForResource ¶
func GetOIDCServiceAccountForResource(gvk schema.GroupVersionKind, objectMeta metav1.ObjectMeta) *v1.ServiceAccount
GetOIDCServiceAccountForResource returns the service account to use for OIDC authentication for the given resource.
func GetOIDCServiceAccountNameForResource ¶
func GetOIDCServiceAccountNameForResource(gvk schema.GroupVersionKind, objectMeta metav1.ObjectMeta) string
GetOIDCServiceAccountNameForResource returns the service account name to use for OIDC authentication for the given resource.
func SetAuthHeader ¶
SetAuthHeader sets Authorization header with the given JWT
Types ¶
type OIDCTokenProvider ¶
type OIDCTokenProvider struct {
// contains filtered or unexported fields
}
func NewOIDCTokenProvider ¶
func NewOIDCTokenProvider(ctx context.Context) *OIDCTokenProvider
func (*OIDCTokenProvider) GetJWT ¶
func (c *OIDCTokenProvider) GetJWT(serviceAccount types.NamespacedName, audience string) (string, error)
GetJWT returns a JWT from the given service account for the given audience.
type OIDCTokenVerifier ¶
type OIDCTokenVerifier struct {
// contains filtered or unexported fields
}
func NewOIDCTokenVerifier ¶
func NewOIDCTokenVerifier(ctx context.Context) *OIDCTokenVerifier