delivery

package
v0.0.0-...-8dc6894 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: Unlicense 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")
	HeaderAuthorize  = "authorization"
)

Functions

func ObtainClaimsFromContext

func ObtainClaimsFromContext(ctx context.Context) auth.TokenClaims

ObtainClaimsFromContext obtains token claims from given context with value.

Types

type AuthDelivery

type AuthDelivery struct {
	Log                   *l.Entry
	TokenCfg              *auth.TokenConfig
	UnauthenticatedRoutes []string // the auth interceptor would not intercept tokens on these routes (format is: /ProtoServiceName/ProtoServiceMethod, example: /proto.AuthService/Login).

}

AuthDelivery is the delivery layer of the authn

func (*AuthDelivery) DefaultInterceptor

func (ad *AuthDelivery) DefaultInterceptor(ctx context.Context) (context.Context, error)

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

func (*AuthDelivery) ForgotPassword

func (*AuthDelivery) GetAccount

func (ad *AuthDelivery) GetAccount(ctx context.Context, in *rpc.GetAccountRequest) (*rpc.Account, error)

TODO @winwisely268: GetAccount is just dummy method at this point, do use DAO!!

func (*AuthDelivery) Login

func (*AuthDelivery) ObtainAccessClaimsFromMetadata

func (ad *AuthDelivery) ObtainAccessClaimsFromMetadata(ctx context.Context, isAccess bool) (claims auth.TokenClaims, err error)

ObtainAccessClaimsFromMetadata obtains token claims from given context with gRPC metadata.

func (*AuthDelivery) RefreshAccessToken

func (*AuthDelivery) Register

Register satisfies rpc.Register function on AuthService proto definition

func (*AuthDelivery) ResetPasssword

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