-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
AccountsJS Improvements #181
Comments
Flow IdeasThe actions made by accountsJS can be split into 3 categories
So in my opinion we need to change the way the suite works. The current way of doing things limit the "multistep" behavior of modern authentication methods In the case of just using the authorization, we just have to get the DBUser from the DB via tokens, and then apply dev defined "verifyFunctions" as we does for impersonating In the case of authorization, we should first identify the ANONGUY // it could be :
const input = {
identity: {
email: '[email protected]',
}
}
// or :
const input = {
identity: {
username: 'aaaaaa',
}
}
// or even :
const input = {
identity: {
userId: 25,
username: 'aaaaaa'
}
} Well, any information able to identify the ANONGUY Then we use thoses informations to retrieve the DBUser from database Now, in order to identify the ANONGUY, we should read on the DBUser the authentication requirements const DBUser = {
requirements: {
AND: ['password', 'code']
}
}
const DBUser = {
requirements: [
{ OR: ['password', 'facebook', 'twitter'] },
'code'
]
} Then, we should provide a way to incrementally satisfy the requirements, and I propose to do this by using the session. See the auth chart for details on the flow : https://drive.google.com/file/d/1k9SAoqx7RLiF-1RNH0beOmtkUPQCeztc/view?usp=sharing Also, An authentication Service should provide a way to identify an user For now, each time we want to add such a way, we need to add a corresponding database function. In the future maybe it will be appropriate to provide a plugin API in our DatabaseInterfaces, but It seems inappropriate now. So let's say we want to add a service able to identify the user with 'shortId' We would have to add the findUserByShortId method to the databaseInterfaces, of course, but in order for the identification method on the AccountsServer to be able to recognize an user by it's shortId, we would just have to add a public object to the class: const input = {
identity: {
shortId: 14
}
}
class ShortIdService implements AuthenticationService {
public identificationMethods = { shortId: 'findUserByShortId' }
} Then, the accountsServer identify method should interpret the presence of shortId as a need to use the findUserByShortId function on the databaseInterface. With this method, we allow the use of any combination of authenticationServices but we also simplify the development of the authenticationServices themselves |
|
As you can see, I have been doing some work on the repo
@accounts/rest-express
and@accounts/rest-client
to the mono repo@accounts/mongo
to the mono repo@accounts/error
- @accounts/error : new AccountsError package with message formatting #171@accounts/types
- @accounts/types : add a types package which contains common types #173@accounts/database-manager
- Feature/database-manager : Allow sessions and users to be stored in different databases #174@accounts/token-manager
- PR open : Token manager Implemented #222The instanciation i would like to achieve is this one (collapse)
The text was updated successfully, but these errors were encountered: