You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 10, 2021. It is now read-only.
When integrating with uPort to log users into a web application, traditional web applications track user sessions on the back-end, binding a session to a given user after the person at the keyboard has proved that's who they are (typically with username/password entry).
In doing the uPort disclosure request flow, the onResponse() method returns the properties (payload) from the message JWT already disassembled. That makes it easy for front-end code to just use the attributes from the JWT directly (trusting the Connect library already did the check to verify the signature on the JWT), but that cannot be used to initialize a user session securely:
/*** DON'T DO THIS!! ***/uport.onResponse(reqID).then(rs=>{constdid=rs.payload.did;myWebAppAPI.startSessionForUser(did);// Use the DID to create a user session});
This is a bad workflow, since then the DID has to be treated as a secret; if an attacker learns what the user's DID string is, they can manually create a user session for them (effectively logging in as them) outside of an onResponse call.
For a Web 3.0 app that doesn't have a traditional database back-end, the front-end UI can track "logged in" status and use browser local storage to track the DID of the user after they've gone through the uPort process, but to hand off the login flow to a back-end process, something to prove the user actually agreed to this login is needed.
The natural solution to that I believe is to give access to the Selective Disclosure Response JWT in full (including the signature). Then the front-end can give that to the back-end, and the back-end can use its own JWT library to verify the signature before trusting the DID inside it.
To give the option of getting the full JWT to all responses, I suggest adding it as a sendOpts option (e.g. includeJWT):
When integrating with uPort to log users into a web application, traditional web applications track user sessions on the back-end, binding a session to a given user after the person at the keyboard has proved that's who they are (typically with username/password entry).
In doing the uPort disclosure request flow, the
onResponse()
method returns the properties (payload) from the message JWT already disassembled. That makes it easy for front-end code to just use the attributes from the JWT directly (trusting the Connect library already did the check to verify the signature on the JWT), but that cannot be used to initialize a user session securely:This is a bad workflow, since then the DID has to be treated as a secret; if an attacker learns what the user's DID string is, they can manually create a user session for them (effectively logging in as them) outside of an
onResponse
call.For a Web 3.0 app that doesn't have a traditional database back-end, the front-end UI can track "logged in" status and use browser local storage to track the DID of the user after they've gone through the uPort process, but to hand off the login flow to a back-end process, something to prove the user actually agreed to this login is needed.
The natural solution to that I believe is to give access to the Selective Disclosure Response JWT in full (including the signature). Then the front-end can give that to the back-end, and the back-end can use its own JWT library to verify the signature before trusting the DID inside it.
To give the option of getting the full JWT to all responses, I suggest adding it as a
sendOpts
option (e.g.includeJWT
):The text was updated successfully, but these errors were encountered: