manager

package
v0.0.0-...-dfaa8e5 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SocialAccountCanLink = "link"
	SocialAccountSuccess = "success"
	SocialAccountError   = "error"
)

Functions

This section is empty.

Types

type ChangePasswordManager

type ChangePasswordManager struct {
	ApiCfg *config.Server
	// contains filtered or unexported fields
}

ChangePasswordManager is the change password manager.

func (*ChangePasswordManager) ChangePasswordStart

func (*ChangePasswordManager) ChangePasswordVerify

type ChangePasswordManagerInterface

type ChangePasswordManagerInterface interface {
	// ChangePasswordStart initiates a process for changing a user's password.
	// The method creates a one-time token and sends it to the user's email.
	ChangePasswordStart(*models.ChangePasswordStartForm) *models.GeneralError

	// ChangePasswordVerify validates a one-time token sent by email and, if successful, changes the user's password.
	ChangePasswordVerify(*models.ChangePasswordVerifyForm) *models.GeneralError
}

ChangePasswordManagerInterface describes of methods for the manager.

func NewChangePasswordManager

NewChangePasswordManager return new change password manager.

type LoginManager

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

LoginManager is the login manager.

func (*LoginManager) Authorize

func (m *LoginManager) Authorize(ctx echo.Context, form *models.AuthorizeForm) (string, *models.GeneralError)
func (m *LoginManager) AuthorizeLink(ctx echo.Context, form *models.AuthorizeLinkForm) (string, *models.GeneralError)

func (*LoginManager) AuthorizeResult

func (m *LoginManager) AuthorizeResult(ctx echo.Context, form *models.AuthorizeResultForm) (token *models.AuthorizeResultResponse, error *models.GeneralError)

type LoginManagerInterface

type LoginManagerInterface interface {
	// Authorize generates an authorization URL for the social network to redirect the user.
	Authorize(echo.Context, *models.AuthorizeForm) (string, *models.GeneralError)

	// AuthorizeResult validates the response after authorization in the social network.
	//
	// In case of successful authentication, the user will be generated a one-time token to complete the
	// authorization in the basic authorization form.
	//
	// If a user has not previously logged in through a social network, but an account has been found with the same
	// mail as in a social network, then the user will be asked to link these accounts.
	AuthorizeResult(echo.Context, *models.AuthorizeResultForm) (*models.AuthorizeResultResponse, *models.GeneralError)

	// AuthorizeLink implements the situation with linking the account from the social network and password login (when their email addresses match).
	//
	// If the user chooses the linking of the account, then the password from the account will be validated and,
	// if successful, this social account will be tied to the basic record.
	//
	// If the user refused to link, then a new account will be created.
	AuthorizeLink(echo.Context, *models.AuthorizeLinkForm) (string, *models.GeneralError)
}

LoginManagerInterface describes of methods for the manager.

func NewLoginManager

NewLoginManager return new login manager.

type MFAManager

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

MFAManager is the mfa manager.

func (*MFAManager) MFAAdd

func (m *MFAManager) MFAAdd(ctx echo.Context, form *models.MfaAddForm) (token *models.MfaAuthenticator, error *models.GeneralError)

func (*MFAManager) MFAChallenge

func (m *MFAManager) MFAChallenge(form *models.MfaChallengeForm) *models.GeneralError

func (*MFAManager) MFAList

func (m *MFAManager) MFAList(ctx echo.Context, form *models.MfaListForm) ([]*models.MfaProvider, *models.GeneralError)

func (*MFAManager) MFARemove

func (m *MFAManager) MFARemove(ctx echo.Context, form *models.MfaRemoveForm) *models.GeneralError

func (*MFAManager) MFAVerify

func (m *MFAManager) MFAVerify(ctx echo.Context, form *models.MfaVerifyForm) *models.GeneralError

type MFAManagerInterface

type MFAManagerInterface interface {
	// MFAChallenge is temporary unused.
	MFAChallenge(*models.MfaChallengeForm) *models.GeneralError

	// MFAVerify verifies the one-time MFA token.
	MFAVerify(echo.Context, *models.MfaVerifyForm) *models.GeneralError

	// MFAAdd adds mfa provider for the user.
	//
	// If successful, a secret key will be generated, a list of backup codes and a
	// qr-code to add an authenticator to the program.
	MFAAdd(echo.Context, *models.MfaAddForm) (*models.MfaAuthenticator, *models.GeneralError)

	// MFARemove removes mfa provider for user
	MFARemove(echo.Context, *models.MfaRemoveForm) *models.GeneralError

	// MFAList returns list of mfa providers for user
	MFAList(echo.Context, *models.MfaListForm) ([]*models.MfaProvider, *models.GeneralError)
}

MFAManagerInterface describes of methods for the manager.

func NewMFAManager

NewMFAManager return new mfa manager.

type ManageManager

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

func (*ManageManager) AddAppIdentityProvider

func (m *ManageManager) AddAppIdentityProvider(ctx echo.Context, form *models.AppIdentityProvider) *models.GeneralError

func (*ManageManager) AddMFA

func (m *ManageManager) AddMFA(ctx echo.Context, f *models.MfaApplicationForm) (*models.MfaProvider, *models.GeneralError)

func (*ManageManager) CreateApplication

func (m *ManageManager) CreateApplication(ctx echo.Context, form *models.ApplicationForm) (*models.Application, *models.GeneralError)

func (*ManageManager) CreateSpace

func (m *ManageManager) CreateSpace(ctx echo.Context, form *models.SpaceForm) (*models.Space, *models.GeneralError)

func (*ManageManager) GetApplication

func (m *ManageManager) GetApplication(ctx echo.Context, id string) (*models.Application, *models.GeneralError)

func (*ManageManager) GetIdentityProvider

func (m *ManageManager) GetIdentityProvider(ctx echo.Context, appId string, id string) (*models.AppIdentityProvider, *models.GeneralError)

func (*ManageManager) GetIdentityProviderTemplates

func (m *ManageManager) GetIdentityProviderTemplates() []*models.AppIdentityProvider

func (*ManageManager) GetIdentityProviders

func (m *ManageManager) GetIdentityProviders(ctx echo.Context, appId string) ([]*models.AppIdentityProvider, *models.GeneralError)

func (*ManageManager) GetPasswordSettings

func (m *ManageManager) GetPasswordSettings(id string) (*models.PasswordSettings, *models.GeneralError)

func (*ManageManager) GetSpace

func (m *ManageManager) GetSpace(ctx echo.Context, id string) (*models.Space, *models.GeneralError)

func (*ManageManager) SetOneTimeTokenSettings

func (m *ManageManager) SetOneTimeTokenSettings(ctx echo.Context, appID string, form *models.OneTimeTokenSettings) *models.GeneralError

func (*ManageManager) SetPasswordSettings

func (m *ManageManager) SetPasswordSettings(ctx echo.Context, appID string, form *models.PasswordSettings) *models.GeneralError

func (*ManageManager) UpdateAppIdentityProvider

func (m *ManageManager) UpdateAppIdentityProvider(ctx echo.Context, id string, form *models.AppIdentityProvider) *models.GeneralError

func (*ManageManager) UpdateApplication

func (m *ManageManager) UpdateApplication(ctx echo.Context, id string, form *models.ApplicationForm) (*models.Application, *models.GeneralError)

func (*ManageManager) UpdateSpace

func (m *ManageManager) UpdateSpace(ctx echo.Context, id string, form *models.SpaceForm) (*models.Space, *models.GeneralError)

type OauthManager

type OauthManager struct {
	ApiCfg *config.Server
	// contains filtered or unexported fields
}

OauthManager is the oauth manager.

func (*OauthManager) Auth

func (m *OauthManager) Auth(ctx echo.Context, form *models.Oauth2LoginSubmitForm) (string, *models.GeneralError)

func (*OauthManager) CallBack

func (m *OauthManager) CallBack(ctx echo.Context, form *models.Oauth2CallBackForm) (*models.Oauth2CallBackResponse, *models.GeneralError)

func (*OauthManager) CheckAuth

func (m *OauthManager) CheckAuth(ctx echo.Context, form *models.Oauth2LoginForm) (string, *models.User, []*models.AppIdentityProvider, string, *models.GeneralError)

func (*OauthManager) Consent

func (m *OauthManager) Consent(ctx echo.Context, form *models.Oauth2ConsentForm) ([]string, *models.GeneralError)

func (*OauthManager) ConsentSubmit

