auth

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 11 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context added in v1.2.0

type Context struct {
	Gin     *gin.Context
	Session *UserSession
	Log     *slog.Logger
	Config  any
	Token   string
}

func (*Context) BindParamsFromBody added in v1.2.1

func (c *Context) BindParamsFromBody(obj any) (err error)

func (*Context) BindParamsFromQuery added in v1.2.1

func (c *Context) BindParamsFromQuery(obj any) (err error)

func (*Context) GetCodeFromUrl added in v1.2.1

func (c *Context) GetCodeFromUrl() string

func (*Context) GetId2FromUrl added in v1.7.7

func (c *Context) GetId2FromUrl() (uint, error)

func (*Context) GetIdFromUrl added in v1.2.1

func (c *Context) GetIdFromUrl() (uint, error)

func (*Context) GetPagingParams added in v1.2.1

func (c *Context) GetPagingParams() (offset int, limit int, errV error)

func (*Context) GetParamAsBool added in v1.6.1

func (c *Context) GetParamAsBool(name string, defValue bool) (bool, error)

func (*Context) GetParamAsInt added in v1.6.1

func (c *Context) GetParamAsInt(name string, defValue int) (int, error)

func (*Context) GetParamAsString added in v1.7.3

func (c *Context) GetParamAsString(name string, defValue string) string

func (*Context) ReturnError added in v1.2.1

func (c *Context) ReturnError(err error)

func (*Context) ReturnList added in v1.2.1

func (c *Context) ReturnList(result any, offset int, limit int, size int) error

func (*Context) ReturnObject added in v1.2.1

func (c *Context) ReturnObject(data any) error

type OidcController

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

func NewOidcController

func NewOidcController(authority string, client *http.Client, logger *slog.Logger, config any) *OidcController

func (*OidcController) Secure

func (oc *OidcController) Secure(h RestService, roles []role.Role) func(c *gin.Context)

type RestService added in v1.2.0

type RestService func(c *Context)

type UserSession

type UserSession struct {
	SessionID string
	Username  string
	Name      string
	Surname   string
	Email     string
	IssuedAt  time.Time
	Expiry    time.Time
	Roles     map[role.Role]any
}

func (*UserSession) IsAdmin added in v1.1.1

func (us *UserSession) IsAdmin() bool

func (*UserSession) IsUserInRole

func (us *UserSession) IsUserInRole(roles []role.Role) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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