oauthstate

package
v0.2023.21 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode added in v0.8.1

func Encode(state interface{}) (token string, err error)

Encode encodes the provided state as a URL-safe string.

func ParseInto added in v0.8.1

func ParseInto(state string, dest interface{}) error

ParseInto tries to parse the provided state into the dest object. Note that no validation is done on the parsed object.

Types

type OAuthInfo added in v0.8.1

type OAuthInfo struct {
	// TokenName is the name of the SPIAccessToken object for which we are initiating the OAuth flow
	TokenName string `json:"tokenName"`

	// TokenNamespace is the namespace of the SPIAccessToken object for which we are initiating the OAuth flow
	TokenNamespace string `json:"tokenNamespace"`

	// Scopes is the list of the service-provider-specific scopes that we require in the service provider
	Scopes []string `json:"scopes"`

	// ServiceProviderName is the type of the service provider
	ServiceProviderName config.ServiceProviderName `json:"serviceProviderType"`

	// ServiceProviderUrl the URL where the service provider is to be reached
	ServiceProviderUrl string `json:"serviceProviderUrl"`
}

OAuthInfo is the state that is initially put to the OAuth URL by the operator. This state is put by the operator to the status of the SPIAccessToken and points to an endpoint in the OAuth service. OAuth service requires kubernetes authentication on this endpoint, reads this data and redirects the caller once again to the actual service provider with a random key to its session storage as the OAuth state.

func ParseOAuthInfo added in v0.8.1

func ParseOAuthInfo(state string) (OAuthInfo, error)

ParseOAuthInfo parses the state from the URL query parameter and returns the anonymous state struct. It is just a typed variant of the ParseInto function.

Jump to

Keyboard shortcuts

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