senderutil

package
v0.3.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	SenderKey = "sender"
	TokenType = "Bearer"
)

Variables

View Source
var ErrExpired = fmt.Errorf("access token expired")

Functions

func ContextWithSender added in v0.2.2

func ContextWithSender(ctx context.Context, user *Sender) context.Context

func Generate added in v0.2.3

func Generate(k string, expire time.Duration, userId, role string) (string, error)

Types

type Sender added in v0.2.3

type Sender struct {
	UserId string `json:"user_id,omitempty"`
	Role   string `json:"role,omitempty"`
}

func GetSender added in v0.2.3

func GetSender(user *pb.User) *Sender

func GetSenderFromContext

func GetSenderFromContext(ctx context.Context) *Sender

func GetSystemSender added in v0.2.3

func GetSystemSender() *Sender

func Validate added in v0.2.3

func Validate(k, s string) (*Sender, error)

func (*Sender) IsDeveloper added in v0.2.3

func (s *Sender) IsDeveloper() bool

func (*Sender) IsGlobalAdmin added in v0.2.3

func (s *Sender) IsGlobalAdmin() bool

func (*Sender) IsGuest added in v0.2.3

func (s *Sender) IsGuest() bool

func (*Sender) IsUser added in v0.2.3

func (s *Sender) IsUser() bool

func (*Sender) ToJson added in v0.2.3

func (s *Sender) ToJson() string

Jump to

Keyboard shortcuts

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