Documentation ¶
Index ¶
- func DecodeGRPCTokenAffectRequest(ctx context.Context, r interface{}) (interface{}, error)
- func DecodeGRPCTokenAffectResponse(_ context.Context, r interface{}) (interface{}, error)
- func DecodeGRPCTokenRenewRequest(ctx context.Context, r interface{}) (interface{}, error)
- func DecodeGRPCTokenRequest(ctx context.Context, r interface{}) (interface{}, error)
- func DecodeGRPCTokenResponse(_ context.Context, r interface{}) (interface{}, error)
- func DecodeGRPCTokenVerifyRequest(ctx context.Context, r interface{}) (interface{}, error)
- func DecodeGRPCTokenVerifyResponse(_ context.Context, r interface{}) (interface{}, error)
- func EncodeGRPCTokenAffectRequest(_ context.Context, r interface{}) (interface{}, error)
- func EncodeGRPCTokenAffectResponse(_ context.Context, r interface{}) (interface{}, error)
- func EncodeGRPCTokenRenewRequest(_ context.Context, r interface{}) (interface{}, error)
- func EncodeGRPCTokenRequest(_ context.Context, r interface{}) (interface{}, error)
- func EncodeGRPCTokenResponse(_ context.Context, r interface{}) (interface{}, error)
- func EncodeGRPCTokenVerifyRequest(_ context.Context, r interface{}) (interface{}, error)
- func EncodeGRPCTokenVerifyResponse(_ context.Context, r interface{}) (interface{}, error)
- func ExtractTokenMetadata(tokenString string, refresh bool) (*models.AccessDetails, jwt.MapClaims, error)
- func FetchAuth(authD *models.AccessDetails) (uint64, string, error)
- func FetchRefresh(authD *models.AccessDetails) (map[string]string, error)
- func MakeTokenServicAffectEndpoint(svc TokenServiceInterface) endpoint.Endpoint
- func MakeTokenServiceGenerateEndpoint(svc TokenServiceInterface) endpoint.Endpoint
- func MakeTokenServiceRenewEndpoint(svc TokenServiceInterface) endpoint.Endpoint
- func MakeTokenServiceVerifyEndpoint(svc TokenServiceInterface) endpoint.Endpoint
- func MergeClaims(claims map[string]string) jwt.MapClaims
- func MergeClaimsReverse(claims jwt.MapClaims) map[string]string
- func NewGRPCServer(ctx context.Context, endpoint TokenServiceEndpoints) pb.TokenServiceServer
- func RedisInit() (string, error)
- func TokenValid(tokenString string) error
- func VerifyTokenIntegrity(tokenString string, isRfresh bool) (*jwt.Token, error)
- type EndpointsConsul
- type HealthServiceRequest
- type HealthServiceResponse
- type TokenRenewRequest
- type TokenRequest
- type TokenResponse
- type TokenService
- func (ts TokenService) AffectToken(ctx context.Context, tokenToAffect models.TokenAffectRequest) (*models.TokenAffectResponse, error)
- func (ts TokenService) Generate(ctx context.Context, claims map[string]string) (*models.AccessTokens, error)
- func (ts TokenService) RenewTokens(ctx context.Context, token TokenRenewRequest) (*TokenResponse, error)
- func (ts TokenService) VerifyToken(ctx context.Context, tokenToverify TokenVerifyRequest) (*models.TokenVerifyResponse, interface{})
- type TokenServiceEndpoints
- func (te TokenServiceEndpoints) AffectToken(ctx context.Context, tokenAffectRequest models.TokenAffectRequest) (*models.TokenAffectResponse, error)
- func (te TokenServiceEndpoints) Generate(ctx context.Context, claims map[string]string) (*models.AccessTokens, error)
- func (te TokenServiceEndpoints) RenewTokens(ctx context.Context, refreshToken TokenRenewRequest) (*TokenResponse, error)
- func (te TokenServiceEndpoints) VerifyToken(ctx context.Context, tokenToverify TokenVerifyRequest) (*models.TokenVerifyResponse, interface{})
- type TokenServiceInterface
- type TokenVerifyRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeGRPCTokenRenewRequest ¶
Encode and Decode Renew request
func DecodeGRPCTokenRequest ¶
func DecodeGRPCTokenResponse ¶
func EncodeGRPCTokenAffectRequest ¶
Encode and Decode Token Affect Request
func EncodeGRPCTokenAffectResponse ¶
Encode and Decode Token Response
func EncodeGRPCTokenRenewRequest ¶
Encode and Decode Token Request
func EncodeGRPCTokenRequest ¶
Encode and Decode Token Request
func EncodeGRPCTokenResponse ¶
Encode and Decode Token Response
func EncodeGRPCTokenVerifyRequest ¶
/ Verify Request response - encode/decode
func EncodeGRPCTokenVerifyResponse ¶
Encode and Decode Token Response
func ExtractTokenMetadata ¶
func ExtractTokenMetadata(tokenString string, refresh bool) (*models.AccessDetails, jwt.MapClaims, error)
func FetchAuth ¶
func FetchAuth(authD *models.AccessDetails) (uint64, string, error)
FetchAuth : ensure the token hasn't expired
func FetchRefresh ¶
func FetchRefresh(authD *models.AccessDetails) (map[string]string, error)
FetchRefresh : ensure the token hasn't expired
func MakeTokenServicAffectEndpoint ¶
func MakeTokenServicAffectEndpoint(svc TokenServiceInterface) endpoint.Endpoint
func MakeTokenServiceGenerateEndpoint ¶
func MakeTokenServiceGenerateEndpoint(svc TokenServiceInterface) endpoint.Endpoint
func MakeTokenServiceRenewEndpoint ¶
func MakeTokenServiceRenewEndpoint(svc TokenServiceInterface) endpoint.Endpoint
func MakeTokenServiceVerifyEndpoint ¶
func MakeTokenServiceVerifyEndpoint(svc TokenServiceInterface) endpoint.Endpoint
func MergeClaims ¶
func MergeClaimsReverse ¶
func NewGRPCServer ¶
func NewGRPCServer(ctx context.Context, endpoint TokenServiceEndpoints) pb.TokenServiceServer
create new grpc server
func TokenValid ¶
func VerifyTokenIntegrity ¶
Types ¶
type EndpointsConsul ¶
type EndpointsConsul struct { ConsulHealthCheckEndpoint endpoint.Endpoint ConsulHealthWatchEndpoint endpoint.Endpoint }
wrapper for the endpoints
type HealthServiceRequest ¶
type HealthServiceRequest struct {
Service string `json:"service,omitempty"`
}
type HealthServiceResponse ¶
type HealthServiceResponse struct {
Status int `json:"status,omitempty"`
}
type TokenRenewRequest ¶
type TokenRenewRequest struct {
RefreshToken string `json:"refresh_token,omitempty"`
}
type TokenRequest ¶
type TokenResponse ¶
type TokenResponse struct { Response models.AccessTokens `json:"tokens,omitempty"` Error models.ServiceError }
type TokenService ¶
type TokenService struct { }
func (TokenService) AffectToken ¶
func (ts TokenService) AffectToken(ctx context.Context, tokenToAffect models.TokenAffectRequest) (*models.TokenAffectResponse, error)
AffectToken : Expandable service module API
func (TokenService) Generate ¶
func (ts TokenService) Generate(ctx context.Context, claims map[string]string) (*models.AccessTokens, error)
Generate : Generate the Token Pair
func (TokenService) RenewTokens ¶
func (ts TokenService) RenewTokens(ctx context.Context, token TokenRenewRequest) (*TokenResponse, error)
RenewTokens : Re-Generate a new token pair
func (TokenService) VerifyToken ¶
func (ts TokenService) VerifyToken(ctx context.Context, tokenToverify TokenVerifyRequest) (*models.TokenVerifyResponse, interface{})
VerifyToken : Claim verification and authorisation
type TokenServiceEndpoints ¶
type TokenServiceEndpoints struct { GenerateEndpoint endpoint.Endpoint VerifyEndpoint endpoint.Endpoint AffectEndpoint endpoint.Endpoint RenewEndpoint endpoint.Endpoint }
func (TokenServiceEndpoints) AffectToken ¶
func (te TokenServiceEndpoints) AffectToken(ctx context.Context, tokenAffectRequest models.TokenAffectRequest) (*models.TokenAffectResponse, error)
func (TokenServiceEndpoints) Generate ¶
func (te TokenServiceEndpoints) Generate(ctx context.Context, claims map[string]string) (*models.AccessTokens, error)
func (TokenServiceEndpoints) RenewTokens ¶
func (te TokenServiceEndpoints) RenewTokens(ctx context.Context, refreshToken TokenRenewRequest) (*TokenResponse, error)
func (TokenServiceEndpoints) VerifyToken ¶
func (te TokenServiceEndpoints) VerifyToken(ctx context.Context, tokenToverify TokenVerifyRequest) (*models.TokenVerifyResponse, interface{})
type TokenServiceInterface ¶
type TokenServiceInterface interface { Generate(ctx context.Context, claims map[string]string) (*models.AccessTokens, error) VerifyToken(ctx context.Context, tokenToverify TokenVerifyRequest) (*models.TokenVerifyResponse, interface{}) RenewTokens(ctx context.Context, token TokenRenewRequest) (*TokenResponse, error) AffectToken(ctx context.Context, tokenAffectRequest models.TokenAffectRequest) (*models.TokenAffectResponse, error) }
type TokenVerifyRequest ¶
Click to show internal directories.
Click to hide internal directories.