Closed kimlisa closed 5 years ago
Follow-up enhancement for app-gateway-svc https://github.com/hwsc-org/hwsc-app-gateway-svc/issues/14
High Level
Registration
linkCreateUser
We can also use a dummy token instead of dummy email and password.
What are the trade-offs?
Do we have other ways to do this?
High Level
registration
linkapp-gateway
gateway
sends request to user-svc
to CreateUseruser-svc
CreateUser does the following
is_verified
for new users defaults to false)gateway
, gateway
in turn passes the error to chrome, chrome will display error message to useremail_token
database tied to the useruser-svc
finishes and returns OK
and user object to gateway
(i don't think it is necessary to send user object back anymore)gateway
returns OK
and user object to chromePlease verify your email: we sent a verification link to the email you provided us
(the user object sent back from CreateUser
is kind of useless here?)verification
pageverification
page does the following:
gateway
gateway
calls and sends token to VerifyEmailToken
from user-svc
VerifyEmailToken
does the following:
email_tokens
tablegateway
, gateway
sends back to chrome what to the frontend?email_tokens
tableemail_tokens
gateway
, gateway
sends this error to chrome, and chrome will display message something like: The link you clicked on has expired. Please check your email for the new verification link we sent
gateway
gateway
sends OK to chromegateway
gateway
calls AuthenticateUser
AuthenticateUser
does the following:
accounts
tablegateway
, gateway
sends error to Chrome, Chrome displays error message to Useris_verified
column is set to TRUEis_verified
is FALSE, send error and retrieved user object to gateway
, gateway
sends error to Chrome, Chrome redirects to a page that says "Please verify your email sent to user@email.com" (same page shown after registration)High Level
registration
linkgateway
using dummy email + passwordgateway
calls user-svc
's AuthenticateUser
user-svc
returns a token
with a registration only
permission to gateway-svc
register_token
to app-gateway
gateway
sends request + register_token
to user-svc
to CreateUseruser-svc
CreateUser does the following
is_verified
for new users defaults to false)gateway
, gateway
in turn passes the error to chrome, chrome will display error message to useremail_token
database tied to the useruser-svc
finishes and returns OK
and user object to gateway
(i don't think it is necessary to send user object back anymore)gateway
returns OK
and user object to chromePlease verify your email: we sent a verification link to the email you provided us
(the user object sent back from CreateUser
is kind of useless here?)verification
pageverification
page does the following:
gateway
by adding metadata in the context in the following format "authorization": "Email Token " + token
gateway
calls and sends token to VerifyEmailToken
from user-svc
VerifyEmailToken
does the following:
email_tokens
tablegateway
, gateway
sends back to chrome what to the frontend?email_tokens
tableemail_tokens
gateway
, gateway
sends this error to chrome, and chrome will display message something like: The link you clicked on has expired. Please check your email for the new verification link we sent
gateway
gateway
sends OK to chromegateway
gateway
calls AuthenticateUser
AuthenticateUser
does the following:
accounts
tablegateway
, gateway
sends error to Chrome, Chrome displays error message to Useris_verified
column is set to TRUEis_verified
is FALSE, send error and retrieved user object to gateway
, gateway
sends error to Chrome, Chrome redirects to a page that says "Please verify your email sent to user@email.com" (same page shown after registration)
Chrome wants to create a user.
userObject
app-gateway-svc
CreateUser(userObject)
CreateUser(UserResponse)
app-gateway-svc
will calluser-svc
GetStatus()
user-svc
:app-gateway-svc
will calluser-svc
CreateUser(userObject)
user-svc
will take thisuserObject
and check if email already exists in mongoDB (unique email)user-svc
will create a unique user ID using uliduser-svc
will hash the hashed password using bcryptuser-svc
will create and insert new document withuserObject
information inuser collection
user-svc
sends back OKapp-gateway-svc
receives any of the following message fromuser-svc
and sends it back to Chrome: