Documentation
¶
Index ¶
- Constants
- Variables
- func BoolP(v bool) *bool
- func CheckAddress(address string, timeout time.Duration) bool
- func DeferableClose(ctx context.Context, closeme io.Closer)
- func Error(ctx context.Context, msg string, args ...interface{}) error
- func FromGabs(c *gabs.Container, v interface{}) error
- func GenerateId(prefix string, num int) string
- func GeneratePassword(passwordLength, minSpecialChar, minNum, minUpperCase int) string
- func GetFieldString(v interface{}, field string) string
- func GetID(ctx context.Context) string
- func GetLog(ctx context.Context) string
- func HashId(prefix string, parts ...string) string
- func Info(ctx context.Context, msg string, args ...interface{})
- func IsAdmin(user *UserJWT) bool
- func IsMap(suspect interface{}) bool
- func IsPointer(item interface{}) bool
- func IsZeroDate(dt strfmt.DateTime) bool
- func MapKey[T any](data map[string]T, key string, caseInsensitive bool) (T, bool)
- func MapKeyStr(data map[string]interface{}, key string, caseInsensitive bool) (string, bool)
- func NewByteReadCloser(data []byte) io.ReadCloser
- func NewInstance(v interface{}) interface{}
- func NewInstanceT[T any](v interface{}) (T, error)
- func NewT[T any]() (T, error)
- func SetFieldString(v interface{}, field string, value string)
- func StartContext() context.Context
- func StringP(s string) *string
- func ToGabs(item interface{}) (*gabs.Container, error)
- func UnmarshallT[T any](data []byte) (*T, error)
- func WaitForAddress(address string, timeout time.Duration) bool
- func Warn(ctx context.Context, msg string, args ...interface{})
- func WithID(ctx context.Context, ID string) context.Context
- func WithLogging(ctx context.Context) context.Context
- func WithUser(ctx context.Context, user *UserJWT) context.Context
- type ByteCounter
- type Groups
- type Logs
- type ProviderFactory
- type ProvidersRegistry
- type SeekingBuffer
- type Storage
- type UserJWT
- type UserJWTRealmAccess
- type UserJWTResourceAccess
- type UserJWTResourceAccessAccount
- type Users
Constants ¶
View Source
const UserAnonymous = "ANONYMOUS"
Variables ¶
View Source
var DriverNotFoundError = errors.New("Drive Not Found")
View Source
var GroupProviders = NewProviderRegistry[Users]()
View Source
var IDKey userkey = userkey("id")
View Source
var Log logkey
View Source
var UserKey userkey = userkey("userkey")
View Source
var UserProviders = NewProviderRegistry[Users]()
Functions ¶
func GenerateId ¶
Generate an ID. The ID will follow the pattern {prefix}-{id} where the id is a randomly generated string of alphanumeric characters
func GeneratePassword ¶
func GetFieldString ¶
func IsZeroDate ¶
func NewByteReadCloser ¶
func NewByteReadCloser(data []byte) io.ReadCloser
func NewInstance ¶
func NewInstance(v interface{}) interface{}
func NewInstanceT ¶
func SetFieldString ¶
func StartContext ¶
func UnmarshallT ¶
Types ¶
type ByteCounter ¶
type ByteCounter struct {
// contains filtered or unexported fields
}
func NewByteCounter ¶
func NewByteCounter(stream io.ReadCloser) *ByteCounter
func (*ByteCounter) Close ¶
func (bc *ByteCounter) Close() error
func (*ByteCounter) Total ¶
func (bc *ByteCounter) Total() int64
type Groups ¶
type Groups interface {
ListGroups(ctx context.Context, uid string) ([]*models.Group, error)
GetUserGroups(ctx context.Context, page interface{}, filter interface{}) ([]*models.Group, interface{}, error)
NewGroup(ctx context.Context, grp *models.Group) (*models.Group, error)
UpdateGroup(ctx context.Context, grp *models.Group) (bool, error)
GetGroupMembers(ctx context.Context, grpId string) ([]string, error)
}
type ProviderFactory ¶
type ProvidersRegistry ¶
func NewProviderRegistry ¶
func NewProviderRegistry[T any]() *ProvidersRegistry[T]
func (*ProvidersRegistry[T]) New ¶
func (pr *ProvidersRegistry[T]) New(name string, cfg interface{}) (T, error)
func (*ProvidersRegistry[T]) Register ¶
func (pr *ProvidersRegistry[T]) Register(name string, fn func(cfg interface{}) (T, error))
type SeekingBuffer ¶
type SeekingBuffer struct {
// contains filtered or unexported fields
}
func NewSeekingBuffer ¶
func NewSeekingBuffer(b []byte) *SeekingBuffer
type UserJWT ¶
type UserJWT struct {
EXP int64 `json:"exp"`
IAT int64 `json:"iat"`
AuthTime int64 `json:"auth_time"`
JTI string `json:"jti"`
ISS string `json:"iss"`
AUD string `json:"aud"`
TYP string `json:"typ"`
AZP string `json:"azp"`
Nonce string `json:"nonce"`
SessionState string `json:"session_state"`
ACR string `json:"acr"`
AllowedOrigins []string `json:"allowed-origins"`
RealmAccess *UserJWTRealmAccess `json:"realm_access"`
ResourceAccess *UserJWTResourceAccess `json:"resource_access"`
Scope string `json:"scope"`
EmailVerified bool `json:"email_verified"`
Name string `json:"name"`
PreferredUserName string `json:"preferred_username"`
GivenName string `json:"given_name"`
FamilyName string `json:"family_name"`
Email string `json:"email"`
UPN string `json:"upn"`
}
func GetUserFromRequest ¶
func GetUserInfoFromToken ¶
GetUserInfoFromToken Gets a user information from the JWT (Authorization Header)
func ParseToken ¶
ParseToken Parses the id token from cognito
func (*UserJWT) IsAuthenticated ¶
type UserJWTRealmAccess ¶
type UserJWTRealmAccess struct {
Roles []string `json:"roles"`
}
type UserJWTResourceAccess ¶
type UserJWTResourceAccess struct {
Account *UserJWTResourceAccessAccount `json:"account"`
}
type UserJWTResourceAccessAccount ¶
type UserJWTResourceAccessAccount struct {
Roles []string `json:"roles"`
}
type Users ¶
type Users interface {
ListUsers(ctx context.Context, page interface{}, filter interface{}) ([]*models.User, interface{}, error)
// Retrieves a specific user.
GetUser(ctx context.Context, uid string) (*models.User, error)
// NewUser creates a new user with the given information and returns the new user with any additional
// fields populated
NewUser(ctx context.Context, newUser *models.User) (*models.User, error)
UpdateUser(ctx context.Context, usr *models.User) (bool, error)
Enable(ctx context.Context, uid string) (bool, error)
Disable(ctx context.Context, uid string) (bool, error)
DeleteUser(ctx context.Context, uid string) (bool, error)
}
User interface manager
Source Files
¶
Click to show internal directories.
Click to hide internal directories.