Documentation ¶
Overview ¶
Package auth provides simple token based, stream authorization functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidToken is returned by Check when the auth-token was not as // expected. ErrInvalidToken = fmt.Errorf("Invalid auth-token code") // NoAuth is the token used for authenticationless connections. NoAuth = Token("") )
Functions ¶
func ClientInterceptor ¶
func ClientInterceptor(token Token) grpc.UnaryClientInterceptor
ClientInterceptor returns a grpc.UnaryClientInterceptor that adds the given auth token to outgoing RPC calls.
func ServerInterceptor ¶
func ServerInterceptor(token Token) grpc.UnaryServerInterceptor
ServerInterceptor returns a grpc.UnaryServerInterceptor that checks incoming RPC calls for the given auth token.
Types ¶
type Token ¶
type Token string
Token is a secret password that must be sent on connection.
func GenTokenFile ¶ added in v0.9.6
GenTokenFile creates and returns the path to a temporary file containing a token generated by GenToken() with read & write permissions of the current processes.
Click to show internal directories.
Click to hide internal directories.