prg-identity
v0.7.3
Published
Library for user authentication and authorization
Maintainers
Readme
Identity
- manages users
- registers
- authorizes
- autenticates
- distributes tokens
API
Classes
Functions
Typedefs
AuthService
Kind: global class
- AuthService
- new AuthService(getUserByIdFn, [tokenStorage], [options], [appsProvider])
- .expressMiddleware() ⇒ function
- .createUserToken(userId, domain) ⇒ Promise.<Object>
- .createPasswordResetToken(userId) ⇒ Promise
- .getAndRemovePasswordResetToken(token) ⇒ Promise.<(Object|null)>
- .createToken(type, [userIdOrGroups], [options], [length]) ⇒ Promise
- .getToken(type, token) ⇒ Promise.<(Object|null)>
- .dropToken(token) ⇒ Promise
- .createUserAccessor([userGroups], [userId]) ⇒ UserAccessor
new AuthService(getUserByIdFn, [tokenStorage], [options], [appsProvider])
Creates an instance of AuthService
| 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() |
authService.expressMiddleware() ⇒ function
Kind: instance method of AuthService
authService.createUserToken(userId, domain) ⇒ Promise.<Object>
Kind: instance method of AuthService
| Param | Default | | --- | --- | | userId | | | domain | |
authService.createPasswordResetToken(userId) ⇒ Promise
Kind: instance method of AuthService
| Param | Type | | --- | --- | | userId | string |
authService.getAndRemovePasswordResetToken(token) ⇒ Promise.<(Object|null)>
Kind: instance method of AuthService
| Param | Type | | --- | --- | | token | string |
authService.createToken(type, [userIdOrGroups], [options], [length]) ⇒ Promise
Kind: instance method of AuthService
| Param | Type | Default | | --- | --- | --- | | type | string | | | [userIdOrGroups] | string | null | | [options] | Object | | | [length] | number | |
authService.getToken(type, token) ⇒ Promise.<(Object|null)>
Kind: instance method of AuthService
| Param | Type | | --- | --- | | type | string | | token | string |
authService.dropToken(token) ⇒ Promise
Kind: instance method of AuthService
| Param | Type | | --- | --- | | token | string |
authService.createUserAccessor([userGroups], [userId]) ⇒ UserAccessor
Kind: instance method of AuthService
| Param | Type | Default | | --- | --- | --- | | [userGroups] | Array.<Group> | [] | | [userId] | string | null |
Authorizator
Kind: global class
new Authorizator(aclList, [superGroup])
Creates an instance of Authorizator.
| Param | Type | | --- | --- | | aclList | Map.<String, Set.<String>> | | [superGroup] | string |
UsersService
Kind: global class
- UsersService
- new UsersService(userStorage, [config], [formatter])
- .storage : MongoDbUserStorage
new UsersService(userStorage, [config], [formatter])
| Param | Type | Description | | --- | --- | --- | | userStorage | * | | | [config] | Object | | | [config.superGroup] | string | | | [config.adminGroups] | Array.<string> | | | [formatter] | function | user formatter |
usersService.storage : MongoDbUserStorage
Kind: instance property of UsersService
UserAccessor
Kind: global class
new UserAccessor(userGroups, [byUserId], [superGroup], [adminGroups])
| Param | Type | Default | | --- | --- | --- | | userGroups | Array.<Group> | | | [byUserId] | string | null | | [superGroup] | string | null | | [adminGroups] | Array.<string> | |
userAccessor.setUser([userGroups], [byUserId])
Kind: instance method of UserAccessor
| Param | Type | Default | | --- | --- | --- | | [userGroups] | Array.<Group> | | | [byUserId] | string | null |
userAccessor.isMe([userId]) ⇒ boolean
Kind: instance method of UserAccessor
| Param | Type | | --- | --- | | [userId] | string |
userAccessor.isRelated(groups) ⇒ boolean
Kind: instance method of UserAccessor
| Param | Type | | --- | --- | | groups | Array.<Group> |
userAccessor.isAdministrable(groups) ⇒ boolean
Kind: instance method of UserAccessor
| Param | Type | | --- | --- | | groups | Array.<Group> |
userAccessor.filterGroups(groupList, personId, [justManageable]) ⇒ Array.<Group>
Kind: instance method of UserAccessor
| Param | Type | Default | | --- | --- | --- | | groupList | Array.<Group> | | | personId | string | | | [justManageable] | boolean | false |
aclResolver(aclObject, [groupTree], [glue]) ⇒ Map.<string, Set.<string>>
Kind: global function
| Param | Type | Default | | --- | --- | --- | | aclObject | any | | | [groupTree] | any | | | [glue] | string | "'.'" |
Group : Object
Kind: global typedef Properties
| Name | Type | | --- | --- | | group | string | | domain | string |
