Help | Simple Authentication service schema definition

Hi all!

I’m designing a very small service to handle the authentication of a set of services -for now, it’s just one-.

The idea is that this service will store the user’s info, applications that the user can connect to, along with the roles that the user has.

My main concern is the way I store the roles inside the users, is it ok, or should I use another collection or this?

This is the schema that I was thinking of:

Collection: Applications
-id - UUID
-name - string

Collection: Users

  • id - UUID
  • email - string
  • firstName - string
  • lastName - string
  • linkedApp - Document[] << I’m worry about this part, is it ok? or do we need another collection?
    • appId - UUID
    • roles - string[]

Remain that these roles will be provided by another application, the auth service doesn’t know what types of roles there are in any service.

Thank you so much for your advice!
Regards,
Juan