Library for user authentication and authorization
npm install prg-identity- manages users
- registers
- authorizes
- autenticates
- distributes tokens
-----------------
Map.<string, Set.<string>>Object* AuthService
* [new AuthService(getUserByIdFn, [tokenStorage], [options], [appsProvider])](#new_AuthService_new)
* .expressMiddleware() ⇒ function
* .createUserToken(userId, domain) ⇒ Promise.<Object>
* .createPasswordResetToken(userId) ⇒ Promise
* .getAndRemovePasswordResetToken(token) ⇒ Promise.<(Object\|null)>
* [.createToken(type, [userIdOrGroups], [options], [length])](#AuthService+createToken) ⇒ Promise
* .getToken(type, token) ⇒ Promise.<(Object\|null)>
* .dropToken(token) ⇒ Promise
* [.createUserAccessor([userGroups], [userId])](#AuthService+createUserAccessor) ⇒ UserAccessor
| Param | Type | Default |
| --- | --- | --- |
| getUserByIdFn | function | |
| [tokenStorage] | TokenStorage | |
| [options] | Object | {} |
| options.acl | Object | |
| options.groups | Object | |
| options.tokenFactory | function | |
| [options.passwordReset] | Object | |
| [options.passwordReset.tokenExpiresInMinutes] | number | |
| options.superGroup | string | |
| options.adminGroups | Array.<string> | |
| [options.cookieKey] | string | |
| [options.signed] | boolean | |
| [options.tokenType] | string | |
| [appsProvider] | Map.<string, (Object\|Promise.<Object>)> | new Map() |
AuthServiceAuthService| Param | Default |
| --- | --- |
| userId | |
| domain | |
AuthService| Param | Type |
| --- | --- |
| userId | string |
AuthService| Param | Type |
| --- | --- |
| token | string |
AuthService| Param | Type | Default |
| --- | --- | --- |
| type | string | |
| [userIdOrGroups] | string | null |
| [options] | Object | |
| [length] | number | |
AuthService| Param | Type |
| --- | --- |
| type | string |
| token | string |
AuthService| Param | Type |
| --- | --- |
| token | string |
AuthService| Param | Type | Default |
| --- | --- | --- |
| [userGroups] | Array.<Group> | [] |
| [userId] | string | null |
| Param | Type |
| --- | --- |
| aclList | Map.<String, Set.<String>> |
| [superGroup] | string |
* UsersService
* [new UsersService(userStorage, [config], [formatter])](#new_UsersService_new)
* .storage : MongoDbUserStorage
| Param | Type | Description |
| --- | --- | --- |
| userStorage | \* | |
| [config] | Object | |
| [config.superGroup] | string | |
| [config.adminGroups] | Array.<string> | |
| [formatter] | function | user formatter |
UsersService* UserAccessor
* [new UserAccessor(userGroups, [byUserId], [superGroup], [adminGroups])](#new_UserAccessor_new)
* [.setUser([userGroups], [byUserId])](#UserAccessor+setUser)
* [.isMe([userId])](#UserAccessor+isMe) ⇒ boolean
* .isRelated(groups) ⇒ boolean
* .isAdministrable(groups) ⇒ boolean
* [.filterGroups(groupList, personId, [justManageable])](#UserAccessor+filterGroups) ⇒ Array.<Group>
| Param | Type | Default |
| --- | --- | --- |
| userGroups | Array.<Group> | |
| [byUserId] | string | null |
| [superGroup] | string | null |
| [adminGroups] | Array.<string> | |
UserAccessor| Param | Type | Default |
| --- | --- | --- |
| [userGroups] | Array.<Group> | |
| [byUserId] | string | null |
UserAccessor| Param | Type |
| --- | --- |
| [userId] | string |
UserAccessor| Param | Type |
| --- | --- |
| groups | Array.<Group> |
UserAccessor| Param | Type |
| --- | --- |
| groups | Array.<Group> |
UserAccessor| Param | Type | Default |
| --- | --- | --- |
| groupList | Array.<Group> | |
| personId | string | |
| [justManageable] | boolean | false |
Map.<string, Set.<string>>| Param | Type | Default |
| --- | --- | --- |
| aclObject | any | |
| [groupTree] | any | |
| [glue] | string | "'.'" |
Object| Name | Type |
| --- | --- |
| group | string |
| domain | string |