oidc

package
v1.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package oidc ...

Package oidc provides functionality related OIDC based IDPs.

Index

Constants

View Source
const (
	// WellKnownPath is the path to the well-known OIDC configuration.
	WellKnownPath = "/.well-known/openid-configuration"
)

Variables

View Source
var ErrUnexpectedSatusCode = fmt.Errorf("unexpected status code")

ErrUnexpectedSatusCode is returned when HTTP 200 is not returned.

Functions

func ValidateClientID added in v1.5.0

func ValidateClientID(clientID string) error

ValidateClientID checks if the provided client ID is valid.

func ValidateScopes added in v1.5.0

func ValidateScopes(scopes []string) error

ValidateScopes checks if the provided scopes are valid.

func ValidateURL added in v1.5.0

func ValidateURL(u string) error

ValidateURL checks if the provided URL is valid.

Types

type Config

type Config struct {
	// KubeconfigPath is a path to a kubeconfig
	KubeconfigPath string
	// Pretty print the output.
	Pretty bool
	// IssuerURL OIDC issuer url.
	IssuerURL string
	// ClientID ID of the client OIDC app.
	ClientID string
	// Scopes requested scopes.
	Scopes []string
}

Config stores configuration for the OIDC command.

func (*Config) PopulateClientID added in v1.5.0

func (cfg *Config) PopulateClientID(ctx context.Context) error

PopulateClientID function to fill the configuration with the required ClientID. This function shall be called only in cases when there is no other way to obtain value for ClientID. User will be asked to provide the ClientID in interactive mode. Provided by user value will be parsed, validated and stored in the ClientID property. Note: in case ClientID is not empty - it will be overwritten by user's input.

func (*Config) PopulateIssuerURL added in v1.5.0

func (cfg *Config) PopulateIssuerURL(ctx context.Context) error

PopulateIssuerURL function to fill the configuration with the required IssuerURL. This function shall be called only in cases when there is no other way to obtain value for IssuerURL. User will be asked to provide the IssuerURL in interactive mode. The URL provided by the user will be parsed, validated and stored in the IssuerURL property. Note: in case IssuerURL is not empty - it will be overwritten by user's input.

type IDTokenVerifier added in v1.17.1

type IDTokenVerifier struct {
	// contains filtered or unexported fields
}

IDTokenVerifier validates ID tokens that the OIDC provider issued to the Everest client.

Only ID tokens are accepted: they are the one OIDC artifact whose audience is guaranteed to be the client the user signed in to. Access tokens (JWT or opaque) and UserInfo responses don't prove which application they were issued to, so accepting them would let any other application of the same provider sign in to Everest as its users.

func NewIDTokenVerifier added in v1.17.1

func NewIDTokenVerifier(keyFunc jwt.Keyfunc, clientID string, issuers ...string) (*IDTokenVerifier, error)

NewIDTokenVerifier returns a verifier for ID tokens signed with a key from keyFunc, issued by one of issuers and addressed to clientID.

func (*IDTokenVerifier) Verify added in v1.17.1

func (v *IDTokenVerifier) Verify(rawIDToken string) (*Identity, error)

Verify validates rawIDToken as described in OpenID Connect Core 1.0 §3.1.3.7 and returns the identity it carries. Nonce validation is left to the frontend that started the login. The token must also have been issued within maxIDTokenAge (§3.1.3.7 step 10).

type Identity added in v1.17.1

type Identity struct {
	Subject           string
	Email             string
	Name              string
	PreferredUsername string
	Groups            StringList
}

Identity contains the subset of ID token claims Everest reads from the OIDC provider. Name and PreferredUsername are only present when the `profile` scope was granted.

type OIDC

type OIDC struct {
	// contains filtered or unexported fields
}

OIDC describes the command to configure OIDC settings.

func NewOIDC

func NewOIDC(c Config, l *zap.SugaredLogger) (*OIDC, error)

NewOIDC returns a new OIDC struct.

func (*OIDC) Run

func (u *OIDC) Run(ctx context.Context) error

Run runs the command.

type ProviderConfig

type ProviderConfig struct {
	OriginalIssuer string `json:"OriginalIssuer"`
	// ClientID is the Everest client registered with the provider. It comes from the Everest
	// settings, not from the provider's well-known configuration.
	ClientID      string   `json:"-"`
	Issuer        string   `json:"issuer"`
	AuthURL       string   `json:"authorization_endpoint"`
	TokenURL      string   `json:"token_endpoint"`
	DeviceAuthURL string   `json:"device_authorization_endpoint"`
	JWKSURL       string   `json:"jwks_uri"`
	UserInfoURL   string   `json:"userinfo_endpoint"`
	Algorithms    []string `json:"id_token_signing_alg_values_supported"`
}

ProviderConfig contains the configuration of an OIDC provider.

func NewProviderConfig added in v1.6.0

func NewProviderConfig(ctx context.Context, issuer string) (ProviderConfig, error)

NewProviderConfig fetches the OIDC provider configuration from the issuer's well-known endpoint and returns it as a ProviderConfig.

func (*ProviderConfig) NewIDTokenVerifier added in v1.17.1

func (c *ProviderConfig) NewIDTokenVerifier(ctx context.Context) (*IDTokenVerifier, error)

NewIDTokenVerifier returns a verifier for ID tokens that this provider issued to ClientID. Both the issuer advertised by the provider and the one configured in Everest are accepted, because they differ for some providers (e.g. Microsoft Entra ID).

func (*ProviderConfig) NewKeyFunc added in v1.6.0

func (c *ProviderConfig) NewKeyFunc(ctx context.Context) (jwt.Keyfunc, error)

NewKeyFunc returns a new function for getting the public JWK keys from the OIDC provider at the given issuer URL.

type StringList added in v1.17.0

type StringList []string

StringList decodes a claim that IdPs emit either as a single string or as an array. Non-string array items are skipped, so an unexpected shape never fails the login.

func (*StringList) UnmarshalJSON added in v1.17.0

func (s *StringList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL