token

package
v0.5.1-0...-1b82622 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package token provides a simple type for functions that generate tokens

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) (string, time.Time, error)

FromContext returns token from the incoming context metadata.

func NewPerRPCCredentials

func NewPerRPCCredentials(genTokenFunc GeneratorFunc) credentials.PerRPCCredentials

NewPerRPCCredentials creates credentials.PerRPCCredentials based on token generator func

Types

type GeneratorFunc

type GeneratorFunc func(peerAuthInfo credentials.AuthInfo) (token string, expireTime time.Time, err error)

GeneratorFunc - a function which takes the credentials.AuthInfo of the peer of the client or server

and returns a token as a string (example: JWT), a expireTime, and an error.

Jump to

Keyboard shortcuts

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