Documentation ¶
Overview ¶
Package token contains types/methods for handling the signing and parsing of JWT tokens used for authentication.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StreamServerInterceptor ¶
func StreamServerInterceptor(manager *Manager) grpc.StreamServerInterceptor
StreamServerInterceptor returns a grpc.StreamServerInterceptor instance that uses the provided token manager to parse JWT tokens for use by gRPC services.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(manager *Manager) grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a grpc.UnaryServerInterceptor instance that uses the provided token manager to parse JWT tokens for use by gRPC services.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
The Manager type is responsible for signing/parsing tokens.
func NewManager ¶
NewManager creates a new Manager instance that uses the provided secret key for signing/parsing tokens.
type Token ¶
type Token struct { User string // contains filtered or unexported fields }
The Token type represents a parsed JWT token.
func FromContext ¶
FromContext returns the token embedded in the provided context. Returns a zero-value token if one is not present.