auth

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2017 License: Apache-2.0 Imports: 9 Imported by: 35

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.

func Write

func Write(s io.Writer, token Token) error

Write writes the authorization token to s.

Types

type Token

type Token string

Token is a secret password that must be sent on connection.

func GenToken

func GenToken() Token

GenToken returns a 8 character random token.

Jump to

Keyboard shortcuts

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