-
Notifications
You must be signed in to change notification settings - Fork 140
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
Proposal: Remove Use of getAuthenticateData
#223
Comments
Reviewing git history and issues it looks like this has actually been discussed before in issues as a source of confusion: #170 |
To add more issues on to the 🔥 version 3.0.0 has actually different code than master? |
@jpadilla fully doing this would need to be a major version since it would require a change in code. But I can work up a PR that would be something that could be a minor change with a deprecation warning. |
I was suggesting the same two years ago: #144 |
While I understand the value of
getAuthenticateData
as a way of sanitizing data, it does cause a lot of confusion and misdirection for users while providing little in terms of extensibility.https://github.com/jpadilla/ember-simple-auth-token/blob/master/addon/authenticators/token.js#L146-L153
Also it does not use
Ember.get
so you could lose the potential value of unwrapping objects, proxies or computed properties.This is something that could have been useful in a sanitization/unwrapping function.
Passing
credentials
directly as an object would be clearer from a use perspective and would really slim down confusion aroundidentificationField
andpasswordField
config since they wouldn't be needed anymore.This also makes the library more flexible for use with other systems which may require more than two fields.
I have worked in projects where other session IDs are passed in along with email/password to the token endpoint and this would require extending and rewriting the
getAuthenticateData
or even the entiremakeRequest
function.Example in an app may have a controller with the following code:
If after API development the JWT endpoint requires
email
andpassword
instead of the configuredidentification
andpassword
then the thought would be to change the code to:But instead the configuration for
identificationField
would need to be changed toemail
.In comparison if there was no
getAuthenticateData
function or call, then it becomes much more clear and simple to pass in the fields required by the API being used.Th code change listed be required and users wouldn't have to know about configuration for
identificationField
orpasswordField
at all, and they would have more flexibility.Downside:
Removing
getAuthenticateData
would potentially break applications where credentials aren't explicitly passed in (for instance usingthis
as the credentials in a controller/component and lettinggetAuthenticateData
remove properties other than the required fields).This would be hard to make a warning for.
The change required to support this in an app would be to either explicitly create a new credentials object (I think this is best to recommend) or using something like
_.pick
orEmber.Object.getProperties
.The text was updated successfully, but these errors were encountered: