authservice

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppLike

type AppLike interface {
	DB() db.Client
	Key() string
	GetAuthProvider(string) fs.AuthProvider
	Roles() []*fs.Role
}

type AuthService

type AuthService struct {
	DB              func() db.Client
	AppKey          func() string
	GetAuthProvider func(string) fs.AuthProvider
	Roles           func() []*fs.Role
}

func New

func New(app AppLike) *AuthService

func (*AuthService) AuthUserCan added in v0.6.0

func (as *AuthService) AuthUserCan(c fs.Context, user *fs.User, resourceID string) bool

func (*AuthService) Authorize added in v0.3.0

func (as *AuthService) Authorize(c fs.Context) error

func (*AuthService) Callback

func (as *AuthService) Callback(c fs.Context, _ any) (u *LoginResponse, err error)

func (*AuthService) CreateResource added in v0.6.0

func (as *AuthService) CreateResource(api *fs.Resource, authProviders map[string]fs.AuthProvider)

func (*AuthService) GetPermission added in v0.3.0

func (as *AuthService) GetPermission(roleID uint64, resource string) *fs.Permission

func (*AuthService) GetRolesFromIDs added in v0.3.0

func (as *AuthService) GetRolesFromIDs(ids []uint64) []*fs.Role

func (*AuthService) Login

func (as *AuthService) Login(c fs.Context, _ any) (_ any, err error)

func (*AuthService) Me added in v0.5.0

func (as *AuthService) Me(c fs.Context, _ any) (*fs.User, error)

func (*AuthService) ParseUser added in v0.3.0

func (as *AuthService) ParseUser(c fs.Context) error

func (*AuthService) VerifyIDToken added in v0.7.5

func (as *AuthService) VerifyIDToken(c fs.Context, payload fs.IDToken) (u *LoginResponse, err error)

type LoginResponse added in v0.5.0

type LoginResponse struct {
	Token   string    `json:"token"`
	Expires time.Time `json:"expires"`
}

Jump to

Keyboard shortcuts

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