Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow models to use multpiple authentication tokens #356

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Allan-W-Smith
Copy link

Looking for feedback on the implementation and if this is functionality that would be desired in the main repository. In the case that is, I will need to extend the software tests to cover the new functionality. Currently all existing tests are passing.

My use case:

I have a web application and a mobile application, both need to use authentication tokens and a user can be simultaneously using both. Unfortunately, I need the ability to invalidate tokens on one application and not the other, as such having only a single token field will not do.

Overview of implementation

In the case you wish to use more than one authentication token for a single model, the concept of 'providers' has been added to allow this.

When enabled, providers function alongside both authentication methods (Query params/Request headers) and work with all existing functionality. The only difference is that in order to validate a users token the provider must be present through either params or headers or both.

In the case you have multiple models, you can define them for a single model and all non-defined models will use default behaviour.

You could also enable this functionality simply to rename the default token field on a single model.

@gonzalo-bulnes gonzalo-bulnes added the new feature This pull request adds a new feature. label Jan 2, 2021
@Allan-W-Smith
Copy link
Author

@gonzalo-bulnes Hey mate sorry I've been stale, this year is flat out!

Thanks for getting back and adding the new feature tag, are we still open to implementing this? Happy to tidy up the conflict and put it up for peer review.

Let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature This pull request adds a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants