auth

package
v0.0.0-...-6dc645d Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SELECT_IDENTITY_SUB            = "select * from eruauth_identities where identity_provider_id = ???"
	INSERT_IDENTITY                = "" /* 130-byte string literal not displayed */
	UPDATE_IDENTITY                = "update eruauth_identities set traits = ??? , attributes = ??? where identity_id = ???"
	INSERT_IDENTITY_CREDENTIALS    = "" /* 151-byte string literal not displayed */
	DELETE_IDENTITY_CREDENTIALS    = "" /* 130-byte string literal not displayed */
	INSERT_IDENTITY_PASSWORD       = "insert into eruauth_identity_passwords (identity_password_id,identity_id,identity_password) values (??? , ??? , ???)"
	SELECT_LOGIN                   = "" /* 308-byte string literal not displayed */
	SELECT_LOGIN_ID                = "" /* 229-byte string literal not displayed */
	SELECT_IDENTITY                = "" /* 131-byte string literal not displayed */
	SELECT_IDENTITY_CREDENTIAL     = "" /* 178-byte string literal not displayed */
	INSERT_OTP                     = "" /* 130-byte string literal not displayed */
	VERIFY_OTP                     = "" /* 289-byte string literal not displayed */
	VERIFY_RECOVERY_OTP            = "" /* 267-byte string literal not displayed */
	CHANGE_PASSWORD                = "update eruauth_identity_passwords set updated_date=LOCALTIMESTAMP, identity_password= ??? where identity_id= ???"
	INSERT_DELETED_IDENTITY        = "" /* 368-byte string literal not displayed */
	DELETE_IDENTITY_PASSWORD       = "delete from eruauth_identity_passwords where identity_id= ???"
	DELETE_IDENTITY_CREDENTIALS_ID = "delete from eruauth_identity_credentials where identity_id= ???"
	DELETE_IDENTITY                = "delete from eruauth_identities where identity_id= ???"
)
View Source
const (
	OTP_PURPOSE_RECOVERY = "RECOVERY"
	OTP_PURPOSE_VERIFY   = "VERIFY"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	AuthType       string
	AuthName       string
	TokenHeaderKey string
	Hooks          AuthHooks `eru:"optional"`
	AuthDb         AuthDbI   `json:"-"`
}

func (*Auth) ChangePassword

func (auth *Auth) ChangePassword(ctx context.Context, tokenObj map[string]interface{}, userId string, changePasswordObj ChangePassword) (err error)

func (*Auth) CompleteRecovery

func (auth *Auth) CompleteRecovery(ctx context.Context, recoveryPassword RecoveryPassword, cookies []*http.Cookie) (msg string, err error)

func (*Auth) FetchTokens

func (auth *Auth) FetchTokens(ctx context.Context, refresh_token string, userId string) (res interface{}, err error)

func (*Auth) GenerateRecoveryCode

func (auth *Auth) GenerateRecoveryCode(ctx context.Context, recoveryIdentifier RecoveryPostBody, projectId string, silentFlag bool) (msg string, err error)

func (*Auth) GenerateVerifyCode

func (auth *Auth) GenerateVerifyCode(ctx context.Context, verifyIdentifier VerifyPostBody, projectId string, silentFlag bool) (msg string, err error)

func (*Auth) GetAttribute

func (auth *Auth) GetAttribute(ctx context.Context, attributeName string) (attributeValue interface{}, err error)

func (*Auth) GetAuthDb

func (auth *Auth) GetAuthDb() (authDbI AuthDbI)

func (*Auth) GetUrl

func (auth *Auth) GetUrl(ctx context.Context, state string) (url string, msParams MsParams, err error)

func (*Auth) GetUser

func (auth *Auth) GetUser(ctx context.Context, userId string) (identity Identity, err error)

func (*Auth) GetUserInfo

func (auth *Auth) GetUserInfo(ctx context.Context, access_token string) (identity Identity, err error)

func (*Auth) Login

func (auth *Auth) Login(ctx context.Context, loginPostBody LoginPostBody, withTokens bool) (identity Identity, loginSuccess LoginSuccess, err error)

func (*Auth) Logout

