My goal is to link one “user” to many potential IP addresses. I had thought that I could create a custom credential of type “ip-login” and use the credential_data to store the IP address or IP block. Then I could have as many credentials for a user as needed to cover all of their IP blocks.
Authentication would be as easy as searching the credential table for a matching IP address or block and then returning the associated user. I can write the PostgreSQL query without issue, but I can’t seem to find a way to extend the user model to search by credential.
The postgresql would be:
SELECT DISTINCT ON (u.id) u.* FROM credential c JOIN user_entity u ON c.user_id = u.id WHERE c.credential_data = '192.168.1.100';
Performance could be further improved by adding an index to the credential_data column of the credential table.
Any help here would be greatly appreciated.