service

package
v3.6.5-1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthClaims

type AuthClaims struct {
	Username string `json:"user_name"`
	Locked   bool   `json:"locked"`
	Role     string `json:"role"`
}

AuthClaims is a custom claims object that contains user authentication and authorization infomration.

type AuthSvc

type AuthSvc interface {
	CreateToken(user *cmdb.User) (token *Token, err error)
	CreateTokenString(token *Token) (tokenString string, err error)
	ParseTokenString(tokenString string) (token *Token, err error)
	CreateCookie(tokenString string) (cookie *http.Cookie, err error)
	ReadCookie(request *http.Request) (tokenString string, err error)
}

AuthSvc is an interface that creates, parses, and validates Tokens.

func NewAuthSvc

func NewAuthSvc(cf string) (AuthSvc, error)

NewAuthSvc returns an object that implements the AuthSvc interface.

type Claims

type Claims struct {
	jwt.StandardClaims
	AuthClaims
}

Claims is a custom Claims object that extends jwt.StandardClaims.

type LoggerSvc

type LoggerSvc interface {
	SystemLog() log.MLogger
	AccessLog() log.MLogger
	ErrorLog() log.MLogger
	Close()
}

LoggerSvc is a collection of LoggerSvc with a getter method.

func NewLoggerSvc

func NewLoggerSvc(cf string, console bool, syslog io.Writer) (LoggerSvc, error)

NewLoggerSvc creates and initializes a new collection of LoggerSvc.

type MetaUsbSvc

type MetaUsbSvc interface {
	VendorName(vid string) (string, error)
	ProductName(vid, pid string) (string, error)
	ClassDesc(cid string) (string, error)
	SubClassDesc(cid, sid string) (string, error)
	ProtocolDesc(cid, sid, pid string) (string, error)
	LastUpdate() time.Time
	Raw() *peripheral.Usb
	Refresh() error
	Save() error
}

MetaUsbSvc is an interface that creates serial numbers from seed values.

func NewMetaUsbSvc

func NewMetaUsbSvc(cf string) (MetaUsbSvc, error)

NewMetaUsbSvc returns an object that implements the MetaUsbSvc interface.

type SerialSvc

type SerialSvc interface {
	CreateSerial(key string, seed int64) (serialNum string, err error)
}

SerialSvc is an interface that creates serial numbers from seed values.

func NewSerialSvc

func NewSerialSvc(cf string) (SerialSvc, error)

NewSerialSvc returns an object that implements the SerialSvc interface.

type Token

type Token struct {
	*jwt.Token
}

Token is a custom Token object that extends jwt.Token.

func (*Token) AuthClaims

func (this *Token) AuthClaims() AuthClaims

AuthClaims extracts the AuthClaim claim from the token.

Jump to

Keyboard shortcuts

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