src.dualinventive.com/go/authentication-service/README.md

3.0 KiB

Authentication Service

This service allows for creating, removing and otherwise managing authorization tokens.
This service can be consumed using grpc or rest.

  • /etc - contains example configuration files
  • /grpc - contains proto defintions
  • /rest - contains a swagger file

Run this application with the --config flag to point to the appropriate configuration file.

Operation error responses

Function Error REST gRPC
DeleteToken authtokens.ErrInvalidToken NewDeleteTokenBadRequest (400) Unauthorized (401) InvalidArgument Unauthenticated
DeleteToken authtokens.ErrNilToken NewDeleteTokenBadRequest (400) Unauthorized (401) InvalidArgument Unauthenticated
DeleteToken authtokens.ErrTokenNotFound NewDeleteTokenBadRequest (400) Unauthorized (401) InvalidArgument Unauthenticated
DeleteToken otherwise NewDeleteTokenInternalServerError (500) Internal
ListTokens authtokens.ErrInvalidToken NewListTokensBadRequest (400) Unauthorized (401) Internal Unauthenticated
ListTokens authtokens.ErrNilToken NewListTokensBadRequest (400) Unauthorized (401) Internal Unauthenticated
ListTokens otherwise NewListTokensBadRequest (400) InternalServerError Internal
Login authtokens.ErrInvalidCredentials NewPostLoginUnauthorized (401) InvalidArgument Unauthenticated
Login otherwise NewPostLoginInternalServerError (500) Internal
Logout authtokens.ErrNilToken NewLogoutNotFound (404) Unauthorized (401) Unauthenticated
Logout authtokens.ErrTokenNotFound NewLogoutNotFound (404) Unauthorized (401) NotFound Unauthenticated
Logout otherwise NewLogoutInternalServerError (500) Internal
Me authtokens.ErrTokenNotFound NewGetMeNotFound (404) Unauthorized (401) Unauthenticated
Me authtokens.ErrUserNotFound NewGetMeNotFound (404) Unauthorized (401) Unauthenticated
Me otherwise NewGetMeInternalServerError (500) Internal
VerifyToken otherwise NewVerifyInternalServerError (500) Internal
RequestPasswordReset pwreset.ErrFailedToCreateResetCode NewPostPasswordResetRequestInternalServerError (500) Internal
RequestPasswordReset pwreset.ErrFailedToSendEmail NewPostPasswordResetRequestInternalServerError (500) Internal
RequestPasswordReset pwreset.ErrUserFetchFailed NewPostPasswordResetRequestInternalServerError (500) Internal
RequestPasswordReset otherwise NewPostPasswordResetRequestBadRequest (400) InvalidArgument
RedeemPasswordReset pwreset.ErrChangePasswordFailed NewPostPasswordResetRedeemInternalServerError (500) Internal
RedeemPasswordReset pwreset.ErrFailedToGetResetCode NewPostPasswordResetRedeemInternalServerError (500) Internal
RedeemPasswordReset otherwise NewPostPasswordResetRedeemBadRequest (400) InvalidArgument