@hitchy/plugin-auth 0.3.2 → 0.3.3

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 (31) hide show
  1. package/api/policy/authentication.js +1 -1
  2. package/coverage/index.html +31 -31
  3. package/coverage/plugin-auth/api/controller/index.html +1 -1
  4. package/coverage/plugin-auth/api/controller/user.js.html +53 -53
  5. package/coverage/plugin-auth/api/model/authorization/index.html +1 -1
  6. package/coverage/plugin-auth/api/model/authorization/rule.js.html +31 -31
  7. package/coverage/plugin-auth/api/model/index.html +1 -1
  8. package/coverage/plugin-auth/api/model/role.js.html +29 -29
  9. package/coverage/plugin-auth/api/model/user-to-role.js.html +21 -21
  10. package/coverage/plugin-auth/api/model/user.js.html +192 -192
  11. package/coverage/plugin-auth/api/policy/authentication.js.html +154 -157
  12. package/coverage/plugin-auth/api/policy/authorization.js.html +25 -25
  13. package/coverage/plugin-auth/api/policy/index.html +15 -15
  14. package/coverage/plugin-auth/api/policy/user.js.html +37 -37
  15. package/coverage/plugin-auth/api/service/auth/index.html +15 -15
  16. package/coverage/plugin-auth/api/service/auth/manager.js.html +224 -224
  17. package/coverage/plugin-auth/api/service/authentication/index.html +1 -1
  18. package/coverage/plugin-auth/api/service/authentication/passport.js.html +43 -43
  19. package/coverage/plugin-auth/api/service/authentication/strategies.js.html +85 -85
  20. package/coverage/plugin-auth/api/service/authorization/index.html +1 -1
  21. package/coverage/plugin-auth/api/service/authorization/node.js.html +136 -136
  22. package/coverage/plugin-auth/api/service/authorization/policy-generator.js.html +29 -29
  23. package/coverage/plugin-auth/api/service/authorization/tree.js.html +132 -132
  24. package/coverage/plugin-auth/config/auth.js.html +17 -17
  25. package/coverage/plugin-auth/config/index.html +1 -1
  26. package/coverage/plugin-auth/index.html +15 -15
  27. package/coverage/plugin-auth/index.js.html +94 -55
  28. package/coverage/tmp/coverage-16252-1648499208727-0.json +1 -0
  29. package/index.js +16 -6
  30. package/package.json +1 -1
  31. 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.3",
4
4
  "description": "user authentication and authorization for Hitchy",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",