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 ¶
- Variables
- func CredStoreMethodAuthInterceptor() grpc.UnaryServerInterceptor
- func CredStoreTokenInterceptor(publicKey crypto.PublicKey) grpc.UnaryServerInterceptor
- func GetAppToken() (string, error)
- func GetAuthToken(ctx context.Context, conn *grpc.ClientConn, tok string) (string, error)
- func GetSigningKey(ctx context.Context, conn *grpc.ClientConn, tok string) (crypto.PublicKey, error)
- func GetTokenForRemote(ctx context.Context, conn *grpc.ClientConn, sessTok string, target string) (string, error)
- func WithBearerToken(ctx context.Context, token string) context.Context
- type CredstoreClient
Constants ¶
This section is empty.
Variables ¶
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 ¶
GetAppToken returns the app token for currently running app.
func GetAuthToken ¶
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.
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.