func (auth *Auth) Logout(ctx context.Context, req *http.Request) (res interface{}, resStatusCode int, err error)

func (*Auth) MakeFromJson

func (auth *Auth) MakeFromJson(ctx context.Context, rj *json.RawMessage) error

func (*Auth) PerformPreDeleteTask

func (auth *Auth) PerformPreDeleteTask(ctx context.Context) (err error)

func (*Auth) PerformPreSaveTask

func (auth *Auth) PerformPreSaveTask(ctx context.Context) (err error)

func (*Auth) Register

func (auth *Auth) Register(ctx context.Context, registerUser RegisterUser, projectId string) (identity Identity, loginSuccess LoginSuccess, err error)

func (*Auth) RemoveUser

func (auth *Auth) RemoveUser(ctx context.Context, removeUser RemoveUser) (err error)

func (*Auth) SetAuthDb

func (auth *Auth) SetAuthDb(authDbI AuthDbI)

func (*Auth) UpdateUser

func (auth *Auth) UpdateUser(ctx context.Context, identityToUpdate Identity, userId string, token map[string]interface{}) (err error)

func (*Auth) VerifyCode

func (auth *Auth) VerifyCode(ctx context.Context, verifyCode VerifyCode, tokenObj map[string]interface{}, withToken bool) (res interface{}, err error)

func (*Auth) VerifyRecovery

func (auth *Auth) VerifyRecovery(ctx context.Context, recoveryPassword RecoveryPassword) (res map[string]string, cookies []*http.Cookie, err error)

func (*Auth) VerifyToken

func (auth *Auth) VerifyToken(ctx context.Context, tokenType string, token string) (res interface{}, err error)

type AuthDb

type AuthDb struct {
	Con       *sqlx.DB `json:"-"`
	ConStatus bool     `json:"-"`
}

func (*AuthDb) GetConn

func (authDb *AuthDb) GetConn() *sqlx.DB

func (*AuthDb) GetDbQuery

func (authDb *AuthDb) GetDbQuery(ctx context.Context, query string) (finalQuery string)

func (*AuthDb) SetConn

func (authDb *AuthDb) SetConn(con *sqlx.DB)

type AuthDbI

type AuthDbI interface {
	GetConn() *sqlx.DB
	SetConn(*sqlx.DB)
	GetDbQuery(ctx context.Context, query string) (finalQuery string)
}

func GetAuthDb

func GetAuthDb(dbType string) AuthDbI

type AuthDbMysql

type AuthDbMysql struct {
	AuthDb
}

func (*AuthDbMysql) GetDbQuery

func (authDbMysql *AuthDbMysql) GetDbQuery(ctx context.Context, query string) (finalQuery string)

type AuthDbPostgres

type AuthDbPostgres struct {
	AuthDb
}

func (*AuthDbPostgres) GetDbQuery

func (authDbPostgres *AuthDbPostgres) GetDbQuery(ctx context.Context, query string) (finalQuery string)

type AuthHooks

type AuthHooks struct {
	SRC  routes.Route
	SRCF routes.FuncGroup
	SVCF routes.FuncGroup
	SWEF routes.FuncGroup
}

type AuthI

