gf_identity_core

package
v0.0.0-...-a1b0e2b Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (

	// USER
	GF_EVENT_APP__USER_CREATE_REGULAR = "GF_EVENT_APP__USER_CREATE_REGULAR"
	GF_EVENT_APP__USER_LOGIN          = "GF_EVENT_APP__USER_LOGIN"

	// ADMIN
	GF_EVENT_APP__ADMIN_CREATE                        = "GF_EVENT_APP__ADMIN_CREATE"
	GF_EVENT_APP__ADMIN_LOGIN                         = "GF_EVENT_APP__ADMIN_LOGIN"
	GF_EVENT_APP__ADMIN_LOGIN_PASS_CONFIRMED          = "GF_EVENT_APP__ADMIN_LOGIN_PASS_CONFIRMED"
	GF_EVENT_APP__ADMIN_LOGIN_EMAIL_VERIFICATION_SENT = "GF_EVENT_APP__ADMIN_LOGIN_EMAIL_VERIFICATION_SENT"
	GF_EVENT_APP__ADMIN_ADDED_USER_TO_INVITE_LIST     = "GF_EVENT_APP__ADMIN_ADDED_USER_TO_INVITE_LIST"
	GF_EVENT_APP__ADMIN_REMOVED_USER_FROM_INVITE_LIST = "GF_EVENT_APP__ADMIN_REMOVED_USER_FROM_INVITE_LIST"
)
View Source
const (
	GF_AUTH_SUBSYSTEM_TYPE__USERPASS = "userpass"
	GF_AUTH_SUBSYSTEM_TYPE__ETH      = "eth"
	GF_AUTH_SUBSYSTEM_TYPE__AUTH0    = "auth0"
)

Variables

This section is empty.

Functions

func Auth0apiTokenGeneratePipeline

