@hitchy/plugin-auth 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci.yml +42 -21
- package/LICENSE +21 -0
- package/api/controller/user.js +2 -29
- package/api/model/authorization/rule.js +0 -27
- package/api/model/role.js +0 -28
- package/api/model/user-to-role.js +0 -28
- package/api/model/user.js +2 -30
- package/api/policy/authentication.js +67 -64
- package/api/policy/authorization.js +0 -28
- package/api/policy/user.js +0 -28
- package/api/service/auth/manager.js +9 -28
- package/api/service/authentication/passport.js +1 -29
- package/api/service/authentication/strategies.js +176 -27
- package/api/service/authorization/node.js +0 -28
- package/api/service/authorization/policy-generator.js +0 -28
- package/api/service/authorization/tree.js +0 -28
- package/config/auth.js +5 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +79 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +231 -0
- package/coverage/plugin-auth/api/controller/index.html +111 -0
- package/coverage/plugin-auth/api/controller/user.js.html +368 -0
- package/coverage/plugin-auth/api/model/authorization/index.html +111 -0
- package/coverage/plugin-auth/api/model/authorization/rule.js.html +227 -0
- package/coverage/plugin-auth/api/model/index.html +141 -0
- package/coverage/plugin-auth/api/model/role.js.html +200 -0
- package/coverage/plugin-auth/api/model/user-to-role.js.html +167 -0
- package/coverage/plugin-auth/api/model/user.js.html +752 -0
- package/coverage/plugin-auth/api/policy/authentication.js.html +617 -0
- package/coverage/plugin-auth/api/policy/authorization.js.html +182 -0
- package/coverage/plugin-auth/api/policy/index.html +141 -0
- package/coverage/plugin-auth/api/policy/user.js.html +479 -0
- package/coverage/plugin-auth/api/service/auth/index.html +111 -0
- package/coverage/plugin-auth/api/service/auth/manager.js.html +863 -0
- package/coverage/plugin-auth/api/service/authentication/index.html +126 -0
- package/coverage/plugin-auth/api/service/authentication/passport.js.html +290 -0
- package/coverage/plugin-auth/api/service/authentication/strategies.js.html +860 -0
- package/coverage/plugin-auth/api/service/authorization/index.html +141 -0
- package/coverage/plugin-auth/api/service/authorization/node.js.html +944 -0
- package/coverage/plugin-auth/api/service/authorization/policy-generator.js.html +386 -0
- package/coverage/plugin-auth/api/service/authorization/tree.js.html +983 -0
- package/coverage/plugin-auth/config/auth.js.html +140 -0
- package/coverage/plugin-auth/config/index.html +111 -0
- package/coverage/plugin-auth/index.html +111 -0
- package/coverage/plugin-auth/index.js.html +344 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +170 -0
- package/coverage/tmp/coverage-6744-1648396809135-0.json +1 -0
- package/docs/.vuepress/config.js +5 -2
- package/docs/api/config.md +14 -2
- package/docs/api/model/authorization-rule.md +1 -1
- package/docs/api/model/user.md +2 -2
- package/docs/api/service/authentication-passport.md +1 -1
- package/docs/guides/getting-started.md +2 -2
- package/docs/guides/idp-login.png +0 -0
- package/docs/guides/idp-saml-cert.png +0 -0
- package/docs/guides/openid-connect.md +164 -0
- package/docs/guides/readme.md +2 -0
- package/docs/guides/saml.md +161 -0
- package/docs/introduction.md +5 -5
- package/index.js +27 -50
- package/package.json +18 -13
- package/readme.md +11 -43
package/readme.md
CHANGED
|
@@ -1,57 +1,25 @@
|
|
|
1
|
-
# hitchy
|
|
1
|
+
# @hitchy/plugin-auth
|
|
2
2
|
|
|
3
|
-
[](https://gitlab.com/hitchy/plugin-auth/-/commits/master)
|
|
4
|
+
|
|
5
|
+
_request authentication and authorization for Hitchy framework_
|
|
4
6
|
|
|
5
7
|
## License
|
|
6
8
|
|
|
7
|
-
MIT
|
|
9
|
+
[MIT](LICENSE)
|
|
8
10
|
|
|
9
11
|
## Usage
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Run this command in a hitchy-based project's root folder containing its **package.json** file:
|
|
12
14
|
|
|
13
15
|
```
|
|
14
|
-
npm i @hitchy/plugin-auth
|
|
16
|
+
npm i @hitchy/plugin-auth
|
|
15
17
|
```
|
|
16
18
|
|
|
17
|
-
It will install this plugin as
|
|
18
|
-
|
|
19
|
-
After restarting your application the plugin is discovered and injecting some policy routes used to detect current context of either request and to expose some additional information and API regarding user authentication and authorization.
|
|
20
|
-
|
|
21
|
-
### REST-API
|
|
22
|
-
|
|
23
|
-
The plugin injects special endpoints for managing a user's authentication.
|
|
24
|
-
|
|
25
|
-
| endpoint | method | description |
|
|
26
|
-
|----------|--------|-------------|
|
|
27
|
-
| `/api/auth/login` | POST | Takes username and password in request body and uses them for authenticating selected user. |
|
|
28
|
-
| `/api/auth/login` | GET | Does the same as the POST method and is mainly here as a redirect URI for external authorization |
|
|
29
|
-
| `/api/auth/logout` | GET | Drops information on previously authenticated user. |
|
|
30
|
-
| `/api/auth/check` | GET | Fetches status information on currently authenticated user. |
|
|
31
|
-
|
|
32
|
-
In addition, this plugin is injecting policy requiring authenticated user to have authorization for role `admin` for accessing REST endpoint `/api/user`.
|
|
33
|
-
|
|
34
|
-
### Server-Side Session
|
|
35
|
-
|
|
36
|
-
The plugin is controlling information on authenticated user in current server-side session.
|
|
37
|
-
|
|
38
|
-
When combined with [@hitchy/plugin-session](https://www.npmjs.com/package/@hitchy/plugin-session) this results in exposing information on currently authenticated user and its authorization in headers of every response.
|
|
39
|
-
|
|
40
|
-
### Creating First Account
|
|
41
|
-
|
|
42
|
-
The endpoint `/api/auth/login` is always checking whether there is at least one user with role `admin` in the configured database. If there is no such user the controller is implicitly creating one with username `admin`, password `nimda` and role `admin`.
|
|
43
|
-
|
|
44
|
-
## Upcoming Revisions
|
|
45
|
-
|
|
46
|
-
### High Priority
|
|
47
|
-
|
|
48
|
-
* Add an endpoint in scope of `/api/auth` for creating new user account.
|
|
49
|
-
|
|
50
|
-
### Medium Priority
|
|
51
|
-
|
|
52
|
-
* Improve authorization system by adding additional level of customizable access control.
|
|
19
|
+
It will install this plugin as a dependency.
|
|
53
20
|
|
|
21
|
+
After restarting your application the plugin is discovered by Hitchy automatically. It is injecting some routes instantly suitable for authentication based on a local database.
|
|
54
22
|
|
|
55
|
-
##
|
|
23
|
+
## Manual
|
|
56
24
|
|
|
57
|
-
|
|
25
|
+
Read the [plugin's official manual](https://auth.hitchy.org/) e.g. for [routes supported by default](https://auth.hitchy.org/api/routing.html) and how to use [all the components this plugin is introducing](https://auth.hitchy.org/api/).
|