authentication

package
v1.74.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotImplemented          = errors.New("not implemented")
	ErrAlreadyExists           = errors.New("already exists")
	ErrInsufficientPermissions = errors.New("insufficient permissions")
	ErrUnexpectedStatusCode    = errors.New("unexpected status code")
	ErrInvalidRequest          = errors.New("invalid request")
	ErrSessionExpired          = errors.New("session expired")
	ErrInvalidTokenFormat      = errors.New("invalid token format")
	ErrExternalLoginFailed     = errors.New("external principal login failed")
)

Functions

This section is empty.

Types

type APIService

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

func NewAPIService

func NewAPIService(apiEndpoint string, validateIDTokenClaims map[string]string, logger logging.Logger, externalPrincipalsEnabled bool) (*APIService, error)

func NewAPIServiceWithClients

func NewAPIServiceWithClients(apiClient apiclient.ClientWithResponsesInterface, logger logging.Logger, validateIDTokenClaims map[string]string, externalPrincipalsEnabled bool) (*APIService, error)

func (*APIService) ExternalPrincipalLogin added in v1.18.0

func (s *APIService) ExternalPrincipalLogin(ctx context.Context, identityRequest map[string]interface{}) (*apiclient.ExternalPrincipal, error)

func (*APIService) IsExternalPrincipalsEnabled added in v1.18.0

func (s *APIService) IsExternalPrincipalsEnabled() bool

func (*APIService) OauthCallback added in v1.57.0

func (s *APIService) OauthCallback(w http.ResponseWriter, r *http.Request, _ sessions.Store)

func (*APIService) RegisterAdditionalRoutes added in v1.57.0

func (s *APIService) RegisterAdditionalRoutes(_ *chi.Mux, _ sessions.Store)

func (*APIService) ValidateSTS

func (s *APIService) ValidateSTS(ctx context.Context, code, redirectURI, state string) (string, error)

ValidateSTS calls the external authentication service to validate the STS parameters validates the required claims and returns the external user id and expiration time

type DummyService

type DummyService struct{}

func NewDummyService

func NewDummyService() *DummyService

func (DummyService) ExternalPrincipalLogin added in v1.18.0

func (d DummyService) ExternalPrincipalLogin(_ context.Context, _ map[string]interface{}) (*apiclient.ExternalPrincipal, error)

func (DummyService) IsExternalPrincipalsEnabled added in v1.18.0

func (d DummyService) IsExternalPrincipalsEnabled() bool

func (DummyService) OauthCallback added in v1.57.0

func (d DummyService) OauthCallback(_ http.ResponseWriter, _ *http.Request, _ sessions.Store)

func (DummyService) RegisterAdditionalRoutes added in v1.57.0

func (d DummyService) RegisterAdditionalRoutes(_ *chi.Mux, _ sessions.Store)

func (DummyService) ValidateSTS

func (d DummyService) ValidateSTS(ctx context.Context, code, redirectURI, state string) (string, error)

type LoginTokenProvider added in v1.73.0

type LoginTokenProvider interface {
	// GetRedirect is called to start logging in via an authenticated user.  It is called
	// unauthenticated, initiated by the requesting client, with no user on the context.
	GetRedirect(ctx context.Context) (*TokenRedirect, error)
	// Release drops token into mailbox, releasing it for the next GetToken call.  It is
	// called authenticated, initiated by the web browser running.
	Release(ctx context.Context, loginRequestToken string) error
	// GetToken returns a token waiting on mailbox.  It is called unauthenticated, initiated
	// the requesting client, with no user on the context.
	GetToken(ctx context.Context, mailbox string) (string, time.Time, error)
}

type Service

type Service interface {
	IsExternalPrincipalsEnabled() bool
	ExternalPrincipalLogin(ctx context.Context, identityRequest map[string]interface{}) (*apiclient.ExternalPrincipal, error)
	// ValidateSTS validates the STS parameters and returns the external user ID
	ValidateSTS(ctx context.Context, code, redirectURI, state string) (string, error)
	RegisterAdditionalRoutes(r *chi.Mux, sessionStore sessions.Store)
	OauthCallback(w http.ResponseWriter, r *http.Request, sessionStore sessions.Store)
}

type TokenRedirect added in v1.73.0

type TokenRedirect struct {
	RedirectURL string
	Mailbox     string
}

Directories

Path Synopsis
externalidp
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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