Skip to content

Unable to handle login with same email on tenant-separated userbase #424

@obfuscoder

Description

@obfuscoder

I got a system which provides instances for separate tenants/clients. Each tenant/client can manage their own users. The user table has therefore not only username (email) and credential columns, but also a client column, associating each user to a specific client. Sometimes there are several clients configured by the same people so they create the same usernames for different clients. Sorcery cannot handle this setup. The login method only allows for username, password arguments and does not allow to also specify additional selection criteria (in my case the current client the user wants to login to which is based on the FQDN). The result is that Sorcery finds more than just one result for the username and aborts the login while in fact the usernames are unique PER client.

Do I need to monkey-patch ActiveRecordAdapter#find_by_credentials or write my own adapter to achieve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions