sso

package
v0.0.0-...-5e932ec Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNS                           = errorx.NewNamespace("error.api.user.sso")
	ErrUnsupportedUser              = ErrNS.NewType("unsupported_user")
	ErrInvalidImpersonateCredential = ErrNS.NewType("invalid_impersonate_credential")
	ErrDiscoverFailed               = ErrNS.NewType("discover_failed")
	ErrBadConfig                    = ErrNS.NewType("bad_config")
	ErrOIDCInternalErr              = ErrNS.NewType("oidc_internal_err")
)
View Source
var Module = fx.Options(
	fx.Provide(NewService),
	fx.Invoke(registerRouter),
)

Functions

This section is empty.

Types

type CreateImpersonationRequest

type CreateImpersonationRequest struct {
	SQLUser  string `json:"sql_user"`
	Password string `json:"password"`
}

type GetAuthURLRequest

type GetAuthURLRequest struct {
	RedirectURL  string `json:"redirect_url" form:"redirect_url"`
	CodeVerifier string `json:"code_verifier" form:"code_verifier"`
	State        string `json:"state" form:"state"`
}

type ImpersonateStatus

type ImpersonateStatus string
const (
	ImpersonateStatusSuccess           ImpersonateStatus = "success"
	ImpersonateStatusAuthFail          ImpersonateStatus = "auth_fail"
	ImpersonateStatusInsufficientPrivs ImpersonateStatus = "insufficient_privileges"
)

type SSOImpersonationModel

type SSOImpersonationModel struct {
	SQLUser string `gorm:"primary_key;size:128" json:"sql_user"`
	// The encryption key is placed somewhere else in the FS, to avoid being collected by diagnostics collecting tools.
	EncryptedPass         string             `gorm:"type:text" json:"-"`
	LastImpersonateStatus *ImpersonateStatus `gorm:"size:32" json:"last_impersonate_status"`
}

func (SSOImpersonationModel) TableName

func (SSOImpersonationModel) TableName() string

type Service

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

func NewService

func NewService(p ServiceParams, lc fx.Lifecycle, config *config.Config) (*Service, error)

func (*Service) BuildEndSessionURL

func (s *Service) BuildEndSessionURL(user *utils.SessionUser, redirectURL string) (string, error)

func (*Service) IsEnabled

func (s *Service) IsEnabled() (bool, error)

func (*Service) NewSessionFromOAuthExchange

func (s *Service) NewSessionFromOAuthExchange(redirectURL string, code string, codeVerifier string) (*utils.SessionUser, error)

type ServiceParams

type ServiceParams struct {
	fx.In
	LocalStore    *dbstore.DB
	TiDBClient    *tidb.Client
	ConfigManager *config.DynamicConfigManager
}

type SetConfigRequest

type SetConfigRequest struct {
	Config config.SSOCoreConfig `json:"config"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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