sso

package
v1.116.5 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Error is the default error class for the package.
	Error = errs.Class("sso")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled               bool                  `help:"whether SSO is enabled." default:"false"`
	OidcProviderInfos     OidcProviderInfos     `help:"semicolon-separated provider:client-id,client-secret,provider-url." default:""`
	EmailProviderMappings EmailProviderMappings `help:"semicolon-separated provider:email-regex as provided in oidc-provider-infos." default:""`
}

Config is a configuration struct for SSO.

type EmailProviderMappings

type EmailProviderMappings struct {
	Values map[string]regexp.Regexp
}

EmailProviderMappings is a map of sso provider to email regex.

func (*EmailProviderMappings) Set

func (epm *EmailProviderMappings) Set(s string) error

Set email provider mappings to a provided parsed string.

func (*EmailProviderMappings) String

func (epm *EmailProviderMappings) String() string

func (EmailProviderMappings) Type

Type returns the type of the pflag.Value.

type OidcProviderInfo

type OidcProviderInfo struct {
	ClientID     string
	ClientSecret string
	ProviderURL  url.URL
}

OidcProviderInfo contains the information needed to connect to an OIDC provider.

type OidcProviderInfos

type OidcProviderInfos struct {
	Values map[string]OidcProviderInfo
}

OidcProviderInfos is a map of SSO providers to OIDC provider infos.

func (*OidcProviderInfos) Set

func (si *OidcProviderInfos) Set(s string) error

Set OIDC provider infos to the parsed string.

func (*OidcProviderInfos) String

func (si *OidcProviderInfos) String() string

func (OidcProviderInfos) Type

func (OidcProviderInfos) Type() string

Type returns the type of the pflag.Value.

type OidcSetup

type OidcSetup struct {
	Config   oauth2.Config
	Verifier *goOIDC.IDTokenVerifier
}

OidcSetup contains the configuration and verifier for an OIDC provider.

type OidcSsoClaims

type OidcSsoClaims struct {
	Sub   string `json:"sub"`
	Email string `json:"email"`
	Name  string `json:"name"`
}

OidcSsoClaims holds info for OIDC token claims.

type Service

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

Service is a Service for managing SSO.

func NewService

func NewService(satelliteAddress string, config Config) *Service

NewService creates a new Service.

func (*Service) GetOidcSetupByProvider

func (s *Service) GetOidcSetupByProvider(provider string) *OidcSetup

GetOidcSetupByProvider returns the OIDC setup for the given provider.

func (*Service) GetProviderByEmail

func (s *Service) GetProviderByEmail(email string) string

GetProviderByEmail returns the provider for the given email.

func (*Service) Initialize

func (s *Service) Initialize(ctx context.Context) (err error)

Initialize initializes the OIDC providers.

func (*Service) InitializeRoutes

func (s *Service) InitializeRoutes(routingFn func(provider string))

InitializeRoutes provides a routingFn with configured providers to configure the routes for sso.

Jump to

Keyboard shortcuts

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