@hitchy/plugin-auth 0.3.0 → 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.
- package/api/policy/authentication.js +81 -27
- package/api/service/auth/manager.js +36 -4
- package/api/service/authentication/passport.js +6 -5
- package/api/service/authentication/strategies.js +57 -34
- package/api/service/authorization/tree.js +8 -8
- package/coverage/index.html +45 -45
- package/coverage/plugin-auth/api/controller/index.html +1 -1
- package/coverage/plugin-auth/api/controller/user.js.html +53 -53
- package/coverage/plugin-auth/api/model/authorization/index.html +1 -1
- package/coverage/plugin-auth/api/model/authorization/rule.js.html +31 -31
- package/coverage/plugin-auth/api/model/index.html +1 -1
- package/coverage/plugin-auth/api/model/role.js.html +29 -29
- package/coverage/plugin-auth/api/model/user-to-role.js.html +21 -21
- package/coverage/plugin-auth/api/model/user.js.html +192 -192
- package/coverage/plugin-auth/api/policy/authentication.js.html +281 -119
- package/coverage/plugin-auth/api/policy/authorization.js.html +25 -25
- package/coverage/plugin-auth/api/policy/index.html +18 -18
- package/coverage/plugin-auth/api/policy/user.js.html +37 -37
- package/coverage/plugin-auth/api/service/auth/index.html +16 -16
- package/coverage/plugin-auth/api/service/auth/manager.js.html +293 -197
- package/coverage/plugin-auth/api/service/authentication/index.html +25 -25
- package/coverage/plugin-auth/api/service/authentication/passport.js.html +55 -52
- package/coverage/plugin-auth/api/service/authentication/strategies.js.html +204 -135
- package/coverage/plugin-auth/api/service/authorization/index.html +1 -1
- package/coverage/plugin-auth/api/service/authorization/node.js.html +136 -136
- package/coverage/plugin-auth/api/service/authorization/policy-generator.js.html +29 -29
- package/coverage/plugin-auth/api/service/authorization/tree.js.html +140 -140
- package/coverage/plugin-auth/config/auth.js.html +17 -17
- package/coverage/plugin-auth/config/index.html +1 -1
- package/coverage/plugin-auth/index.html +15 -15
- package/coverage/plugin-auth/index.js.html +94 -55
- package/coverage/tmp/coverage-16252-1648499208727-0.json +1 -0
- package/index.js +17 -4
- package/package.json +2 -2
- package/coverage/tmp/coverage-6744-1648396809135-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,11 +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;
|
|
50
52
|
|
|
51
|
-
const policies = {
|
|
52
|
-
|
|
53
|
-
|
|
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" );
|
|
57
|
+
|
|
58
|
+
policies["/"] = [
|
|
59
|
+
"authentication.handleBasicAuth",
|
|
60
|
+
];
|
|
61
|
+
} else {
|
|
62
|
+
policies["/"] = [
|
|
63
|
+
"authentication.injectPassport",
|
|
64
|
+
"authentication.handleBasicAuth",
|
|
65
|
+
];
|
|
66
|
+
}
|
|
54
67
|
|
|
55
68
|
return prefix === false ? policies : {
|
|
56
69
|
...policies,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitchy/plugin-auth",
|
|
3
|
-
"version": "0.3.
|
|
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",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@hitchy/plugin-cookies": "^0.1.6",
|
|
43
43
|
"@hitchy/plugin-odem": "^0.5.10",
|
|
44
|
-
"@hitchy/plugin-session": "^0.1.
|
|
44
|
+
"@hitchy/plugin-session": "^0.1.10",
|
|
45
45
|
"passport": "^0.5.2",
|
|
46
46
|
"passport-local": "^1.0.0"
|
|
47
47
|
}
|