Documentation ¶
Overview ¶
Package auth provides simple token based, stream authorization functions.
Index ¶
- Variables
- func StreamClientInterceptor(token Token) grpc.StreamClientInterceptor
- func StreamServerInterceptor(token Token) grpc.StreamServerInterceptor
- func UnaryClientInterceptor(token Token) grpc.UnaryClientInterceptor
- func UnaryServerInterceptor(token Token) grpc.UnaryServerInterceptor
- func Write(s io.Writer, token Token) error
- type Token
Constants ¶
This section is empty.
Variables ¶
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 StreamClientInterceptor ¶
func StreamClientInterceptor(token Token) grpc.StreamClientInterceptor
StreamClientInterceptor returns a grpc.StreamClientInterceptor that adds the given auth token to outgoing RPC calls.
func StreamServerInterceptor ¶
func StreamServerInterceptor(token Token) grpc.StreamServerInterceptor
StreamServerInterceptor returns a grpc.StreamServerInterceptor that checks incoming RPC calls for the given auth token.
func UnaryClientInterceptor ¶
func UnaryClientInterceptor(token Token) grpc.UnaryClientInterceptor
UnaryClientInterceptor returns a grpc.UnaryClientInterceptor that adds the given auth token to outgoing RPC calls.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(token Token) grpc.UnaryServerInterceptor
UnaryServerInterceptor 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 ¶
GenTokenFile creates and returns the path to a temporary file containing a token generated by GenToken() with read & write permissions of the current processes.