auth

package
v0.89.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAuthTokenExpired = fmt.Errorf("authorization token expired")

Functions

func NewOAuth2Config

func NewOAuth2Config(ctx context.Context, orgURL string, clientID string) (*oauth2.Config, error)

Types

type AuthorizationResponse

type AuthorizationResponse struct {
	AccessToken      string `json:"access_token"`
	IDToken          string `json:"id_token"`
	Scope            string `json:"scope"`
	TokenType        string `json:"token_type"`
	ExpiresIn        int    `json:"expires_in"`
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
	RefreshToken     string `json:"refresh_token"`
	ExpiresAt        int64  `json:"expires_at"`
}

func EnsureValidAuthData

func EnsureValidAuthData(ctx context.Context, auth *AuthorizationResponse, orgURL string, clientID string) (*AuthorizationResponse, error)

func Login

func Login(ctx context.Context, orgURL string, clientID string) (AuthorizationResponse, error)

func Refresh

func Refresh(ctx context.Context, config *oauth2.Config, refreshToken string) (*AuthorizationResponse, error)

func (*AuthorizationResponse) GetExpiresAt

func (a *AuthorizationResponse) GetExpiresAt() int64

func (AuthorizationResponse) IsExpired

func (a AuthorizationResponse) IsExpired() bool

type ContextKeyAuthData

type ContextKeyAuthData struct{}

type LoginResponse

type LoginResponse struct {
	DeviceCode              string `json:"device_code"`
	UserCode                string `json:"user_code"`
	VerificationURI         string `json:"verification_uri"`
	ExpiresIn               int    `json:"expires_in"`
	Interval                int    `json:"interval"`
	VerificationURIComplete string `json:"verification_uri_complete"`
	Message                 string `json:"message"`
}

type ServerConfig

type ServerConfig struct {
	Issuer                               string   `json:"issuer"`
	ClientID                             string   `json:"client_ids"` // TODO: I think this can just be removed
	RestrictedClientIDs                  []string `json:"restricted_client_ids"`
	RestrictedClientAllowedEndpointsList []string `json:"restricted_endpoints"`
	Audience                             string   `json:"audience"`
	JWKSURL                              string   `json:"jwks_url"`
}

func (ServerConfig) IsValid

func (s ServerConfig) IsValid() bool

Jump to

Keyboard shortcuts

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