Documentation ¶
Index ¶
- Variables
- func ObtainClaimsFromContext(ctx context.Context) auth.TokenClaims
- type AuthDelivery
- func (ad *AuthDelivery) DefaultInterceptor(ctx context.Context) (context.Context, error)
- func (ad *AuthDelivery) ForgotPassword(ctx context.Context, in *rpc.ForgotPasswordRequest) (*rpc.ForgotPasswordResponse, error)
- func (ad *AuthDelivery) GetAccount(ctx context.Context, in *rpc.GetAccountRequest) (*rpc.Account, error)
- func (ad *AuthDelivery) Login(ctx context.Context, in *rpc.LoginRequest) (*rpc.LoginResponse, error)
- func (ad *AuthDelivery) ObtainAccessClaimsFromMetadata(ctx context.Context, isAccess bool) (claims auth.TokenClaims, err error)
- func (ad *AuthDelivery) RefreshAccessToken(ctx context.Context, in *rpc.RefreshAccessTokenRequest) (*rpc.RefreshAccessTokenResponse, error)
- func (ad *AuthDelivery) Register(_ context.Context, in *rpc.RegisterRequest) (*rpc.RegisterResponse, error)
- func (ad *AuthDelivery) ResetPasssword(ctx context.Context, in *rpc.ResetPasswordRequest) (*rpc.ResetPasswordResponse, error)
- type ContextKey
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 ¶
DefaultInterceptor is default authN/authZ interceptor, validates only token correctness without performing any role specific authorization.
func (*AuthDelivery) ForgotPassword ¶
func (ad *AuthDelivery) ForgotPassword(ctx context.Context, in *rpc.ForgotPasswordRequest) (*rpc.ForgotPasswordResponse, error)
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 (ad *AuthDelivery) Login(ctx context.Context, in *rpc.LoginRequest) (*rpc.LoginResponse, error)
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 (ad *AuthDelivery) RefreshAccessToken(ctx context.Context, in *rpc.RefreshAccessTokenRequest) (*rpc.RefreshAccessTokenResponse, error)
func (*AuthDelivery) Register ¶
func (ad *AuthDelivery) Register(_ context.Context, in *rpc.RegisterRequest) (*rpc.RegisterResponse, error)
Register satisfies rpc.Register function on AuthService proto definition
func (*AuthDelivery) ResetPasssword ¶
func (ad *AuthDelivery) ResetPasssword(ctx context.Context, in *rpc.ResetPasswordRequest) (*rpc.ResetPasswordResponse, error)
type ContextKey ¶
type ContextKey string
ContextKey auth gRPC context key.
func (ContextKey) String ¶
func (c ContextKey) String() string
Click to show internal directories.
Click to hide internal directories.