@hitchy/plugin-auth 0.3.2 → 0.3.5

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.
Files changed (33) hide show
  1. package/api/policy/authentication.js +1 -1
  2. package/coverage/block-navigation.js +8 -0
  3. package/coverage/index.html +38 -33
  4. package/coverage/plugin-auth/api/controller/index.html +8 -3
  5. package/coverage/plugin-auth/api/controller/user.js.html +60 -55
  6. package/coverage/plugin-auth/api/model/authorization/index.html +8 -3
  7. package/coverage/plugin-auth/api/model/authorization/rule.js.html +38 -33
  8. package/coverage/plugin-auth/api/model/index.html +8 -3
  9. package/coverage/plugin-auth/api/model/role.js.html +36 -31
  10. package/coverage/plugin-auth/api/model/user-to-role.js.html +28 -23
  11. package/coverage/plugin-auth/api/model/user.js.html +199 -194
  12. package/coverage/plugin-auth/api/policy/authentication.js.html +161 -159
  13. package/coverage/plugin-auth/api/policy/authorization.js.html +32 -27
  14. package/coverage/plugin-auth/api/policy/index.html +22 -17
  15. package/coverage/plugin-auth/api/policy/user.js.html +44 -39
  16. package/coverage/plugin-auth/api/service/auth/index.html +22 -17
  17. package/coverage/plugin-auth/api/service/auth/manager.js.html +231 -226
  18. package/coverage/plugin-auth/api/service/authentication/index.html +8 -3
  19. package/coverage/plugin-auth/api/service/authentication/passport.js.html +50 -45
  20. package/coverage/plugin-auth/api/service/authentication/strategies.js.html +92 -87
  21. package/coverage/plugin-auth/api/service/authorization/index.html +8 -3
  22. package/coverage/plugin-auth/api/service/authorization/node.js.html +143 -138
  23. package/coverage/plugin-auth/api/service/authorization/policy-generator.js.html +36 -31
  24. package/coverage/plugin-auth/api/service/authorization/tree.js.html +139 -134
  25. package/coverage/plugin-auth/config/auth.js.html +24 -19
  26. package/coverage/plugin-auth/config/index.html +8 -3
  27. package/coverage/plugin-auth/index.html +22 -17
  28. package/coverage/plugin-auth/index.js.html +101 -57
  29. package/coverage/sorter.js +26 -0
  30. package/coverage/tmp/coverage-2884-1653923449663-0.json +1 -0
  31. package/index.js +16 -6
  32. package/package.json +11 -11
  33. package/coverage/tmp/coverage-8472-1648414315419-0.json +0 -1
package/index.js CHANGED
@@ -3,6 +3,8 @@
3
3
  module.exports = function( options, plugins ) {
4
4
  const api = this;
5
5
 
6
+ const logWarning = api.log( "hitchy:session:warning" );
7
+
6
8
  const pluginApi = {
7
9
  configure() {
8
10
  const { strategies } = api.config.auth;
@@ -46,14 +48,22 @@ module.exports = function( options, plugins ) {
46
48
  },
47
49
 
48
50
  policies() {
49
- const { config: { auth: { prefix } } } = this;
51
+ const { config: { session, auth: { prefix } } } = this;
52
+
53
+ const policies = {};
54
+
55
+ if ( session.disable ) {
56
+ logWarning( "server-side sessions are disabled, thus passport isn't integrated for commonly handling all requests automatically" );
50
57
 
51
- const policies = {
52
- "/": [
53
- "authentication.initialize",
58
+ policies["/"] = [
54
59
  "authentication.handleBasicAuth",
55
- ],
56
- };
60
+ ];
61
+ } else {
62
+ policies["/"] = [
63
+ "authentication.injectPassport",
64
+ "authentication.handleBasicAuth",
65
+ ];
66
+ }
57
67
 
58
68
  return prefix === false ? policies : {
59
69
  ...policies,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitchy/plugin-auth",
3
- "version": "0.3.2",
3
+ "version": "0.3.5",
4
4
  "description": "user authentication and authorization for Hitchy",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -22,27 +22,27 @@
22
22
  },
23
23
  "homepage": "https://auth.hitchy.org",
24
24
  "peerDependencies": {
25
- "@hitchy/core": "^0.6.18"
25
+ "@hitchy/core": "^0.7.2"
26
26
  },
27
27
  "devDependencies": {
28
- "@hitchy/server-dev-tools": "^0.4.2",
28
+ "@hitchy/server-dev-tools": "^0.4.3",
29
29
  "@hitchy/types": "^0.1.0",
30
- "c8": "^7.11.0",
31
- "eslint": "^8.12.0",
30
+ "c8": "^7.11.3",
31
+ "eslint": "^8.16.0",
32
32
  "eslint-config-cepharum": "^1.0.12",
33
33
  "eslint-plugin-promise": "^6.0.0",
34
- "mocha": "^9.2.2",
35
- "openid-client": "^5.1.4",
34
+ "mocha": "^10.0.0",
35
+ "openid-client": "^5.1.6",
36
36
  "passport-saml": "^3.2.1",
37
37
  "should": "^13.2.3",
38
38
  "should-http": "^0.1.1",
39
39
  "vuepress": "^1.9.7"
40
40
  },
41
41
  "dependencies": {
42
- "@hitchy/plugin-cookies": "^0.1.6",
43
- "@hitchy/plugin-odem": "^0.5.10",
44
- "@hitchy/plugin-session": "^0.1.10",
45
- "passport": "^0.5.2",
42
+ "@hitchy/plugin-cookies": "^0.1.7",
43
+ "@hitchy/plugin-odem": "^0.7.1",
44
+ "@hitchy/plugin-session": "^0.1.11",
45
+ "passport": "^0.5.3",
46
46
  "passport-local": "^1.0.0"
47
47
  }
48
48
  }