Documentation ¶
Index ¶
- Constants
- func NewOAuth2AuthorizationRequestError(msg string) shared.AppError
- type AuthorizationResult
- type CheckState
- type Credentials
- type DiProvider
- type Facade
- type LoginCheck
- type LoginCheckPassword
- type LoginIdentity
- type LoginState
- type LoginStateStatus
- type LoginStep
- type OAuth2AuthRequest
- type OAuth2AuthRequestRepo
- type OAuth2AuthorizationService
- type Repos
- type Services
- type SignedTokensDTO
- type TotpDTO
Constants ¶
View Source
const ( StepLoginPassword = "login_password" StepLoginTotp = "login_totp" StepLoginSecret = "login_secret" StepFindUser = "find_user" )
View Source
const OAuth2AuthRequestDuration = 60 * time.Second
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthorizationResult ¶
type AuthorizationResult struct { }
type CheckState ¶
type Credentials ¶
type DiProvider ¶
func NewDiProvider ¶
func NewDiProvider( appFind apps.FindService, userFind users.FindService, jwk jwtlib.JwkService, jwt jwtlib.JwtService, pwdService users.PasswordService, stores store.Stores) DiProvider
type Facade ¶
type Facade interface { Login(ctx context.Context, credentials Credentials) (LoginState, error) CreateSignedTokensFromLoginIdentity(ctx context.Context, identity *LoginIdentity) (SignedTokensDTO, error) CreateLoginIdentityFromToken(ctx context.Context, token jwtlib.Jwt) (*LoginIdentity, error) ParseJwt(ctx context.Context, str string) (jwtlib.Jwt, error) ParseAndValidateJwt(ctx context.Context, str string) (jwtlib.Jwt, error) }
func NewAuthFacade ¶
func NewAuthFacade(findUsers users.FindService, findApps apps.FindService, jwt jwtlib.JwtService, jwk jwtlib.JwkService, passwdService users.PasswordService) Facade
type LoginCheck ¶
type LoginCheck interface { Check(ctx context.Context, loginState LoginState, checkState CheckState) (LoginState, error) CheckName() string }
func NewLoginCheckPassword ¶
func NewLoginCheckPassword(service users.PasswordService) LoginCheck
type LoginCheckPassword ¶
type LoginCheckPassword struct {
// contains filtered or unexported fields
}
loginPage Check password
func (*LoginCheckPassword) Check ¶
func (c *LoginCheckPassword) Check(ctx context.Context, loginState LoginState, checkState CheckState) (LoginState, error)
func (LoginCheckPassword) CheckName ¶
func (LoginCheckPassword) CheckName() string
type LoginIdentity ¶
type LoginIdentity struct { UserId string `json:"user_id"` ClientId string `json:"client_id"` Scopes shared.Scopes `json:"scopes"` }
func CreateLoginIdentityFromToken ¶
func CreateLoginIdentityFromToken(token jwtlib.Jwt) *LoginIdentity
func NewLoginIdentity ¶
func NewLoginIdentity(user *users.User, app *apps.Application, scopes []string) *LoginIdentity
func (*LoginIdentity) LogFields ¶
func (id *LoginIdentity) LogFields() log.Fields
type LoginState ¶
type LoginState interface { shared.LoggingIdentity UserID() string ID() string Steps() *[]LoginStep AddStep(loginStep LoginStep) LoginState IsSuccess() bool IsFail() bool IsError() bool State() LoginStateStatus IsNotOk() bool IsOk() bool }
func NewLoginState ¶
func NewLoginState(userId uuid.UUID) LoginState
type LoginStateStatus ¶
type LoginStateStatus string
const ( Success LoginStateStatus = "success" Failed LoginStateStatus = "failed" Error LoginStateStatus = "error" )
type LoginStep ¶
type LoginStep interface { Name() string State() LoginStateStatus IsSuccess() bool IsFail() bool IsError() bool }
func NewLoginStep ¶
func NewLoginStep(name string, state LoginStateStatus) LoginStep
type OAuth2AuthRequest ¶
type OAuth2AuthRequest struct { ClientId string `json:"client_id"` ResponseType string `json:"response_type"` RedirectUri string `json:"redirect_uri"` Scopes []string `json:"scopes"` State string `json:"state"` Nonce string `json:"nonce"` // OPENID PKCEChallenge string `json:"pkce_code_challenge"` // PKCE PKCEMethod string `json:"pkce_code_method"` // PKCE }
type OAuth2AuthRequestRepo ¶
type OAuth2AuthRequestRepo interface { Get(ctx context.Context, key string) (OAuth2AuthRequest, error) Set(ctx context.Context, key string, request OAuth2AuthRequest) error Delete(ctx context.Context, key string) error }
func NewOAuth2AuthRequestRepo ¶
func NewOAuth2AuthRequestRepo(s store.Store) OAuth2AuthRequestRepo
type OAuth2AuthorizationService ¶
type OAuth2AuthorizationService interface {
ProcessRequest(ctx context.Context, request *OAuth2AuthRequest) (AuthorizationResult, error)
}
func NewOAuth2AuthorizationService ¶
func NewOAuth2AuthorizationService(appFindService apps.FindService) OAuth2AuthorizationService
type Repos ¶
type Repos struct {
OAuth2AuthReq OAuth2AuthRequestRepo
}
type Services ¶
type Services struct {
OAuth2Service OAuth2AuthorizationService
}
type SignedTokensDTO ¶
type SignedTokensDTO struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` SessionToken string `json:"session_token"` IdToken string `json:"id_token"` ExpiresIn string `json:"expires_in"` TokenType string `json:"token_type"` }
func (*SignedTokensDTO) Serialize ¶
func (d *SignedTokensDTO) Serialize() string
Click to show internal directories.
Click to hide internal directories.