userhelpers

package
v0.0.0-...-a97fee2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOrCreateUserAccount

func GetOrCreateUserAccount(ctx context.Context, np sqlutils.NamedPreparer, txPreparer sqlutils.TransactionPreparer, username string, hasLoggedIn bool,
	isMacUser bool, getAccountInformation GetAccountInfoFunc) (*authentication.UserAccount, error)

GetOrCreateUserAccount will return an account if it exists, or create and return a new one if not

func NewUserAccountServiceMiddleware

func NewUserAccountServiceMiddleware(userFunction authentication.GetUserAccountFromDBFunc) func(http.Handler) http.Handler

NewUserAccountServiceMiddleware creates a new middleware which decorates the context with a authentication.GetUserAccountFromDBFunc

func UserAccountGetByIDLOADER

func UserAccountGetByIDLOADER(ctx context.Context, id uuid.UUID) (*authentication.UserAccount, error)

UserAccountGetByIDLOADER uses a data loader to return a user account from the database

Types

type AccountInfo

type AccountInfo OktaAccountInfo

AccountInfo represents information needed to make a UserAccount, independent of the source of the information

func GetOktaAccountInfoWrapper

func GetOktaAccountInfoWrapper(ctx context.Context, username string, getAccountInformation GetOktaAccountInfoFunc) (*AccountInfo, error)

GetOktaAccountInfoWrapper converts a returns OktaAccountInformation converted to AccountInformation

func GetUserInfoAccountInfoWrapper

func GetUserInfoAccountInfoWrapper(ctx context.Context, username string, getUserInfo GetUserInfoFunc) (*AccountInfo, error)

GetUserInfoAccountInfoWrapper this function appends models.UserInfo with needed account info fields as UNKNOWN

type GetAccountInfoFunc

type GetAccountInfoFunc func(ctx context.Context, username string) (*AccountInfo, error)

GetAccountInfoFunc represents a type of function which takes a context and username and returns AccountInfo

func GetOktaAccountInfoWrapperFunction

func GetOktaAccountInfoWrapperFunction(getAccountInformation GetOktaAccountInfoFunc) GetAccountInfoFunc

GetOktaAccountInfoWrapperFunction returns a function that returns *AccountInfo with the input of a function that returns OktaAccountInfo

func GetUserInfoAccountInfoWrapperFunc

func GetUserInfoAccountInfoWrapperFunc(getUserInfo GetUserInfoFunc) GetAccountInfoFunc

GetUserInfoAccountInfoWrapperFunc returns a function that returns *AccountInfo with the input of a function that returns UserInfo

type GetOktaAccountInfoFunc

type GetOktaAccountInfoFunc func(ctx context.Context, username string) (*OktaAccountInfo, error)

GetOktaAccountInfoFunc represents a type of function which takes a context and username and returns OktaAccountInfo

type GetUserInfoFunc

type GetUserInfoFunc func(ctx context.Context, username string) (*models.UserInfo, error)

GetUserInfoFunc represents a type of function which takes a context and username and returns UserInfo

type OktaAccountInfo

type OktaAccountInfo struct {
	Name              string `json:"name"`
	Locale            string `json:"locale"`
	Email             string `json:"email"`
	PreferredUsername string `json:"preferred_username"`
	GivenName         string `json:"given_name"`
	FamilyName        string `json:"family_name"`
	ZoneInfo          string `json:"zoneinfo"`
}

OktaAccountInfo represents the information you get if you query an account from Okta TODO Replace this with calls to the Okta API so we can use the same information we use in other places in the application

func GetOktaAccountInfo

func GetOktaAccountInfo(ctx context.Context, _ string) (*OktaAccountInfo, error)

GetOktaAccountInfo uses the Okta endpoint to retun OktaAccountInfo

func GetUserInfoFromOktaLocal

func GetUserInfoFromOktaLocal(ctx context.Context, username string) (*OktaAccountInfo, error)

GetUserInfoFromOktaLocal is used to simulate okta user information when testing locally

Jump to

Keyboard shortcuts

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