@mantiq/auth 0.4.0-rc.1 → 0.5.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantiq/auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Session & token auth, guards, providers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,7 +52,10 @@
|
|
|
52
52
|
"@mantiq/database": "workspace:*"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@mantiq/core": "^0.
|
|
56
|
-
"@mantiq/database": "^0.
|
|
55
|
+
"@mantiq/core": "^0.5.0",
|
|
56
|
+
"@mantiq/database": "^0.5.0"
|
|
57
|
+
},
|
|
58
|
+
"mantiq": {
|
|
59
|
+
"provider": "AuthServiceProvider"
|
|
57
60
|
}
|
|
58
61
|
}
|
|
@@ -6,6 +6,8 @@ import { RedirectIfAuthenticated } from './middleware/RedirectIfAuthenticated.ts
|
|
|
6
6
|
import { EnsureEmailIsVerified } from './middleware/EnsureEmailIsVerified.ts'
|
|
7
7
|
import { ConfirmPassword } from './middleware/ConfirmPassword.ts'
|
|
8
8
|
import { Authorize } from './middleware/Authorize.ts'
|
|
9
|
+
import { CheckAbilities } from './middleware/CheckAbilities.ts'
|
|
10
|
+
import { CheckForAnyAbility } from './middleware/CheckForAnyAbility.ts'
|
|
9
11
|
import { GateManager } from './authorization/GateManager.ts'
|
|
10
12
|
import { setGateManager, GATE_MANAGER } from './helpers/gate.ts'
|
|
11
13
|
import type { AuthConfig } from './contracts/AuthConfig.ts'
|
|
@@ -55,10 +57,14 @@ export class AuthServiceProvider extends ServiceProvider {
|
|
|
55
57
|
// Resolve the GateManager so setGateManager() is called
|
|
56
58
|
this.app.make(GateManager)
|
|
57
59
|
|
|
58
|
-
// Register
|
|
60
|
+
// Register middleware aliases
|
|
59
61
|
try {
|
|
60
62
|
const kernel = this.app.make(HttpKernel)
|
|
61
63
|
kernel.registerMiddleware('can', Authorize)
|
|
64
|
+
kernel.registerMiddleware('auth', Authenticate)
|
|
65
|
+
kernel.registerMiddleware('guest', RedirectIfAuthenticated)
|
|
66
|
+
kernel.registerMiddleware('abilities', CheckAbilities as any)
|
|
67
|
+
kernel.registerMiddleware('ability', CheckForAnyAbility as any)
|
|
62
68
|
} catch {
|
|
63
69
|
// HttpKernel may not be available in non-HTTP contexts (e.g., CLI)
|
|
64
70
|
}
|