user_auth

package
v0.0.0-...-ac43cf2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthTokenName      = "X-Webitel-Access"
	RequestContextName = "grpc_ctx"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthManager

type AuthManager interface {
	Authorize(ctx context.Context, token string, mainObjClassName string, mainAccessMode auth.AccessMode) (*UserAuthSession, error)
	AuthorizeFromContext(ctx context.Context, mainObjClassName string, mainAccessMode auth.AccessMode) (*UserAuthSession, error)
}

type AuthorizationClient

type AuthorizationClient struct {
	Client     authclient.AuthClient
	Group      singleflight.Group
	Connection *grpc.ClientConn
}

func NewAuthorizationClient

func NewAuthorizationClient(conn *grpc.ClientConn) (*AuthorizationClient, error)

func (*AuthorizationClient) UserInfo

func (c *AuthorizationClient) UserInfo(ctx context.Context, token string, mainObjClassName string, mainAccessMode auth.AccessMode) (*UserAuthSession, error)

type Permission

type Permission struct {
	Id   string
	Name string
}

type Role

type Role struct {
	Name string
	Id   int64
}

type Scope

type Scope struct {
	Name   string
	Class  string
	Access string
	Id     int64
	Abac   bool
	Obac   bool
	Rbac   bool
}

func (*Scope) GetAccess

func (s *Scope) GetAccess() string

func (*Scope) GetObjectName

func (s *Scope) GetObjectName() string

func (*Scope) IsObacUsed

func (s *Scope) IsObacUsed() bool

func (*Scope) IsRbacUsed

func (s *Scope) IsRbacUsed() bool

type User

type User struct {
	Name      string
	Username  string
	Extension string
	Id        int64
}

type UserAuthSession

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

func ConstructSessionFromUserInfo

func ConstructSessionFromUserInfo(userinfo *authmodel.Userinfo, mainObjClass string, mainAccess auth.AccessMode) *UserAuthSession

func (*UserAuthSession) CheckLicenseAccess

func (s *UserAuthSession) CheckLicenseAccess(name string) bool

func (*UserAuthSession) CheckObacAccess

func (s *UserAuthSession) CheckObacAccess(scopeName string, accessType auth.AccessMode) bool

func (*UserAuthSession) GetAllObjectScopes

func (s *UserAuthSession) GetAllObjectScopes() []auth.ObjectScoper

func (*UserAuthSession) GetDomainId

func (s *UserAuthSession) GetDomainId() int64

func (*UserAuthSession) GetMainAccessMode

func (s *UserAuthSession) GetMainAccessMode() auth.AccessMode

func (*UserAuthSession) GetMainObjClassName

func (s *UserAuthSession) GetMainObjClassName() string

func (*UserAuthSession) GetObjectScope

func (s *UserAuthSession) GetObjectScope(sc string) auth.ObjectScoper

func (*UserAuthSession) GetPermissions

func (s *UserAuthSession) GetPermissions() []string

func (*UserAuthSession) GetRoles

func (s *UserAuthSession) GetRoles() []int64

func (*UserAuthSession) GetUserId

func (s *UserAuthSession) GetUserId() int64

func (*UserAuthSession) HasSuperPermission

func (s *UserAuthSession) HasSuperPermission(permission auth.SuperPermission) bool

func (*UserAuthSession) IsExpired

func (s *UserAuthSession) IsExpired() bool

func (*UserAuthSession) IsRbacCheckRequired

func (s *UserAuthSession) IsRbacCheckRequired(scopeName string, accessType auth.AccessMode) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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