database

package
v0.0.0-...-b249e79 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInfoDbOutput

type ClientInfoDbOutput struct {
	Sub, Name, Secret, Domain, Owner, Perms string
	Public, SSO, Active                     bool
}

func (*ClientInfoDbOutput) GetDomain

func (c *ClientInfoDbOutput) GetDomain() string

func (*ClientInfoDbOutput) GetID

func (c *ClientInfoDbOutput) GetID() string

func (*ClientInfoDbOutput) GetName

func (c *ClientInfoDbOutput) GetName() string

GetName is an extra field for the oauth handler to display the application name

func (*ClientInfoDbOutput) GetSecret

func (c *ClientInfoDbOutput) GetSecret() string

func (*ClientInfoDbOutput) GetUserID

func (c *ClientInfoDbOutput) GetUserID() string

func (*ClientInfoDbOutput) IsActive

func (c *ClientInfoDbOutput) IsActive() bool

IsActive is an extra field for the app manager to get the active state

func (*ClientInfoDbOutput) IsPublic

func (c *ClientInfoDbOutput) IsPublic() bool

func (*ClientInfoDbOutput) IsSSO

func (c *ClientInfoDbOutput) IsSSO() bool

IsSSO is an extra field for the oauth handler to skip the user input stage this is for trusted applications to get permissions without asking the user

func (*ClientInfoDbOutput) UsePerms

func (c *ClientInfoDbOutput) UsePerms() string

UsePerms is an extra field for the userinfo handler to return user permissions matching the requested values

type DB

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

func Open

func Open(p string) (*DB, error)

func (*DB) Begin

func (d *DB) Begin() (*Tx, error)

func (*DB) BeginCtx

func (d *DB) BeginCtx(ctx context.Context) (*Tx, error)

func (*DB) Close

func (d *DB) Close() error

type Tx

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

func (*Tx) Commit

func (t *Tx) Commit() error

func (*Tx) GetAppList

func (t *Tx) GetAppList(owner string, admin bool, offset int) ([]ClientInfoDbOutput, error)

func (*Tx) GetClientInfo

func (t *Tx) GetClientInfo(sub string) (oauth2.ClientInfo, error)

func (*Tx) GetUser

func (t *Tx) GetUser(sub string) (*User, error)

func (*Tx) GetUserEmail

func (t *Tx) GetUserEmail(sub string) (string, error)

func (*Tx) GetUserList

func (t *Tx) GetUserList(offset int) ([]User, error)

func (*Tx) GetUserRoles

func (t *Tx) GetUserRoles(sub string) (string, error)

func (*Tx) GetUserToken

func (t *Tx) GetUserToken(subject string, accessToken, refreshToken *string, expiry *time.Time) error

func (*Tx) HasUser

func (t *Tx) HasUser() error

func (*Tx) InsertClientApp

func (t *Tx) InsertClientApp(name, domain, owner, perms string, public, sso, active bool) error

func (*Tx) InsertUser

func (t *Tx) InsertUser(subject, email string, verifyEmail bool, roles, userinfo string, active bool) error

func (*Tx) ResetClientAppSecret

func (t *Tx) ResetClientAppSecret(subject uuid.UUID, owner string) (string, error)

func (*Tx) Rollback

func (t *Tx) Rollback()

func (*Tx) UpdateClientApp

func (t *Tx) UpdateClientApp(subject uuid.UUID, owner, name, domain, perms string, hasPerms, public, sso, active bool) error

func (*Tx) UpdateUser

func (t *Tx) UpdateUser(subject, roles string, active bool) error

func (*Tx) UpdateUserInfo

func (t *Tx) UpdateUserInfo(subject, email string, verified bool, userinfo string) error

func (*Tx) UpdateUserToken

func (t *Tx) UpdateUserToken(subject, accessToken, refreshToken string, expiry time.Time) error

func (*Tx) UserEmailExists

func (t *Tx) UserEmailExists(email string) (exists bool, err error)

type User

type User struct {
	Sub           string    `json:"sub"`
	Email         string    `json:"email"`
	EmailVerified bool      `json:"email_verified"`
	Roles         string    `json:"roles"`
	UserInfo      string    `json:"userinfo"`
	UpdatedAt     time.Time `json:"updated_at"`
	Active        bool      `json:"active"`
}

Jump to

Keyboard shortcuts

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