Documentation
¶
Index ¶
- func InitAuthentication(auth *core.Authentication)
- func Token() (string, error)
- type Context
- func (c *Context) BindParamsFromBody(obj any) (err error)
- func (c *Context) BindParamsFromQuery(obj any) (err error)
- func (c *Context) GetCodeFromUrl() string
- func (c *Context) GetId2FromUrl() (uint, error)
- func (c *Context) GetIdFromUrl() (uint, error)
- func (c *Context) GetPagingParams() (offset int, limit int, errV error)
- func (c *Context) GetParamAsBool(name string, defValue bool) (bool, error)
- func (c *Context) GetParamAsInt(name string, defValue int) (int, error)
- func (c *Context) GetParamAsString(name string, defValue string) string
- func (c *Context) ReturnData(contentType string, data []byte) error
- func (c *Context) ReturnError(err error)
- func (c *Context) ReturnList(result any, offset int, limit int, size int) error
- func (c *Context) ReturnObject(data any) error
- type OidcController
- type RestContext
- type RestService
- type TokenResponse
- type UserSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitAuthentication ¶
func InitAuthentication(auth *core.Authentication)
Types ¶
type Context ¶
type Context struct {
Gin *gin.Context
Session *UserSession
Log *slog.Logger
Config any
Token string
}
func (*Context) BindParamsFromBody ¶
func (*Context) BindParamsFromQuery ¶
func (*Context) GetCodeFromUrl ¶
func (*Context) GetId2FromUrl ¶
func (*Context) GetIdFromUrl ¶
func (*Context) GetPagingParams ¶
func (*Context) GetParamAsBool ¶
func (*Context) GetParamAsInt ¶
func (*Context) GetParamAsString ¶
func (*Context) ReturnError ¶
func (*Context) ReturnList ¶
func (*Context) ReturnObject ¶
type OidcController ¶
type OidcController struct {
// contains filtered or unexported fields
}
func NewOidcController ¶
func (*OidcController) Secure ¶
func (oc *OidcController) Secure(h RestService, roles []role.Role) func(c *gin.Context)
type RestContext ¶
type RestService ¶
type RestService func(c *Context)
type TokenResponse ¶
type UserSession ¶
type UserSession struct {
SessionID string
Username string
OnBehalfOf string
Name string
Surname string
Email string
IssuedAt time.Time
Expiry time.Time
Roles map[role.Role]any
}
func (*UserSession) IsAdmin ¶
func (us *UserSession) IsAdmin() bool
func (*UserSession) IsUserInRole ¶
func (us *UserSession) IsUserInRole(roles []role.Role) bool
Click to show internal directories.
Click to hide internal directories.