oidc

package
v2.53.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeviceAuthKeyClientID   = "client_id"
	DeviceAuthKeyScope      = "scope"
	DeviceAuthKeyDeviceCode = "device_code"
	DeviceAuthKeyGrantType  = "grant_type"

	ErrorTypeAuthPending = "authorization_pending"
	ErrorTypeSlowDown    = "slow_down"

	DeviceAuthScopes    = "openid profile email groups offline_access audience:server:client_id:dex-k8s-authenticator"
	DeviceAuthGrantType = "urn:ietf:params:oauth:grant-type:device_code"
)

Variables

This section is empty.

Functions

func ConvertTokenToRawIDToken

func ConvertTokenToRawIDToken(token *oauth2.Token) (string, error)

func GenerateChallenge

func GenerateChallenge() (string, error)

func IsAuthorizationPendingError added in v2.48.0

func IsAuthorizationPendingError(err error) bool

IsAuthorizationPendingError asserts authorizationPendingError.

func IsCannotDecodeToken

func IsCannotDecodeToken(err error) bool

IsCannotDecodeToken asserts cannotDecodeTokenError.

func IsCannotGetDeviceCodeError added in v2.48.0

func IsCannotGetDeviceCodeError(err error) bool

IsCannotGetDeviceCodeError asserts cannotGetDeviceCodeError.

func IsCannotGetDeviceTokenError added in v2.48.0

func IsCannotGetDeviceTokenError(err error) bool

IsCannotGetDeviceTokenError asserts cannotGetDeviceTokenError.

func IsCannotParseJwtError added in v2.48.0

func IsCannotParseJwtError(err error) bool

IsCannotParseJwtError asserts cannotParseJwtError.

func IsCannotRenewToken

func IsCannotRenewToken(err error) bool

IsCannotRenewToken asserts cannotRenewTokenError.

func IsInvalidChallenge

func IsInvalidChallenge(err error) bool

IsInvalidChallenge asserts invalidChallengeError.

func IsTooManyAuthRequestsError added in v2.48.0

func IsTooManyAuthRequestsError(err error) bool

IsTooManyAuthRequestsError asserts tooManyAuthRequestsError.

Types

type Authenticator

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

func New

func New(ctx context.Context, c Config) (*Authenticator, error)

func (*Authenticator) GetAuthSelectionURL added in v2.31.0

func (a *Authenticator) GetAuthSelectionURL(connectorType string) string

func (*Authenticator) GetAuthURL

func (a *Authenticator) GetAuthURL(connectorID string) string

func (*Authenticator) HandleIssuerResponse

func (a *Authenticator) HandleIssuerResponse(ctx context.Context, challenge string, code string) (UserInfo, error)

func (*Authenticator) RenewToken

func (a *Authenticator) RenewToken(ctx context.Context, refreshToken string) (idToken string, rToken string, err error)

type Claims

type Claims struct {
	Email    string   `json:"email"`
	Verified bool     `json:"email_verified"`
	Groups   []string `json:"groups"`
}

type Config

type Config struct {
	ClientID     string
	ClientSecret string
	Issuer       string
	RedirectURL  string
	AuthScopes   []string
}

type DeviceAuthenticator added in v2.48.0

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

func NewDeviceAuthenticator added in v2.48.0

func NewDeviceAuthenticator(clientID string, i *installation.Installation) *DeviceAuthenticator

func (*DeviceAuthenticator) LoadDeviceCode added in v2.48.0

func (a *DeviceAuthenticator) LoadDeviceCode() (DeviceCodeResponseData, error)

func (*DeviceAuthenticator) LoadDeviceToken added in v2.48.0

type DeviceCodeResponseData added in v2.48.0

type DeviceCodeResponseData struct {
	DeviceCode              string `json:"device_code"`
	UserCode                string `json:"user_code"`
	VerificationUri         string `json:"verification_uri"`
	VerificationUriComplete string `json:"verification_uri_complete"`
	ExpiresIn               int    `json:"expires_in"`
	Interval                int    `json:"interval"`
}

type DeviceTokenResponseData added in v2.48.0

type DeviceTokenResponseData struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	IdToken      string `json:"id_token"`
}

type ErrorResponseData added in v2.48.0

type ErrorResponseData struct {
	Error string `json:"error"`
}

type JwtName added in v2.48.0

type JwtName struct {
	Name string `json:"name"`
}

type UserInfo

type UserInfo struct {
	Email         string
	EmailVerified bool
	IDToken       string
	RefreshToken  string
	IssuerURL     string
	Username      string
	Groups        []string
	ClientID      string
	ClientSecret  string
}

Jump to

Keyboard shortcuts

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