handler

package
v0.0.0-...-9a7bc8d Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FreshToken

func FreshToken(t *Token, freshD time.Duration, termD time.Duration) (string, error)

FreshToken if will expire

Types

type App

type App struct{}

App Handler

func (*App) FindByID

func (s *App) FindByID(ctx context.Context, req *pb.AppInfo, res *pb.AppInfo) error

FindByID App

func (*App) List

func (s *App) List(ctx context.Context, req *pb.Identity, res *pb.AppList) error

List of App

type Auth

type Auth struct{}

Auth Handler

func (*Auth) AuthToken

func (h *Auth) AuthToken(ctx context.Context, req *pb.AuthApp, res *pb.Token) error

AuthToken for App

func (*Auth) Authorize

func (h *Auth) Authorize(ctx context.Context, req *pb.AuthRequest, res *pb.AuthResponse) error

Authorize Scopes

func (*Auth) AuthorizeConfirm

func (h *Auth) AuthorizeConfirm(ctx context.Context, req *pb.AuthConfirm, res *metaPb.None) error

AuthorizeConfirm Scopes

func (*Auth) CheckTokenScope

func (h *Auth) CheckTokenScope(ctx context.Context, req *pb.AuthApp, res *pb.AuthScope) error

CheckTokenScope Scopes

type Token

type Token struct {
	jwt.StandardClaims // TODO: switch to micro's jwt ?
	Payload            *pb.TokenPayload
}

Token of JWT

func NewToken

func NewToken() *Token

NewToken by userinfo

func ValidToken

func ValidToken(tokenStr string) (t *Token, e error)

ValidToken for UserInfo

func (*Token) Sign

func (c *Token) Sign(d time.Duration) (string, error)

Sign JWT

type User

type User struct{}

User Handler

func (*User) Check

func (h *User) Check(ctx context.Context, req *pb.Token, res *pb.Token) error

Check Token

func (*User) Login

func (h *User) Login(ctx context.Context, req *pb.Credential, res *pb.Token) error

Login Action

func (*User) Register

func (h *User) Register(ctx context.Context, req *pb.Identity, res *pb.Token) error

Register Action

Jump to

Keyboard shortcuts

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