type AuthI interface {
	//Login(req *http.Request) (res interface{}, cookies []*http.Cookie, err error)
	SetAuthDb(authDbI AuthDbI)
	GetAuthDb() (authDbI AuthDbI)
	Login(ctx context.Context, loginPostBody LoginPostBody, withTokens bool) (identity Identity, loginSuccess LoginSuccess, err error)
	Register(ctx context.Context, registerUser RegisterUser, projectId string) (identity Identity, loginSuccess LoginSuccess, err error)
	RemoveUser(ctx context.Context, removeUser RemoveUser) (err error)
	Logout(ctx context.Context, req *http.Request) (res interface{}, resStatusCode int, err error)
	VerifyToken(ctx context.Context, tokenType string, token string) (res interface{}, err error)
	GetAttribute(ctx context.Context, attributeName string) (attributeValue interface{}, err error)
	GetUserInfo(ctx context.Context, access_token string) (identity Identity, err error)
	FetchTokens(ctx context.Context, refresh_token string, userId string) (res interface{}, err error)
	MakeFromJson(ctx context.Context, rj *json.RawMessage) (err error)
	PerformPreSaveTask(ctx context.Context) (err error)
	PerformPreDeleteTask(ctx context.Context) (err error)
	GetUser(ctx context.Context, userId string) (identity Identity, err error)
	UpdateUser(ctx context.Context, identityToUpdate Identity, userId string, token map[string]interface{}) (err error)
	ChangePassword(ctx context.Context, tokenObj map[string]interface{}, userId string, changePasswordObj ChangePassword) (err error)
	GenerateRecoveryCode(ctx context.Context, recoveryIdentifier RecoveryPostBody, projectId string, silentFlag bool) (msg string, err error)
	GenerateVerifyCode(ctx context.Context, verifyIdentifier VerifyPostBody, projectId string, silentFlag bool) (msg string, err error)
	CompleteRecovery(ctx context.Context, recoveryPassword RecoveryPassword, cookies []*http.Cookie) (msg string, err error)
	VerifyRecovery(ctx context.Context, recoveryPassword RecoveryPassword) (res map[string]string, cookies []*http.Cookie, err error)
	VerifyCode(ctx context.Context, verifyCode VerifyCode, tokenObj map[string]interface{}, withToken bool) (res interface{}, err error)
	GetUrl(ctx context.Context, state string) (url string, msParams MsParams, err error)
}

func GetAuth

func GetAuth(authType string) AuthI

type ChangePassword

type ChangePassword struct {
	OldPassword string `json:"old_password"`
	NewPassword string `json:"new_password"`
}

type EruAuth

type EruAuth struct {
	Auth
	EruConfig EruConfig   `json:"eruConfig" eru:"required"`
	Hydra     HydraConfig `json:"hydra" eru:"required"`
}

func (*EruAuth) ChangePassword

func (eruAuth *EruAuth) ChangePassword(ctx context.Context, tokenObj map[string]interface{}, userId string, changePasswordObj ChangePassword) (err error)

func (*EruAuth) FetchTokens

func (eruAuth *EruAuth) FetchTokens(ctx context.Context, refresh_token string, userId string) (res interface{}, err error)

func (*EruAuth) GenerateRecoveryCode

func (eruAuth *EruAuth) GenerateRecoveryCode(ctx context.Context, recoveryIdentifier RecoveryPostBody, projectId string, silentFlag bool) (msg string, err error)

func (*EruAuth) GenerateVerifyCode

func (eruAuth *EruAuth) GenerateVerifyCode(ctx context.Context, verifyIdentifier VerifyPostBody, projectId string, silentFlag bool) (msg string, err error)

func (*EruAuth) GetUserInfo

func (eruAuth *EruAuth) GetUserInfo(ctx context.Context, access_token string) (identity Identity, err error)

func (*EruAuth) Login

func (eruAuth *EruAuth) Login(ctx context.Context, loginPostBody LoginPostBody, withTokens bool) (identity Identity, loginSuccess LoginSuccess, err error)

func (*EruAuth) MakeFromJson

func (eruAuth *EruAuth) MakeFromJson(ctx context.Context, rj *json.RawMessage) error

func (*EruAuth) PerformPreDeleteTask

func (eruAuth *EruAuth) PerformPreDeleteTask(ctx context.Context) (err error)

func (*EruAuth) PerformPreSaveTask

func (eruAuth *EruAuth) PerformPreSaveTask(ctx context.Context) (err error)

func (*EruAuth) Register

func (eruAuth *EruAuth) Register(ctx context.Context, registerUser RegisterUser, projectId string) (identity Identity, loginSuccess LoginSuccess, err error)

func (*EruAuth) RemoveUser

func (eruAuth *EruAuth) RemoveUser(ctx context.Context, removeUser RemoveUser) (err error)

func (*EruAuth) UpdateUser

func (eruAuth *EruAuth) UpdateUser(ctx context.Context, identity Identity, userId string, token map[string]interface{}) (err error)

func (*EruAuth) VerifyCode

func (eruAuth *EruAuth) VerifyCode(ctx context.Context, verifyCode VerifyCode, tokenObj map[string]interface{}, withToken bool) (res interface{}, err error)

func (*EruAuth) VerifyRecovery

func (eruAuth *EruAuth) VerifyRecovery(ctx context.Context, recoveryPassword RecoveryPassword) (res map[string]string, cookies []*http.Cookie, err error)

type EruConfig

type EruConfig struct {
	Identifiers Identifiers `json:"identifiers" eru:"required"`
}

type HydraClient

type HydraClient struct {
	ClientId                string   `json:"client_id"`
	ClientSecret            string   `json:"client_secret"`
	TokenEndpointAuthMethod string   `json:"token_endpoint_auth_method"`
	RedirectURIs            []string `json:"redirect_uris"`
	GrantTypes              []string `json:"grant_types"`
	ResponseTypes           []string `json:"response_types"`
	Scope                   string   `json:"scope"`
}

type HydraConfig

type HydraConfig struct {
	PublicHost   string
	PublicPort   string
	PublicScheme string
	AdminHost    string
	AdminPort    string
	AdminScheme  string
	AuthURL      string
	TokenURL     string
	HydraClients map[string]HydraClient
}

func (HydraConfig) AcceptConsentRequest

func (hydraConfig HydraConfig) AcceptConsentRequest(ctx context.Context, identityHolder map[string]interface{}, consentChallenge string, loginCookies []*http.Cookie) (tokens LoginSuccess, err error)

func (HydraConfig) AcceptLoginRequest

func (hydraConfig HydraConfig) AcceptLoginRequest(ctx context.Context, subject string, loginChallenge string, cookies []*http.Cookie) (consentChallenge string, respCookies []*http.Cookie, err error)

func (HydraConfig) CreateHydraClient

func (hydraConfig HydraConfig) CreateHydraClient(ctx context.Context, hydraClient HydraClient) (resp interface{}, headers http.Header, statusCode int, err error)

func (HydraConfig) DeleteHydraClient

func (hydraConfig HydraConfig) DeleteHydraClient(ctx context.Context, clientId string) (resp interface{}, headers http.Header, statusCode int, err error)

func (HydraConfig) GetAminUrl

func (hydraConfig HydraConfig) GetAminUrl() (url string)

func (HydraConfig) GetHydraClient

func (hydraConfig HydraConfig) GetHydraClient(ctx context.Context, clientId string) (resp interface{}, headers map[string][]string, statusCode int, err error)

func (HydraConfig) GetLoginChallenge

func (hydra HydraConfig) GetLoginChallenge(ctx context.Context) (loginChallenge string, cookies []*http.Cookie, err error)

func (HydraConfig) GetOauthConfig

func (hydraConfig HydraConfig) GetOauthConfig(ctx context.Context, clientId string) (oauth2Config *oauth2.Config, err error)

func (HydraConfig) GetPublicUrl

func (hydraConfig HydraConfig) GetPublicUrl() (url string)

func (HydraConfig) GetUserInfo

func (hydraConfig HydraConfig) GetUserInfo(ctx context.Context, access_token string) (identity Identity, err error)

func (HydraConfig) RemoveHydraClient

func (hydraConfig HydraConfig) RemoveHydraClient(ctx context.Context, clientId string) (err error)

func (HydraConfig) SaveHydraClient

func (hydraConfig HydraConfig) SaveHydraClient(ctx context.Context, hydraClient HydraClient) (err error)

func (HydraConfig) UpdateHydraClient

func (hydraConfig HydraConfig) UpdateHydraClient(ctx context.Context, clientId string, hydraClient HydraClient) (resp interface{}, headers http.Header, statusCode int, err error)

type IdentifierConfig

type IdentifierConfig struct {
	Enable    bool   `json:"enable"`
	IdpMapper string `json:"idpMapper"`
}

type Identifiers

type Identifiers struct {
	Email    IdentifierConfig `json:"email"`
	Mobile   IdentifierConfig `json:"mobile"`
	Username IdentifierConfig `json:"userName"`
}

type Identity

