client

package
v0.0.0-...-e184c60 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2018 License: Apache-2.0 Imports: 14 Imported by: 10

Documentation

Overview

Package client provides helper APIs for clients.

Based on https://github.com/grpc-ecosystem/go-grpc-middleware/tree/master/auth, licensed under Apache-2.0

Index

Constants

This section is empty.

Variables

View Source
var TokenKey = tokenKeyType{}

TokenKey is the context key for token interceptor payload

Functions

func CredStoreMethodAuthInterceptor

func CredStoreMethodAuthInterceptor() grpc.UnaryServerInterceptor

CredStoreMethodAuthInterceptor returns a new unary server interceptor that verifies rpc token.

func CredStoreTokenInterceptor

func CredStoreTokenInterceptor(publicKey crypto.PublicKey) grpc.UnaryServerInterceptor

CredStoreTokenInterceptor returns a new unary server interceptor that performs per-request auth.

func GetAppToken

func GetAppToken() (string, error)

GetAppToken returns the app token for currently running app.

func GetAuthToken

func GetAuthToken(ctx context.Context, conn *grpc.ClientConn, tok string) (string, error)

GetAuthToken returns a session JWT token.

func GetSigningKey

func GetSigningKey(ctx context.Context, conn *grpc.ClientConn, tok string) (crypto.PublicKey, error)

GetSigningKey requests the current signing key from CredStore.

func GetTokenForRemote

func GetTokenForRemote(ctx context.Context, conn *grpc.ClientConn, sessTok string, target string) (string, error)

GetTokenForRemote returns a JWT token for given remote.

func WithBearerToken

func WithBearerToken(ctx context.Context, token string) context.Context

WithBearerToken adds bearer token to the context.

Types

type CredstoreClient

type CredstoreClient struct {
	// contains filtered or unexported fields
}

func NewCredstoreClient

func NewCredstoreClient(ctx context.Context, credStoreAddress string, credStoreCA string) (*CredstoreClient, error)

NewCredstoreClient creates a new CredstoreClient.

func (CredstoreClient) GetTokenForRemote

func (c CredstoreClient) GetTokenForRemote(ctx context.Context, remoteHostPort string) (string, error)

GetTokenForRemote returns a token for given remote host:port.

func (CredstoreClient) SigningKey

func (c CredstoreClient) SigningKey() crypto.PublicKey

SigningKey returns credstore public key for JWT verification.

Jump to

Keyboard shortcuts

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