func Auth0apiTokenGeneratePipeline(pInput *GFauth0inputAPItokenGenerate,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (string, *gf_core.GFerror)

func Auth0createGFuserIfNone

func Auth0createGFuserIfNone(pAuth0accessTokenStr string,
	pAuth0appDomainStr string,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

check if the Auth0 user exists in the DB, and if not create it. a user would not exist in the DB if it signed-up/logged-in for the first time.

func Auth0loginPipeline

func Auth0loginPipeline(pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (gf_core.GF_ID, *gf_core.GFerror)

func Auth0logoutPipeline

func Auth0logoutPipeline(pGFsessionID gf_core.GF_ID,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func CLIparseArgs

func CLIparseArgs(pLogFun func(string, string)) map[string]interface{}

func CreateAuthCookie

func CreateAuthCookie(pJWTtokenStr string,
	pDomainStr *string,
	pResp http.ResponseWriter)

func CreateAuthCookieOnReq

func CreateAuthCookieOnReq(pJWTtokenStr string,
	pDomainStr *string,
	pReq *http.Request)

func CreateSessionIDcookie

func CreateSessionIDcookie(pSessionIDstr string,
	pDomainStr *string,
	pResp http.ResponseWriter)

func DBmongoGetBasicInfoByETHaddr

func DBmongoGetBasicInfoByETHaddr(pUserAddressETHstr GFuserAddressETH,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (gf_core.GF_ID, *gf_core.GFerror)

func DBmongoGetBasicInfoByUsername

func DBmongoGetBasicInfoByUsername(pUserNameStr GFuserName,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (gf_core.GF_ID, *gf_core.GFerror)

func DBmongoGetUserID

func DBmongoGetUserID(pQuery bson.M,
	pMetaMap map[string]interface{},
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (gf_core.GF_ID, *gf_core.GFerror)

func DBmongoLoginAttemptUpdate

func DBmongoLoginAttemptUpdate(pLoginAttemptIDstr *gf_core.GF_ID,
	pUpdateOp *GFloginAttemptUpdateOp,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func DBmongoUserAddToInviteList

func DBmongoUserAddToInviteList(pUserEmailStr string,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func DBmongoUserExistsByID

func DBmongoUserExistsByID(pUserID gf_core.GF_ID,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (bool, *gf_core.GFerror)

func DBmongoUserExistsByUsername

func DBmongoUserExistsByUsername(pUserNameStr GFuserName,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (bool, *gf_core.GFerror)

func DBmongoUserGetAllInInviteList

func DBmongoUserGetAllInInviteList(pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) ([]map[string]interface{}, *gf_core.GFerror)

func DBmongoUserRemoveFromInviteList

func DBmongoUserRemoveFromInviteList(pUserEmailStr string,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func DBmongoUserUpdate

func DBmongoUserUpdate(pUserIDstr gf_core.GF_ID,
	pUpdateOp *GFuserUpdateOp,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func DBsqlCreateTables

func DBsqlCreateTables(pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func DBsqlGetBasicInfoByETHaddr

func DBsqlGetBasicInfoByETHaddr(pUserAddressETH GFuserAddressETH,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (gf_core.GF_ID, *gf_core.GFerror)

func DBsqlGetBasicInfoByUsername

func DBsqlGetBasicInfoByUsername(pUserNameStr GFuserName,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (gf_core.GF_ID, *gf_core.GFerror)

func DBsqlGetUserEmailByID

func DBsqlGetUserEmailByID(pUserID gf_core.GF_ID,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (string, *gf_core.GFerror)

func DBsqlLoginAttemptUpdate

func DBsqlLoginAttemptUpdate(pLoginAttemptID gf_core.GF_ID,
	pUpdateOp *GFloginAttemptUpdateOp,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func DBsqlLoginAttemptUpdateBySessionID

func DBsqlLoginAttemptUpdateBySessionID(pSessionID gf_core.GF_ID,
	pUpdateOp *GFloginAttemptUpdateOp,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func DBsqlUserAddToInviteList

func DBsqlUserAddToInviteList(pUserEmailStr string,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func DBsqlUserCreate

func DBsqlUserCreate(pUser *GFuser,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func DBsqlUserEmailIsConfirmed

func DBsqlUserEmailIsConfirmed(pUserNameStr GFuserName,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (bool, *gf_core.GFerror)

func DBsqlUserExistsByID

func DBsqlUserExistsByID(pUserID gf_core.GF_ID,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (bool, *gf_core.GFerror)

func DBsqlUserExistsByUsername

func DBsqlUserExistsByUsername(pUserNameStr GFuserName,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (bool, *gf_core.GFerror)

func DBsqlUserGetAllInInviteList

func DBsqlUserGetAllInInviteList(pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) ([]map[string]interface{}, *gf_core.GFerror)

func DBsqlUserRemoveFromInviteList

func DBsqlUserRemoveFromInviteList(pUserEmailStr string,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func DBsqlUserUpdate

func DBsqlUserUpdate(pUserIDstr gf_core.GF_ID,
	pUpdateOp *GFuserUpdateOp,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func DeleteCookies

func DeleteCookies(pResp http.ResponseWriter)

func GetSessionID

func GetSessionID(pReq *http.Request,
	pRuntimeSys *gf_core.RuntimeSys) (gf_core.GF_ID, bool)

func GetSessionIDfromCtx

func GetSessionIDfromCtx(pCtx context.Context) (gf_core.GF_ID, bool)

func GetSessionTTL

func GetSessionTTL() (int, int64)

func GetUserIDfromCtx

func GetUserIDfromCtx(pCtx context.Context) (gf_core.GF_ID, bool)

func HTTPgetAuthSubsystemType

func HTTPgetAuthSubsystemType(pReq *http.Request) string

func JWTgetTokenFromRequest

func JWTgetTokenFromRequest(pReq *http.Request,
	pRuntimeSys *gf_core.RuntimeSys) (string, bool, *gf_core.GFerror)

extract JWT token from a http request and return it as a string

func JWTpipelineValidate

func JWTpipelineValidate(pJWTtokenVal GFjwtTokenVal,
	pAuthSubsystemTypeStr string,
	pKeyServerInfo *GFkeyServerInfo,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (string, *gf_core.GFerror)

func JWTvalidate

func JWTvalidate(pJWTtokenVal GFjwtTokenVal,
	pPublicKey *rsa.PublicKey,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (bool, string, *gf_core.GFerror)

func KSclientJWTgetValidationKey

func KSclientJWTgetValidationKey(pAuthSubsystemTypeStr string,
	pKeyServerInfo *GFkeyServerInfo,
	pRuntimeSys *gf_core.RuntimeSys) (*rsa.PublicKey, *gf_core.GFerror)

func SessionValidate

func SessionValidate(pReq *http.Request,
	pKeyServerInfo *GFkeyServerInfo,
	pAuthSubsystemTypeStr string,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (bool, string, gf_core.GF_ID, *gf_core.GFerror)

func UserpassVerifyPass

func UserpassVerifyPass(pUserNameStr GFuserName,
	pPassStr string,
	pServiceInfo *GFserviceInfo,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (bool, *gf_core.GFerror)

func UsersEmailPipelineConfirm

func UsersEmailPipelineConfirm(pInput *GFuserHTTPinputEmailConfirm,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (bool, string, *gf_core.GFerror)

func UsersEmailPipelineVerify

func UsersEmailPipelineVerify(pEmailAddressStr string,
	pUserNameStr GFuserName,
	pUserIDstr gf_core.GF_ID,
	pDomainBaseStr string,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

func UsersPipelineLogout

func UsersPipelineLogout(pUserID gf_core.GF_ID,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) *gf_core.GFerror

Types

type GFauth0inputAPItokenGenerate

type GFauth0inputAPItokenGenerate struct {
	UserID             gf_core.GF_ID
	AppClientIDstr     string
	AppClientSecretStr string
	AudienceStr        string
	Auth0appDomainStr  string
}

type GFauth0inputLoginCallback

type GFauth0inputLoginCallback struct {
	CodeStr           string
	SessionID         gf_core.GF_ID
	Auth0appDomainStr string
}

type GFauth0outputLoginCallback

type GFauth0outputLoginCallback struct {
	JWTtokenStr string
}

func Auth0loginCallbackPipeline

func Auth0loginCallbackPipeline(pInput *GFauth0inputLoginCallback,
	pAuthenticator *gf_auth0.GFauthenticator,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFauth0outputLoginCallback, *gf_core.GFerror)

type GFauth0session

type GFauth0session struct {
	ID                gf_core.GF_ID `bson:"id_str"`
	DeletedBool       bool          `bson:"deleted_bool"`
	CreationUNIXtimeF float64       `bson:"creation_unix_time_f"`
	UserID            gf_core.GF_ID `bson:"user_id"`

	// marked as true once the login completes (once Auth0 initial auth returns the user to the GF system).
	// if the login_callback handler is called and this login_complete is already marked as true,
	// the http transaction will be immediatelly aborted.
	LoginCompleteBool bool `bson:"login_complete_bool"`

	AccessTokenStr string                 `bson:"access_token_str"`
	ProfileMap     map[string]interface{} `bson:"profile_map"`
}

func DBsqlAuth0getSession

func DBsqlAuth0getSession(pGFsessionID gf_core.GF_ID,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFauth0session, *gf_core.GFerror)

type GFauthSignature

type GFauthSignature string

type GFethInputCreate

type GFethInputCreate struct {
	UserTypeStr      string           `validate:"required"` // "admin" | "standard"
	UserAddressETH   GFuserAddressETH `validate:"required,eth_addr"`
	AuthSignatureStr GFauthSignature  `validate:"required,len=132"` // singature length with "0x"
}

io_create

type GFethInputLogin

type GFethInputLogin struct {
	UserAddressETH   GFuserAddressETH `validate:"required,eth_addr"`
	AuthSignatureStr GFauthSignature  `validate:"required,len=132"` // singature length with "0x"
	AudienceStr      string           `validate:"omitempty,len=100"`
}

io_login

type GFethInputPreflight

type GFethInputPreflight struct {
	UserAddressETH GFuserAddressETH `validate:"omitempty,eth_addr"`
}

io_preflight

type GFethOutputCreate

type GFethOutputCreate struct {
	NonceExistsBool        bool
	AuthSignatureValidBool bool
}

func ETHpipelineCreate

func ETHpipelineCreate(pInput *GFethInputCreate,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFethOutputCreate, *gf_core.GFerror)

type GFethOutputLogin

type GFethOutputLogin struct {
	NonceExistsBool        bool
	AuthSignatureValidBool bool
	JWTtokenVal            GFjwtTokenVal
	UserID                 gf_core.GF_ID
	SessionID              gf_core.GF_ID
}

func ETHpipelineLogin

func ETHpipelineLogin(pInput *GFethInputLogin,
	pKeyServerInfo *GFkeyServerInfo,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFethOutputLogin, *gf_core.GFerror)

type GFethOutputPreflight

type GFethOutputPreflight struct {
	UserExistsBool bool
	NonceValStr    GFuserNonceVal
}

func ETHpipelinePreflight

func ETHpipelinePreflight(pInput *GFethInputPreflight,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFethOutputPreflight, *gf_core.GFerror)

type GFgoogleUserProfile

type GFgoogleUserProfile struct {
	NameStr       string `bson:"name_str"`
	GivenNameStr  string `bson:"given_name_str"`
	FamilyNameStr string `bson:"family_name_str"`
	NicknameStr   string `bson:"nickname_str"`
	LocaleStr     string `bson:"locale_str"`
	UpdatedAtStr  string `bson:"updated_at_str"`
	PictureURLstr string `bson:"picture_url_str"`
}

type GFjwtPrivateKeyPEMval

type GFjwtPrivateKeyPEMval string

type GFjwtPublicKeyPEMval

type GFjwtPublicKeyPEMval string

type GFjwtSecret

type GFjwtSecret struct {
	Vstr              string             `bson:"v_str"` // schema_version
	Id                primitive.ObjectID `bson:"_id,omitempty"`
	IDstr             gf_core.GF_ID      `bson:"id_str"`
	DeletedBool       bool               `bson:"deleted_bool"`
	CreationUNIXtimeF float64            `bson:"creation_unix_time_f"`

	PublicKeyPEMstr  GFjwtPublicKeyPEMval  `bson:"public_key_pem_str"`
	PrivateKeyPEMstr GFjwtPrivateKeyPEMval `bson:"private_key_pem_str"`
}

type GFjwtSecretKeyVal

type GFjwtSecretKeyVal string

type GFjwtSigningKeyReq

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

type GFjwtTokenVal

type GFjwtTokenVal string

func JWTpipelineGenerate

func JWTpipelineGenerate(pUserIdentifierStr string,
	pAuthSubsystemTypeStr string,
	pAudienceStr string,
	pKeyServerInfo *GFkeyServerInfo,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFjwtTokenVal, *gf_core.GFerror)

type GFjwtValidationKeyReq

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

type GFkeyServerInfo

type GFkeyServerInfo struct {
	GetJWTvalidationKeyCh chan GFjwtValidationKeyReq
	GetJWTsigningKeyCh    chan GFjwtSigningKeyReq
}

func KSinit

func KSinit(pAuth0initBool bool,
	pRuntimeSys *gf_core.RuntimeSys) (*GFkeyServerInfo, *gf_core.GFerror)

initialize a goroutine that servers requests from other goroutines for public/private keypairs

type GFloginAttempt

type GFloginAttempt struct {
	Vstr              string             `bson:"v_str"` // schema_version
	Id                primitive.ObjectID `bson:"_id,omitempty"`
	ID                gf_core.GF_ID      `bson:"id_str"`
	DeletedBool       bool               `bson:"deleted_bool"`
	CreationUNIXtimeF float64            `bson:"creation_unix_time_f"`

	UserTypeStr string        `bson:"user_type_str"` // "regular"|"admin"
	UserID      gf_core.GF_ID `bson:"user_id_str"`
	UserNameStr GFuserName    `bson:"user_name_str"`

	Auth0sessionID gf_core.GF_ID `bson:"auth0_session_id"`

	PassConfirmedBool  bool `bson:"pass_confirmed_bool"`
	EmailConfirmedBool bool `bson:"email_confirmed_bool"`
	MFAconfirmedBool   bool `bson:"mfa_confirmed_bool"`
}

func LoginAttemptGetIfValid

func LoginAttemptGetIfValid(pUserNameStr GFuserName,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFloginAttempt, *gf_core.GFerror)

func LoginAttemptGetOrCreate

func LoginAttemptGetOrCreate(pUserNameStr GFuserName,
	pUserTypeStr string,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFloginAttempt, *gf_core.GFerror)

type GFloginAttemptUpdateOp

type GFloginAttemptUpdateOp struct {
	UserID             *gf_core.GF_ID
	UserNameStr        *GFuserName
	PassConfirmedBool  *bool
	EmailConfirmedBool *bool
	MFAconfirmedBool   *bool
	DeletedBool        *bool
}

type GFserpassOutputCreateRegular

type GFserpassOutputCreateRegular struct {
	UserExistsBool       bool
	UserInInviteListBool bool
	General              *GFuserpassOutputCreate
}

func UserpassPipelineCreateRegular

func UserpassPipelineCreateRegular(pInput *GFuserpassInputCreate,
	pServiceInfo *GFserviceInfo,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFserpassOutputCreateRegular, *gf_core.GFerror)

type GFserviceInfo

type GFserviceInfo struct {

	// name of this service, in case multiple are spawned
	NameStr string

	//------------------------
	// DOMAIN - where this gf_solo instance is reachable on
	DomainBaseStr string

	// DOMAIN_FOR_AUTH_COOKIES - domain/pattern that is set on
	//                           auth cookies, to restrict their scope.
	// its either the same as DomainBaseStr, or can be prefixed with "."
	// to include all the subdomains of that base domain.
	// example:
	// "gloflow.org" | ".gloflow.org" (include subdomains as well)
	DomainForAuthCookiesStr *string

	//------------------------
	// AUTH_SUBSYSTEM_TYPE - userpass | auth0
	AuthSubsystemTypeStr string

	//------------------------
	// ADMIN_MFA_SECRET_KEY_BASE32
	AdminMFAsecretKeyBase32str string

	// AUTH_LOGIN_URL - url of the login page to which the system should
	//                  redirect users after certain operations
	AuthLoginURLstr string

	// AUTH_LOGIN_SUCCESS_REDIRECT_URL - url to redirect to when the user
	//                                   logs in successfuly. if ommited then dont redirect.
	AuthLoginSuccessRedirectURLstr string

	// EVENTS_APP - enable sending of app events from various functions
	EnableEventsAppBool bool

	// enable storage of user_creds in a secret store
	EnableUserCredsInSecretsStoreBool bool

	// enable sending of emails for any function that needs it
	EnableEmailBool bool

	// enable login only for users that have confirmed their email
	EnableEmailRequireConfirmForLoginBool bool

	// enable login only for users that have confirmed their MFA code
	EnableMFArequireConfirmForLoginBool bool
}

type GFuser

type GFuser struct {
	Vstr              string             `bson:"v_str"` // schema_version
	Id                primitive.ObjectID `bson:"_id,omitempty"`
	ID                gf_core.GF_ID      `bson:"id_str"`
	DeletedBool       bool               `bson:"deleted_bool"`
	CreationUNIXtimeF float64            `bson:"creation_unix_time_f"`

	UserTypeStr   string     `bson:"user_type_str"`   // "admin" | "standard"
	UserNameStr   GFuserName `bson:"user_name_str"`   // set once at the creation of the user
	ScreenNameStr string     `bson:"screen_name_str"` // changable durring the lifetime of the user

	DescriptionStr  string             `bson:"description_str"`
	AddressesETHlst []GFuserAddressETH `bson:"addresses_eth_lst"`

	EmailStr           string `bson:"email_str"`
	EmailConfirmedBool bool   `bson:"email_confirmed_bool"` // one-time confirmation on user-creation to validate user

	// IMAGES
	ProfileImageURLstr string `bson:"profile_image_url_str"`
	BannerImageURLstr  string `bson:"banner_image_url_str"`
}

func DBmongoUserGetAll

func DBmongoUserGetAll(pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) ([]*GFuser, *gf_core.GFerror)

func DBsqlUserGetAll

func DBsqlUserGetAll(pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) ([]*GFuser, *gf_core.GFerror)

func DBsqlUserGetByID

func DBsqlUserGetByID(pUserID gf_core.GF_ID,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFuser, *gf_core.GFerror)

type GFuserAddressETH

type GFuserAddressETH string

func HTTPgetUserAddressETHinput

func HTTPgetUserAddressETHinput(pReq *http.Request,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (GFuserAddressETH, *gf_core.GFerror)

func HTTPgetUserStdInput

func HTTPgetUserStdInput(pCtx context.Context,
	pReq *http.Request,
	pRuntimeSys *gf_core.RuntimeSys) (map[string]interface{}, gf_core.GF_ID, GFuserAddressETH, *gf_core.GFerror)

type GFuserCreds

type GFuserCreds struct {
	Vstr              string             `bson:"v_str"` // schema_version
	Id                primitive.ObjectID `bson:"_id,omitempty"`
	ID                gf_core.GF_ID      `bson:"id_str"`
	DeletedBool       bool               `bson:"deleted_bool"`
	CreationUNIXtimeF float64            `bson:"creation_unix_time_f"`

	UserID      gf_core.GF_ID `bson:"user_id_str"`
	UserNameStr GFuserName    `bson:"user_name_str"`
	PassSaltStr string        `bson:"pass_salt_str"`
	PassHashStr string        `bson:"pass_hash_str"`
}

ADD!! - provide logic/plugin for storing this record in some alternative store

separate from the main DB

type GFuserHTTPinputEmailConfirm

type GFuserHTTPinputEmailConfirm struct {
	UserNameStr    GFuserName `validate:"required,min=3,max=50"`
	ConfirmCodeStr string     `validate:"required,min=10,max=20"`
}

func HTTPgetEmailConfirmInput

func HTTPgetEmailConfirmInput(pReq *http.Request,
	pRuntimeSys *gf_core.RuntimeSys) (*GFuserHTTPinputEmailConfirm, *gf_core.GFerror)

type GFuserHTTPinputUpdate

type GFuserHTTPinputUpdate struct {
	ScreenNameStr  *string `json:"screen_name_str" validate:"min=3,max=50"`
	EmailStr       *string `json:"email_str"       validate:"min=6,max=50"`
	DescriptionStr *string `json:"description_str" validate:"min=1,max=2000"`

	ProfileImageURLstr *string `json:"profile_image_url_str" validate:"min=1,max=100"` // FIX!! - validation
	BannerImageURLstr  *string `json:"banner_image_url_str"  validate:"min=1,max=100"` // FIX!! - validation
}

func HTTPgetUserUpdateInput

func HTTPgetUserUpdateInput(pReq *http.Request,
	pRuntimeSys *gf_core.RuntimeSys) (*GFuserHTTPinputUpdate, *gf_core.GFerror)

type GFuserInputGet

type GFuserInputGet struct {
	UserID gf_core.GF_ID
}

type GFuserInputUpdate

type GFuserInputUpdate struct {
	UserID            gf_core.GF_ID    `validate:"required"`                 // required - not updated, but for lookup
	UserAddressETHstr GFuserAddressETH `validate:"omitempty,eth_addr"`       // optional - add an Eth address to the user
	ScreenNameStr     *string          `validate:"omitempty,min=3,max=50"`   // optional
	DescriptionStr    *string          `validate:"omitempty,min=1,max=2000"` // optional
	EmailStr          *string          `validate:"omitempty,email"`          // optional

	ProfileImageURLstr *string `validate:"omitempty,min=1,max=100"` // optional // FIX!! - validation
	BannerImageURLstr  *string `validate:"omitempty,min=1,max=100"` // optional // FIX!! - validation
}

io_update

type GFuserName

type GFuserName string

func DBmongoGetUserNameByID

func DBmongoGetUserNameByID(pUserIDstr gf_core.GF_ID,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (GFuserName, *gf_core.GFerror)

func DBsqlGetUserNameByID

func DBsqlGetUserNameByID(pUserID gf_core.GF_ID,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (GFuserName, *gf_core.GFerror)

func ResolveUserName

func ResolveUserName(pUserID gf_core.GF_ID,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) GFuserName

type GFuserNonce

type GFuserNonce struct {
	Vstr              string             `bson:"v_str"` // schema_version
	Id                primitive.ObjectID `bson:"_id,omitempty"`
	IDstr             gf_core.GF_ID      `bson:"id_str"`
	DeletedBool       bool               `bson:"deleted_bool"`
	CreationUNIXtimeF float64            `bson:"creation_unix_time_f"`

	UserIDstr     gf_core.GF_ID    `bson:"user_id_str"`
	AddressETHstr GFuserAddressETH `bson:"address_eth_str"`
	ValStr        GFuserNonceVal   `bson:"val_str"`
}

func NonceCreate

func NonceCreate(pNonceValStr GFuserNonceVal,
	pUserIDstr gf_core.GF_ID,
	pUserAddressETHstr GFuserAddressETH,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFuserNonce, *gf_core.GFerror)

type GFuserNonceVal

type GFuserNonceVal string

type GFuserOutputGet

type GFuserOutputGet struct {
	UserNameStr        GFuserName
	ScreenNameStr      string
	EmailStr           string
	DescriptionStr     string
	ProfileImageURLstr string
	BannerImageURLstr  string
}

func UsersPipelineGet

func UsersPipelineGet(pInput *GFuserInputGet,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFuserOutputGet, *gf_core.GFerror)

type GFuserOutputUpdate

type GFuserOutputUpdate struct {
}

func UsersPipelineUpdate

func UsersPipelineUpdate(pInput *GFuserInputUpdate,
	pServiceInfo *GFserviceInfo,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFuserOutputUpdate, *gf_core.GFerror)

type GFuserUpdateOp

type GFuserUpdateOp struct {
	DeletedBool   *bool // if nil dont update, else update to true/false
	UserNameStr   *GFuserName
	ScreenNameStr *string

	DescriptionStr     *string
	EmailStr           *string
	EmailConfirmedBool *bool
	MFAconfirmBool     *bool // if nil dont update, else update to true/false

	ProfileImageURLstr *string
}

type GFuserpassInputCreate

type GFuserpassInputCreate struct {
	UserNameStr GFuserName `validate:"required,min=3,max=50"`
	PassStr     string     `validate:"required,min=8,max=50"`
	EmailStr    string     `validate:"required,email"`
	UserTypeStr string     `validate:"required"` // "admin"|"standard"
}

io_create

type GFuserpassInputLogin

type GFuserpassInputLogin struct {

	// username is always required, with both pass and email login
	UserNameStr GFuserName `validate:"required,min=3,max=50"`

	// pass is not provided if email-login is used
	PassStr string `validate:"omitempty,min=8,max=50"`

	// for certain emails allow email-login
	EmailStr string `validate:"omitempty,email"`

	AudienceStr string
}

type GFuserpassInputLoginFinalize

type GFuserpassInputLoginFinalize struct {
	UserNameStr GFuserName `validate:"required,min=3,max=50"`
	AudienceStr string     `validate:"omitempty,max=100"`
}

io_login_finalize

type GFuserpassOutputCreate

type GFuserpassOutputCreate struct {
	UserNameStr GFuserName
	UserID      gf_core.GF_ID
}

func UserpassPipelineCreate

func UserpassPipelineCreate(pInput *GFuserpassInputCreate,
	pServiceInfo *GFserviceInfo,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFuserpassOutputCreate, *gf_core.GFerror)

type GFuserpassOutputLogin

type GFuserpassOutputLogin struct {
	UserExistsBool     bool
	EmailConfirmedBool bool
	PassValidBool      bool
	UserID             gf_core.GF_ID
	JWTtokenVal        GFjwtTokenVal
	SessionID          gf_core.GF_ID
}

func UserpassPipelineLogin

func UserpassPipelineLogin(pInput *GFuserpassInputLogin,
	pKeyServerInfo *GFkeyServerInfo,
	pServiceInfo *GFserviceInfo,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFuserpassOutputLogin, *gf_core.GFerror)

type GFuserpassOutputLoginFinalize

type GFuserpassOutputLoginFinalize struct {
	EmailConfirmedBool bool
	UserID             gf_core.GF_ID
	JWTtokenVal        GFjwtTokenVal
}

func UserpassPipelineLoginFinalize

func UserpassPipelineLoginFinalize(pInput *GFuserpassInputLoginFinalize,
	pKeyServerInfo *GFkeyServerInfo,
	pServiceInfo *GFserviceInfo,
	pCtx context.Context,
	pRuntimeSys *gf_core.RuntimeSys) (*GFuserpassOutputLoginFinalize, *gf_core.GFerror)

Jump to

Keyboard shortcuts

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