type Identity struct {
	Id          string                 `json:"id"`
	CreatedAt   time.Time              `json:"created_at"`
	UpdatedAt   time.Time              `json:"updated_at"`
	Attributes  map[string]interface{} `json:"attributes"`
	AuthDetails IdentityAuth           `json:"auth_details"`
	OtherInfo   map[string]interface{} `json:"other_info"`
	Status      string                 `json:"status"`
}

type IdentityAuth

type IdentityAuth struct {
	SessionToken                string        `json:"session_token"`
	SessionId                   string        `json:"session_id"`
	SessionStatus               bool          `json:"session_status"`
	ExpiresAt                   time.Time     `json:"expires_at"`
	AuthenticatedAt             time.Time     `json:"authenticated_at"`
	AuthenticatorAssuranceLevel string        `json:"authenticator_assurance_level"`
	AuthenticationMethods       []interface{} `json:"authentication_methods"`
	IssuedAt                    time.Time     `json:"issued_at"`
}

type KratosAuthenticationMethods

type KratosAuthenticationMethods struct {
	Method      string    `json:"method"`
	Aal         string    `json:"aal"`
	CompletedAt time.Time `json:"completed_at"`
}

type KratosConfig

type KratosConfig struct {
	PublicHost   string
	PublicPort   string
	PublicScheme string
	AdminHost    string
	AdminPort    string
	AdminScheme  string
	LoginMethod  string
}

type KratosDevice

type KratosDevice struct {
	Id        string `json:"id"`
	IP        string `json:"ip_address"`
	Location  string `json:"location"`
	UserAgent string `json:"user_agent"`
}

type KratosFlow

