@adonisjs/auth 9.4.2 → 9.5.1
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.
|
@@ -168,6 +168,22 @@ var Authenticator = class {
|
|
|
168
168
|
redirectTo: options?.loginRoute
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Silently attempt to authenticate the request using all of the mentioned guards
|
|
173
|
+
* or the default guard. Calling this method multiple times triggers multiple
|
|
174
|
+
* authentication with the guard.
|
|
175
|
+
*/
|
|
176
|
+
async checkUsing(guards = [this.defaultGuard]) {
|
|
177
|
+
for (const name of guards) {
|
|
178
|
+
this.#authenticationAttemptedViaGuard = name;
|
|
179
|
+
const isAuthenticated = await this.use(name).check();
|
|
180
|
+
if (isAuthenticated) {
|
|
181
|
+
this.#authenticatedViaGuard = name;
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
171
187
|
};
|
|
172
188
|
|
|
173
189
|
// src/authenticator_client.ts
|
package/build/index.js
CHANGED
|
@@ -390,16 +390,16 @@ var SessionGuard = class {
|
|
|
390
390
|
await userProvider.deleteRemeberToken(this.user, token.identifier);
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
|
-
this.user = void 0;
|
|
394
|
-
this.viaRemember = false;
|
|
395
|
-
this.isAuthenticated = false;
|
|
396
|
-
this.isLoggedOut = true;
|
|
397
393
|
this.#emitter.emit("session_auth:logged_out", {
|
|
398
394
|
ctx: this.#ctx,
|
|
399
395
|
guardName: this.#name,
|
|
400
396
|
user: this.user || null,
|
|
401
397
|
sessionId: session.sessionId
|
|
402
398
|
});
|
|
399
|
+
this.user = void 0;
|
|
400
|
+
this.viaRemember = false;
|
|
401
|
+
this.isAuthenticated = false;
|
|
402
|
+
this.isLoggedOut = true;
|
|
403
403
|
}
|
|
404
404
|
/**
|
|
405
405
|
* Authenticate the current HTTP request by verifying the bearer
|
|
@@ -78,4 +78,10 @@ export declare class Authenticator<KnownGuards extends Record<string, GuardFacto
|
|
|
78
78
|
}): Promise<{
|
|
79
79
|
[K in keyof KnownGuards]: ReturnType<ReturnType<KnownGuards[K]>['getUserOrFail']>;
|
|
80
80
|
}[keyof KnownGuards]>;
|
|
81
|
+
/**
|
|
82
|
+
* Silently attempt to authenticate the request using all of the mentioned guards
|
|
83
|
+
* or the default guard. Calling this method multiple times triggers multiple
|
|
84
|
+
* authentication with the guard.
|
|
85
|
+
*/
|
|
86
|
+
checkUsing(guards?: (keyof KnownGuards)[]): Promise<boolean>;
|
|
81
87
|
}
|
package/build/src/errors.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export declare const E_UNAUTHORIZED_ACCESS: {
|
|
|
49
49
|
code?: string;
|
|
50
50
|
status: number;
|
|
51
51
|
toString(): string;
|
|
52
|
-
|
|
52
|
+
get [Symbol.toStringTag](): string;
|
|
53
53
|
message: string;
|
|
54
54
|
stack?: string;
|
|
55
55
|
cause?: unknown;
|
|
@@ -58,6 +58,7 @@ export declare const E_UNAUTHORIZED_ACCESS: {
|
|
|
58
58
|
code: string;
|
|
59
59
|
help?: string;
|
|
60
60
|
message?: string;
|
|
61
|
+
isError(error: unknown): error is Error;
|
|
61
62
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
62
63
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
63
64
|
stackTraceLimit: number;
|
|
@@ -89,7 +90,7 @@ export declare const E_INVALID_CREDENTIALS: {
|
|
|
89
90
|
code?: string;
|
|
90
91
|
status: number;
|
|
91
92
|
toString(): string;
|
|
92
|
-
|
|
93
|
+
get [Symbol.toStringTag](): string;
|
|
93
94
|
message: string;
|
|
94
95
|
stack?: string;
|
|
95
96
|
cause?: unknown;
|
|
@@ -98,6 +99,7 @@ export declare const E_INVALID_CREDENTIALS: {
|
|
|
98
99
|
code: string;
|
|
99
100
|
help?: string;
|
|
100
101
|
message?: string;
|
|
102
|
+
isError(error: unknown): error is Error;
|
|
101
103
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
102
104
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
103
105
|
stackTraceLimit: number;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/auth",
|
|
3
3
|
"description": "Official authentication provider for Adonis framework",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.5.1",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.16.0"
|
|
7
7
|
},
|
|
@@ -53,54 +53,54 @@
|
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@adonisjs/assembler": "^7.8.2",
|
|
55
55
|
"@adonisjs/core": "^6.19.0",
|
|
56
|
-
"@adonisjs/eslint-config": "^2.1.
|
|
56
|
+
"@adonisjs/eslint-config": "^2.1.2",
|
|
57
57
|
"@adonisjs/hash": "^9.1.1",
|
|
58
|
-
"@adonisjs/i18n": "^2.2.
|
|
59
|
-
"@adonisjs/lucid": "^21.
|
|
58
|
+
"@adonisjs/i18n": "^2.2.2",
|
|
59
|
+
"@adonisjs/lucid": "^21.8.0",
|
|
60
60
|
"@adonisjs/prettier-config": "^1.4.5",
|
|
61
61
|
"@adonisjs/session": "^7.5.1",
|
|
62
62
|
"@adonisjs/tsconfig": "^1.4.1",
|
|
63
63
|
"@japa/api-client": "^3.1.0",
|
|
64
|
-
"@japa/assert": "^4.
|
|
64
|
+
"@japa/assert": "^4.1.1",
|
|
65
65
|
"@japa/browser-client": "^2.1.1",
|
|
66
66
|
"@japa/expect-type": "^2.0.3",
|
|
67
67
|
"@japa/file-system": "^2.3.2",
|
|
68
68
|
"@japa/plugin-adonisjs": "^4.0.0",
|
|
69
|
-
"@japa/runner": "^4.
|
|
70
|
-
"@japa/snapshot": "^2.0.
|
|
69
|
+
"@japa/runner": "^4.4.0",
|
|
70
|
+
"@japa/snapshot": "^2.0.9",
|
|
71
71
|
"@release-it/conventional-changelog": "^10.0.1",
|
|
72
|
-
"@swc/core": "1.
|
|
72
|
+
"@swc/core": "1.13.5",
|
|
73
73
|
"@types/basic-auth": "^1.1.8",
|
|
74
|
-
"@types/luxon": "^3.
|
|
75
|
-
"@types/node": "^24.
|
|
74
|
+
"@types/luxon": "^3.7.1",
|
|
75
|
+
"@types/node": "^24.5.2",
|
|
76
76
|
"@types/set-cookie-parser": "^2.4.10",
|
|
77
77
|
"@types/sinon": "^17.0.4",
|
|
78
78
|
"c8": "^10.1.3",
|
|
79
79
|
"convert-hrtime": "^5.0.0",
|
|
80
80
|
"copyfiles": "^2.4.1",
|
|
81
|
-
"cross-env": "^
|
|
82
|
-
"del-cli": "^
|
|
83
|
-
"dotenv": "^17.2.
|
|
84
|
-
"eslint": "^9.
|
|
85
|
-
"luxon": "^3.7.
|
|
86
|
-
"mysql2": "^3.
|
|
87
|
-
"nock": "^14.0.
|
|
81
|
+
"cross-env": "^10.0.0",
|
|
82
|
+
"del-cli": "^7.0.0",
|
|
83
|
+
"dotenv": "^17.2.2",
|
|
84
|
+
"eslint": "^9.36.0",
|
|
85
|
+
"luxon": "^3.7.2",
|
|
86
|
+
"mysql2": "^3.15.0",
|
|
87
|
+
"nock": "^14.0.10",
|
|
88
88
|
"pg": "^8.16.3",
|
|
89
|
-
"playwright": "^1.
|
|
89
|
+
"playwright": "^1.55.0",
|
|
90
90
|
"prettier": "^3.6.2",
|
|
91
|
-
"release-it": "^19.0.
|
|
91
|
+
"release-it": "^19.0.5",
|
|
92
92
|
"set-cookie-parser": "^2.7.1",
|
|
93
93
|
"sinon": "^21.0.0",
|
|
94
94
|
"sqlite3": "^5.1.7",
|
|
95
95
|
"tedious": "^18.6.1",
|
|
96
96
|
"timekeeper": "^2.3.1",
|
|
97
|
-
"ts-node-maintained": "^10.9.
|
|
97
|
+
"ts-node-maintained": "^10.9.6",
|
|
98
98
|
"tsup": "^8.5.0",
|
|
99
|
-
"typescript": "^5.
|
|
99
|
+
"typescript": "^5.9.2"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
102
|
"@adonisjs/presets": "^2.6.4",
|
|
103
|
-
"@poppinss/utils": "^6.10.
|
|
103
|
+
"@poppinss/utils": "^6.10.1",
|
|
104
104
|
"basic-auth": "^2.0.1"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|