Documentation
¶
Index ¶
- Constants
- Variables
- func BindJSON(data io.Reader, dest interface{}) error
- func ExtractToken(r *http.Request) (string, bool)
- func MakeChangePasswordEndpoint(s UserService) endpoint.Endpoint
- func MakeConfirmForgotPasswordEndpoint(s UserService) endpoint.Endpoint
- func MakeConfirmSignUpEndpoint(s UserService) endpoint.Endpoint
- func MakeForgotPasswordEndpoint(s UserService) endpoint.Endpoint
- func MakeGetUserEndpoint(s UserService) endpoint.Endpoint
- func MakeHTTPHandler(e EndPoints, logger log.Logger, tracer stdopentracing.Tracer) *mux.Router
- func MakeJwtCheckMiddleware() endpoint.Middleware
- func MakeSignInEndpoint(s UserService) endpoint.Endpoint
- func MakeSignUpEndpoint(s UserService) endpoint.Endpoint
- func MakeValidateTokenEndpoint(s UserService) endpoint.Endpoint
- type EndPoints
- type Middleware
- type UserService
Constants ¶
View Source
const ( ContextErrorKey userCtxKeyType = "Error" ContextAccessTokenKey userCtxKeyType = "accessToken" )
Variables ¶
View Source
var ( // ErrInvalidRequest request error ErrInvalidRequest = errors.New("Invalid Request") // ErrContextRequest error found in context in field ContextErrorKey ErrContextRequest = errors.New("Context Error") )
View Source
var ( errors.New("Unauthorized") )ErrUnauthorized =
Functions ¶
func ExtractToken ¶
ExtractToken extracts jwt token from the header "Authorization" field with Bearer
func MakeChangePasswordEndpoint ¶
func MakeChangePasswordEndpoint(s UserService) endpoint.Endpoint
func MakeConfirmForgotPasswordEndpoint ¶
func MakeConfirmForgotPasswordEndpoint(s UserService) endpoint.Endpoint
func MakeConfirmSignUpEndpoint ¶
func MakeConfirmSignUpEndpoint(s UserService) endpoint.Endpoint
func MakeForgotPasswordEndpoint ¶
func MakeForgotPasswordEndpoint(s UserService) endpoint.Endpoint
func MakeGetUserEndpoint ¶
func MakeGetUserEndpoint(s UserService) endpoint.Endpoint
func MakeHTTPHandler ¶
MakeHTTPHandler creates routes in the API
func MakeJwtCheckMiddleware ¶
func MakeJwtCheckMiddleware() endpoint.Middleware
FIXME: this is not being used... TO BE DELETED
func MakeSignInEndpoint ¶
func MakeSignInEndpoint(s UserService) endpoint.Endpoint
func MakeSignUpEndpoint ¶
func MakeSignUpEndpoint(s UserService) endpoint.Endpoint
func MakeValidateTokenEndpoint ¶
func MakeValidateTokenEndpoint(s UserService) endpoint.Endpoint
Types ¶
type EndPoints ¶
type EndPoints struct { SignUpEndpoint endpoint.Endpoint SignInEndpoint endpoint.Endpoint GetUserEndpoint endpoint.Endpoint ConfirmSignUpEndpoint endpoint.Endpoint ForgotPasswordEndpoint endpoint.Endpoint ConfirmForgotPasswordEndpoint endpoint.Endpoint ChangePasswordEndpoint endpoint.Endpoint ValidateTokenEndpoint endpoint.Endpoint // NOTE: for API gateway to use only(?) }
func MakeEndpoints ¶
func MakeEndpoints(s UserService, tracer stdopentracing.Tracer) EndPoints
type Middleware ¶
type Middleware func(UserService) UserService
Middleware decorates a service.
func LoggingMiddleware ¶
func LoggingMiddleware(logger log.Logger) Middleware
LoggingMiddleware logs method calls, parameters, results, and elapsed time.
type UserService ¶
type UserService interface { SignUp(username, password, confirmPass, email string) (*cogIdp.SignUpOutput, error) // register user SignIn(username, password string) (*cogIdp.InitiateAuthOutput, error) // InitiateAuth or AdminInitiateAuth ? TODO: return token string GetUser(username string) (*cogIdp.AdminGetUserOutput, error) // AdminGetUser or GetUser ? ConfirmSingUp(code, username string) (*cogIdp.ConfirmSignUpOutput, error) ForgotPassword(username string) (*cogIdp.ForgotPasswordOutput, error) ConfirmForgotPassword(newPass, code, username string) (*cogIdp.ConfirmForgotPasswordOutput, error) ChangePassword(accessToken, prevPass, newPass string) (*cogIdp.ChangePasswordOutput, error) ValidateJwtToken(tokenStr string) (models.AuthenticatedUser, error) }
func NewInstrumentingService ¶
func NewInstrumentingService(requestCount metrics.Counter, requestLatency metrics.Histogram, s UserService) UserService
NewInstrumentingService returns an instance of an instrumenting UserService.
func NewUserService ¶
func NewUserService() UserService
Click to show internal directories.
Click to hide internal directories.