func (m *OauthManager) ConsentSubmit(ctx echo.Context, form *models.Oauth2ConsentSubmitForm) (string, *models.GeneralError)

func (*OauthManager) GetScopes

func (m *OauthManager) GetScopes(requestedScopes []string) []string

func (*OauthManager) HasOnlyDefaultScopes

func (m *OauthManager) HasOnlyDefaultScopes(scopes []string) bool

func (*OauthManager) Introspect

func (m *OauthManager) Introspect(ctx echo.Context, form *models.Oauth2IntrospectForm) (*models.Oauth2TokenIntrospection, *models.GeneralError)

func (*OauthManager) Logout

func (m *OauthManager) Logout(ctx echo.Context, form *models.Oauth2LogoutForm) (string, *models.GeneralError)

func (*OauthManager) SignUp

func (m *OauthManager) SignUp(ctx echo.Context, form *models.Oauth2SignUpForm) (string, *models.GeneralError)

type OauthManagerInterface

type OauthManagerInterface interface {
	// CheckAuth is a cookie based authentication check.
	//
	//  If the user has previously been authorized and selected the option "remember me",
	//  then this method automatically authorizes the user.
	//
	//  If the user does not have an authorization session, his email address will be returned in order
	//  to offer him authorization under the previous account.
	//
	//  If no authorization was found, then a list of social networks is returned (if available) in order to prompt
	//  the user to log in through them, and not just by login and password.
	CheckAuth(echo.Context, *models.Oauth2LoginForm) (string, *models.User, []*models.AppIdentityProvider, string, *models.GeneralError)

	// Auth authorizes a user based on login and password, previous login or
	// one-time authorization token (obtained after authorization through social networks).
	//
	// After successful authorization, the URL for the redirect will be returned to pass the agreement consent process.
	Auth(echo.Context, *models.Oauth2LoginSubmitForm) (string, *models.GeneralError)

	// Consent prompts the user to accept the consent.
	Consent(echo.Context, *models.Oauth2ConsentForm) ([]string, *models.GeneralError)

	// Consent accepts the consent.
	ConsentSubmit(echo.Context, *models.Oauth2ConsentSubmitForm) (string, *models.GeneralError)

	// GetScopes returns a list of available scope for the application.
	GetScopes([]string) []string

	// HasOnlyDefaultScopes returns true if the request contains only default scopes
	HasOnlyDefaultScopes([]string) bool

	// Introspect checks the token and returns its contents.
	//
	// Contains an access token's session data as specified by IETF RFC 7662, see:
	// https://tools.ietf.org/html/rfc7662
	Introspect(echo.Context, *models.Oauth2IntrospectForm) (*models.Oauth2TokenIntrospection, *models.GeneralError)

	// SignUp registers a new user using login and password.
	//
	// After successful registration, the URL for the redirect will be returned to pass the agreement consent process.
	SignUp(echo.Context, *models.Oauth2SignUpForm) (string, *models.GeneralError)

	// CallBack verifies the result of oauth2 authorization.
	//
	// The method is implemented for applications that do not have their own backend,
	// for example, an application for a computer or a SPA.
	//
	// The page, using the JS SDK, will transmit through the PostMessage and the callback function the result of
	// the authorization, the token and the time of its completion.
	CallBack(echo.Context, *models.Oauth2CallBackForm) (*models.Oauth2CallBackResponse, *models.GeneralError)

	// Logout removes the authentication cookie and redirects the user to the specified URL.
	//
	// Url should be in the list of trusted ones, as well as during authorization and registration.
	Logout(echo.Context, *models.Oauth2LogoutForm) (string, *models.GeneralError)
}

OauthManagerInterface describes of methods for the manager.

func NewOauthManager

NewOauthManager return new oauth manager.

type PasswordLessManager

type PasswordLessManager struct {
}

func NewPasswordLessManager

func NewPasswordLessManager() *PasswordLessManager

func (*PasswordLessManager) PasswordLessStart

func (m *PasswordLessManager) PasswordLessStart(form *models.PasswordLessStartForm) (ott *models.OneTimeToken, error *models.GeneralError)

func (*PasswordLessManager) PasswordLessVerify

func (m *PasswordLessManager) PasswordLessVerify(form *models.PasswordLessVerifyForm) (error *models.GeneralError)

Jump to

Keyboard shortcuts

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