auth

package
v1.56.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetConfigResponse added in v1.55.0

type GetConfigResponse struct {
	Enabled          bool   `json:"enabled"`
	AuthorizationURL string `json:"authorizationUrl"`
	State            string `json:"state"`
}

type OIDCConfig added in v1.55.0

type OIDCConfig struct {
	Enabled      bool
	Issuer       string
	ClientID     string
	ClientSecret string
	RedirectURL  string
	Scopes       []string
}

type OIDCHandler added in v1.55.0

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

func NewOIDCHandler added in v1.55.0

func NewOIDCHandler(cfg *domain.Config, log zerolog.Logger) (*OIDCHandler, error)

func (*OIDCHandler) GetAuthorizationURL added in v1.55.0

func (h *OIDCHandler) GetAuthorizationURL() string

func (*OIDCHandler) GetConfig added in v1.55.0

func (h *OIDCHandler) GetConfig() *OIDCConfig

func (*OIDCHandler) GetConfigResponse added in v1.55.0

func (h *OIDCHandler) GetConfigResponse() GetConfigResponse

func (*OIDCHandler) HandleCallback added in v1.55.0

func (h *OIDCHandler) HandleCallback(w http.ResponseWriter, r *http.Request) (string, error)

func (*OIDCHandler) HandleLogin added in v1.55.0

func (h *OIDCHandler) HandleLogin(w http.ResponseWriter, r *http.Request)

func (*OIDCHandler) SetStateCookie added in v1.55.0

func (h *OIDCHandler) SetStateCookie(w http.ResponseWriter, r *http.Request, state string)

SetStateCookie sets a secure cookie containing the OIDC state parameter. The state parameter is verified when the OAuth provider redirects back to our callback. Short expiration ensures the authentication flow must be completed in a reasonable timeframe.

type Service

type Service interface {
	GetUserCount(ctx context.Context) (int, error)
	Login(ctx context.Context, username, password string) (*domain.User, error)
	CreateUser(ctx context.Context, req domain.CreateUserRequest) error
	UpdateUser(ctx context.Context, req domain.UpdateUserRequest) error
	CreateHash(password string) (hash string, err error)
	ComparePasswordAndHash(password string, hash string) (match bool, err error)
}

func NewService

func NewService(log logger.Logger, userSvc user.Service) Service

Jump to

Keyboard shortcuts

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