type KratosFlow struct {
	Id           string    `json:"id"`
	Flowtype     string    `json:"type"`
	ExpiresAt    time.Time `json:"expires_at"`
	IssuedAt     time.Time `json:"issued_at"`
	RequestUrl   string    `json:"request_url"`
	UI           KratosUI  `json:"ui"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
	Refresh      bool      `json:"refresh"`
	RequestedAal string    `json:"requested_aal"`
}

type KratosHydraAuth

type KratosHydraAuth struct {
	Auth
	Kratos KratosConfig
	Hydra  HydraConfig
}

func (*KratosHydraAuth) ChangePassword

func (kratosHydraAuth *KratosHydraAuth) ChangePassword(ctx context.Context, tokenObj map[string]interface{}, userId string, changePassword ChangePassword) (err error)

func (*KratosHydraAuth) CompleteRecovery

func (kratosHydraAuth *KratosHydraAuth) CompleteRecovery(ctx context.Context, recoveryPassword RecoveryPassword, cookies []*http.Cookie) (msg string, err error)

func (*KratosHydraAuth) FetchTokens

func (kratosHydraAuth *KratosHydraAuth) FetchTokens(ctx context.Context, refresh_token string, userId string) (res interface{}, err error)

func (*KratosHydraAuth) GenerateRecoveryCode

func (kratosHydraAuth *KratosHydraAuth) GenerateRecoveryCode(ctx context.Context, recoveryIdentifier RecoveryPostBody, projectId string, silentFlag bool) (msg string, err error)

func (*KratosHydraAuth) GetUser

func (kratosHydraAuth *KratosHydraAuth) GetUser(ctx context.Context, userId string) (identity Identity, err error)

func (*KratosHydraAuth) GetUserInfo

func (kratosHydraAuth *KratosHydraAuth) GetUserInfo(ctx context.Context, access_token string) (identity Identity, err error)

func (*KratosHydraAuth) Login

func (kratosHydraAuth *KratosHydraAuth) Login(ctx context.Context, loginPostBody LoginPostBody, withTokens bool) (identity Identity, loginSuccess LoginSuccess, err error)

func (*KratosHydraAuth) Logout

func (kratosHydraAuth *KratosHydraAuth) Logout(ctx context.Context, req *http.Request) (res interface{}, resStatusCode int, err error)

func (*KratosHydraAuth) MakeFromJson

func (kratosHydraAuth *KratosHydraAuth) MakeFromJson(ctx context.Context, rj *json.RawMessage) error

func (*KratosHydraAuth) PerformPreDeleteTask

func (kratosHydraAuth *KratosHydraAuth) PerformPreDeleteTask(ctx context.Context) (err error)

func (*KratosHydraAuth) PerformPreSaveTask

func (kratosHydraAuth *KratosHydraAuth) PerformPreSaveTask(ctx context.Context) (err error)

func (*KratosHydraAuth) UpdateUser

func (kratosHydraAuth *KratosHydraAuth) UpdateUser(ctx context.Context, identityToUpdate Identity, userId string, token map[string]interface{}) (err error)

func (*KratosHydraAuth) VerifyRecovery

func (kratosHydraAuth *KratosHydraAuth) VerifyRecovery(ctx context.Context, recoveryPassword RecoveryPassword) (rcMap map[string]string, cookies []*http.Cookie, err error)

func (*KratosHydraAuth) VerifyToken

func (kratosHydraAuth *KratosHydraAuth) VerifyToken(ctx context.Context, tokenType string, token string) (res interface{}, err error)

type KratosIdentity

type KratosIdentity struct {
	Id                  string                  `json:"id"`
	SchemaId            string                  `json:"schema_id"`
	SchemaUrl           string                  `json:"schema_url"`
	State               string                  `json:"state"`
	StateChangedAt      time.Time               `json:"state_changed_at"`
	Traits              map[string]interface{}  `json:"traits"`
	VerifiableAddresses []KratosIdentityAddress `json:"verifiable_addresses"`
	RecoveryAddresses   []KratosIdentityAddress `json:"recovery_addresses"`
	MetaDataPublic      map[string]interface{}  `json:"metadata_public"`
	MetaDataAdmin       map[string]interface{}  `json:"metadata_admin"`
	CreatedAt           time.Time               `json:"created_at"`
	UpdatedAt           time.Time               `json:"updated_at"`
}

type KratosIdentityAddress

type KratosIdentityAddress struct {
	Id        string    `json:"id"`
	Value     string    `json:"value"`
	Verified  bool      `json:"verified"`
	Via       string    `json:"via"`
	Status    string    `json:"status"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type KratosLoginPostBody

type KratosLoginPostBody struct {
	CsrfToken  string `json:"csrf_token"`
	Identifier string `json:"identifier"`
	Method     string `json:"method"`
	Password   string `json:"password"`
}

type KratosSession

type KratosSession struct {
	SessionToken string            `json:"session_token"`
	Session      KratosSessionBody `json:"session"`
}

type KratosSessionBody

type KratosSessionBody struct {
	Id                          string                        `json:"id"`
	Active                      bool                          `json:"active"`
	ExpiresAt                   time.Time                     `json:"expires_at"`
	AuthenticatedAt             time.Time                     `json:"authenticated_at"`
	AuthenticatorAssuranceLevel string                        `json:"authenticator_assurance_level"`
	AuthenticationMethods       []KratosAuthenticationMethods `json:"authentication_methods"`
	IssuedAt                    time.Time                     `json:"issued_at"`
	Identity                    KratosIdentity                `json:"identity"`
	Devices                     []KratosDevice                `json:"devices"`
}

type KratosUI

type KratosUI struct {
	Action   string            `json:"action"`
	Method   string            `json:"method"`
	Nodes    []KratosUINode    `json:"nodes"`
	Messages []KratosUIMessage `json:"messages"`
}

type KratosUIMessage

type KratosUIMessage struct {
	Id          int64       `json:"id"`
	MessageType string      `json:"type"`
	Text        string      `json:"text"`
	Context     interface{} `json:"context"`
}

type KratosUINode

type KratosUINode struct {
	NodeType   string                 `json:"type"`
	Group      string                 `json:"group"`
	Attributes KratosUINodeAttributes `json:"attributes"`
	Messages   []KratosUIMessage      `json:"messages"`
	Meta       interface{}            `json:"meta"`
}

type KratosUINodeAttributes

type KratosUINodeAttributes struct {
	Name          string `json:"name"`
	AttributeType string `json:"type"`
	Value         string `json:"value"`
	Required      bool   `json:"required"`
	Disabled      bool   `json:"disabled"`
	NodeType      string `json:"node_type"`
}

type LoginPostBody

type LoginPostBody struct {
	Username     string `json:"username"`
	Password     string `json:"password"`
	IdpCode      string `json:"code"`
	IdpRequestId string `json:"requestId"`
	CodeVerifier string `json:"-"`
	Nonce        string `json:"-"`
}

type LoginSuccess

type LoginSuccess struct {
	AccessToken  string
	RefreshToken string
	IdToken      string
	Expiry       time.Time
	ExpiresIn    float64
}

type MsAuth

type MsAuth struct {
	Auth
	MsConfig MsConfig    `json:"msConfig" eru:"required"`
	Hydra    HydraConfig `json:"hydra" eru:"required"`
}

func (*MsAuth) GetUrl

func (msAuth *MsAuth) GetUrl(ctx context.Context, state string) (urlStr string, msParams MsParams, err error)

func (*MsAuth) GetUserInfo

func (msAuth *MsAuth) GetUserInfo(ctx context.Context, access_token string) (identity Identity, err error)

func (*MsAuth) Login

func (msAuth *MsAuth) Login(ctx context.Context, loginPostBody LoginPostBody, withTokens bool) (identity Identity, loginSuccess LoginSuccess, err error)

func (*MsAuth) MakeFromJson

func (msAuth *MsAuth) MakeFromJson(ctx context.Context, rj *json.RawMessage) error

func (*MsAuth) PerformPreDeleteTask

func (msAuth *MsAuth) PerformPreDeleteTask(ctx context.Context) (err error)

func (*MsAuth) PerformPreSaveTask

func (msAuth *MsAuth) PerformPreSaveTask(ctx context.Context) (err error)

func (*MsAuth) RemoveUser

func (msAuth *MsAuth) RemoveUser(ctx context.Context, removeUser RemoveUser) (err error)

type MsConfig

type MsConfig struct {
	ClientId     string      `json:"clientId" eru:"required"`
	ClientSecret string      `json:"clientSecret" eru:"required"`
	RedirectURI  string      `json:"redirectUri" eru:"required"`
	Scope        string      `json:"scope" eru:"required"`
	SsoBaseUrl   string      `json:"ssoBaseUrl" eru:"required"`
	TokenUrl     string      `json:"tokenUrl" eru:"required"`
	JwkUrl       string      `json:"jwkUrl" eru:"required"`
	Identifiers  Identifiers `json:"identifiers" eru:"required"`
}

type MsParams

type MsParams struct {
	ClientId            string `json:"client_id"`
	Scope               string `json:"scope"`
	RedirectURI         string `json:"redirect_uri"`
	ClientRequestId     string `json:"client-request-id"`
	ResponseMode        string `json:"response_mode"`
	ResponseType        string `json:"response_type"`
	CodeChallenge       string `json:"code_challenge"`
	CodeVerifier        string
	CodeChallengeMethod string `json:"code_challenge_method"`
	Nonce               string `json:"nonce"`
	State               string `json:"state"`
	Url                 string
}

type RecoveryPassword

type RecoveryPassword struct {
	Code     string `json:"code"`
	Id       string `json:"id"`
	Password string `json:"password"`
}

type RecoveryPostBody

type RecoveryPostBody struct {
	Username string `json:"username"`
}

type RegisterUser

type RegisterUser struct {
	UserTraits
	Password string `json:"password"`
}

type RemoveUser

type RemoveUser struct {
	UserId string `json:"id"`
}

type UserTraits

type UserTraits struct {
	FirstName      string `json:"firstName"`
	LastName       string `json:"lastName"`
	Email          string `json:"email"`
	Mobile         string `json:"mobile"`
	Username       string `json:"userName"`
	EmailVerified  bool   `json:"emailVerified"`
	MobileVerified bool   `json:"mobileVerified"`
}

type VerifyCode

type VerifyCode struct {
	Code   string `json:"code"`
	Id     string `json:"id"`
	UserId string `json:"-"`
}

type VerifyPostBody

type VerifyPostBody struct {
	Username       string `json:"username"`
	CredentialType string `json:"credentialType"`
}

Jump to

Keyboard shortcuts

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