authlib

package
v0.0.0-...-ecb45e5 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOCAL_DB_AUTH = "local"
	LDAP_AUTH     = "ldap"
)
View Source
const SESSION_EXPIRY = 5 * time.Minute

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthGateway

type AuthGateway struct {
	Middlewares Middlewares
	Handlers    Handlers
	// contains filtered or unexported fields
}

func NewAuthGateway

func NewAuthGateway(o AuthGatewayOption) (*AuthGateway, error)

type AuthGatewayOption

type AuthGatewayOption struct {
	Logger         *zap.SugaredLogger
	RedisURL       string
	LoginURL       string
	WhoAmIURL      string
	HomePageURL    string
	UserRefreshURL string
	APIKey         string
	ServiceID      string
	Secret         string
	CookiePath     string
	SessionExpiry  int
}

type AuthenticationMethod

type AuthenticationMethod func(*zap.SugaredLogger, User, LoginRequest) (*User, error)

type Handlers

type Handlers struct {
	CookiePath string
	// contains filtered or unexported fields
}

func (*Handlers) GetActiveDomain

func (h *Handlers) GetActiveDomain(r *http.Request) (string, error)

func (*Handlers) GetUser

func (h *Handlers) GetUser(tk string) (*User, error)

func (*Handlers) LoginRequestCallbackHandler

func (s *Handlers) LoginRequestCallbackHandler() http.HandlerFunc

func (*Handlers) Logout

func (s *Handlers) Logout() http.HandlerFunc

func (*Handlers) Refresh

func (svc *Handlers) Refresh() http.HandlerFunc

func (*Handlers) SetActiveDomain

func (h *Handlers) SetActiveDomain(
	r *http.Request, activeDomain string) error

type JSONResponse

type JSONResponse struct {
	Error   bool        `json:"error"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

type LoginRequest

type LoginRequest struct {
	Username string
	Password string
	Token    string
}

type Middlewares

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

func (*Middlewares) AddLoggedInUserDetails

func (s *Middlewares) AddLoggedInUserDetails(h http.Handler) http.Handler

func (*Middlewares) LoginRequired

func (s *Middlewares) LoginRequired(h http.Handler) http.Handler

type User

type User struct {
	gorm.Model
	ID                   int64
	SID                  string `gorm:"uniqueIndex;size:255" json:"-"`
	GUID                 string `gorm:"uniqueIndex;size:255" json:"global_id"`
	Username             string `gorm:"uniqueIndex;size:255"`
	Firstname            string `json:"firstname"`
	Lastname             string `json:"lastname"`
	FullName             string `json:"fullname"`
	Email                string `gorm:"uniqueIndex;size:255" json:"email"`
	Password             []byte `json:"-"`
	Active               bool
	Locked               bool
	ExpiryDate           time.Time
	AuthenticationSystem string
	EnableTOTP           bool
	TOTPSecret           string
	TOTPSecretLength     int64
	IAMRoles             map[string]map[string]bool `gorm:"-" json:"iam_roles"`
	Attributes           map[string]string          `gorm:"-" json:"attributes"`
	UserMessage          string                     `json:"message,omitempty"`
	ActiveDomain         string                     `gorm:"-"`
}

func (*User) Clone

func (user *User) Clone() User

func (*User) HasPriviledge

func (user *User) HasPriviledge(reqdPermission string) error

type UserAttribute

type UserAttribute struct {
	Username  string `gorm:"uniqueIndex:user_grp;size:255"`
	Attribute string `gorm:"uniqueIndex:user_grp;size:255"`
	Value     string
}

type UserContextkey

type UserContextkey string
const CTX_USER_KEY UserContextkey = "currentuser"

type UserGroup

type UserGroup struct {
	Username string `gorm:"uniqueIndex:user_grp;size:255"`
	Group    string `gorm:"uniqueIndex:user_grp;size:255"`
	Enabled  bool
}

Jump to

Keyboard shortcuts

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