auths

package
v0.0.0-...-24ccd8c Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAllowedPermission

func IsAllowedPermission(ctx context.Context, perms []permSchema.Permission, collect *mongo.Collection, auth *domain.Auth) (bool, error)

IsAllowedPermission allows to know if a permission is valid

func IsAllowedRole

func IsAllowedRole(ctx context.Context, user *usersSchema.User, collect *mongo.Collection) ([]permSchema.Permission, bool, error)

IsAllowedRole allows to know if a role is valid or not and return all permission with relation

Types

type Claims

type Claims struct {
	Roles         []string           `json:"roles"`
	StandarClaims jwt.StandardClaims `json:"standard_claims"`
}

func DecodeTokenJWT

func DecodeTokenJWT(t string) (*Claims, error)

DecodeTokenJWT get the claims from a token valid

type Store

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

Store struct manages interactions with users store

func New

func New(db *mongo.Client) *Store

New creates a new Store struct

func (*Store) AuthUser

func (s *Store) AuthUser(ctx context.Context, auth *domain.Auth) error

AuthUser method allow search in database and get permissions and roles valids

Jump to

Keyboard shortcuts

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