Firstly this is not about how to store password for access to the application itself. That is handled using .Net Identity. Authentication is handled using JWT. So it is a web application.

The problem is to be able to store and retrieve passwords as safely as possible for the users of the system.

One user (a company with several employees) may have a number of clients for whom they have access to report, say taxes or VAT using different services. That requires credentials for those services. And it requires that those credentials are stored as safely as at all possible.

Users could do this themselves in password managers, but there is a big risk that either they mess up by not synchronizing changes between employees or they forget to delete credentials when a client is no longer with them.

Further there may be levels of access usually meaning several password manager storage files. Which will increase the mess the user's employees can get themselves into.

I can think of the following requirements

  • Passwords are encrypted with public/private key pair
  • Passwords are stored in the database as encrypted
  • Passwords are never shown in clear text, only copied to clipboard and expires in short time
  • Only employees having access to correct private key can decrypt
  • When client is deleted all passwords for that client are deleted
  • public/private key pair is not stored in database, security handled by access to client machines

Is there anything that I have overlooked or something that could be done in a better way?

  • 1
    @candied_orange: It's a password manager. Presumably one would use such a thing to populate a login dialog; for that, you need the real password, not a hash. Jul 17, 2018 at 20:50
  • 1
    @Bent are you suggesting the the application have a built in password manager for itself?
    – Ewan
    Jul 17, 2018 at 20:56
  • @Ewan yes. That is the idea.
    – Bent
    Jul 17, 2018 at 20:57

1 Answer 1


As I understand it you have a multi Tenant web app.

However these tenants have Agents which log in on their behalf.

The Agents may represent many Tenants and thus need several sets of username/password to log in to the system with various access levels, even though its the same person

If your application has a built in password manager, you need a password to access those passwords.

So the over all effect will be that a single username and password give a user access to many Tenants.

Rather than achieve this by storing all the passwords with the attached security risks. I would suggest that you simply expand your applications security model to include the Agents use case.

ie. let someone log in with a single password and then select which tenant they want to view.

This will require that a user has roles per tenant rather than one set of roles

  • No actually all the passwords stored in the internal password manager will be for external services. One tenant will have a number of users (employed in the company that owns the tenant) that administer the tenants clients (who cannot log in to this system) and their passwords for the externals services.
    – Bent
    Jul 17, 2018 at 21:20
  • Ahh a more tricksey problem, one would hope that many services will grant access to other apps via tokens these days, But I think in reality its unlikely. You are stuck having to save all the passwords which may well breach the terms and conditions of the external sites
    – Ewan
    Jul 17, 2018 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.