security

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUser

func CreateUser(ctx context.Context, user *UserCreate) error

func DeleteUser

func DeleteUser(ctx context.Context, id string) error

func DisableUser

func DisableUser(ctx context.Context, id string) error

func EnableUser

func EnableUser(ctx context.Context, id string) error

func InitializeAuthenticationService

func InitializeAuthenticationService()

func UpdateUser

func UpdateUser(ctx context.Context, id string, user *UserUpdate) error

Types

type AuthenticationContext

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

AuthenticationContext is the external user struct

func GetAuthenticationContext

func GetAuthenticationContext(ctx context.Context) *AuthenticationContext

GetAuthenticationContext return the authentication context inside the context

func NewAuthenticationContext

func NewAuthenticationContext(tenantID, userID string) *AuthenticationContext

NewAuthenticationContext returns a pointer of authentication context

func (*AuthenticationContext) GetTenantID

func (a *AuthenticationContext) GetTenantID() string

GetTenantID returns the tenant id

func (*AuthenticationContext) GetUserID

func (a *AuthenticationContext) GetUserID() string

GetUserID returns the user id

func (*AuthenticationContext) SetInContext

func (a *AuthenticationContext) SetInContext(ctx context.Context) context.Context

SetInContext returns a context with authentication inside

func (*AuthenticationContext) String

func (a *AuthenticationContext) String() string

String returns the details of auth context

func (*AuthenticationContext) Valid

func (a *AuthenticationContext) Valid() bool

Valid returns a boolean if the context is valid

type IAuthenticationContext

type IAuthenticationContext interface {
	GetUserID() string
	GetTenantID() string
}

IAuthenticationContext is the external user contract

type User

type User struct {
	ID       string
	Email    string
	Name     string
	TenantID string
	Profile  string
	PhotoURL string
}

func GetUser

func GetUser(ctx context.Context, id string) (*User, error)

type UserCreate

type UserCreate struct {
	ID       string
	Email    string
	Password string
	Name     string
	TenantID string
	Profile  string
	PhotoURL string
}

type UserUpdate

type UserUpdate struct {
	Email    string
	Password string
	Name     string
	TenantID string
	Profile  string
	PhotoURL string
}

Jump to

Keyboard shortcuts

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