service

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AdminRole = "admin"
	UserRole  = "user"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth interface {
	GetAdminToken() (string, error)
	GetUserToken(userId string) (string, error)
	GetThingToken(thingId string, userId string) (string, error)
	GetClaimsUserToken(token string) (*UserAuthClaim, error)
	GetClaimsThingToken(token string) (*ThingAuthClaim, error)
	ValidateThingToken(token string) error
	ValidateUserToken(token string) error
}

func New

func New(c ServiceConf) Auth

type ServiceConf

type ServiceConf struct {
	Secret      string
	Environment string
}

type ThingAuthClaim

type ThingAuthClaim struct {
	UserId string `json:"UserId"`
	jwt.StandardClaims
}

type UserAuthClaim

type UserAuthClaim struct {
	Role string `json:"Role"`
	jwt.StandardClaims
}

Jump to

Keyboard shortcuts

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