grpc

package
v0.0.0-...-718b68f Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextKeyClaims defines claims context key provided by token.
	ContextKeyClaims = ContextKey("auth-claims")
)

Functions

func ObtainClaimsFromContext

func ObtainClaimsFromContext(ctx context.Context) entities.TokenClaims

ObtainClaimsFromContext obtains token claims from given context with value.

func ObtainClaimsFromMetadata

func ObtainClaimsFromMetadata(ctx context.Context) (claims entities.TokenClaims, err error)

ObtainClaimsFromMetadata obtains token claims from given context with gRPC metadata.

Types

type AuthenticateDelivery

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

AuthenticateDelivery is gRPC handler delivery of authentication/authorization.

func NewAuthenticateDelivery

func NewAuthenticateDelivery(log *zap.Logger, repository employee.Repository) *AuthenticateDelivery

NewAuthenticateDelivery returns new Auth gRPC delivery.

func (*AuthenticateDelivery) Authenticate

func (delivery *AuthenticateDelivery) Authenticate(ctx context.Context, request *pb.AuthRequest) (*pb.AuthResponse, error)

Authenticate gRPC handler that checks credentials and generates AuthResponse with token and claims.

func (*AuthenticateDelivery) DefaultInterceptor

func (delivery *AuthenticateDelivery) DefaultInterceptor(ctx context.Context) (context.Context, error)

DefaultInterceptor is default ahtentication/authorization interceptor, validates only token correctness without performing any role specific authorization.

func (*AuthenticateDelivery) Validate

func (delivery *AuthenticateDelivery) Validate(ctx context.Context, request *pb.ValidateRequest) (*pb.AuthResponse, error)

type ContextKey

type ContextKey string

ContextKey auth gRPC context key.

func (ContextKey) String

func (c ContextKey) String() string

Jump to

Keyboard shortcuts

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