@maximemrf/adonisjs-jwt 0.7.1 → 0.8.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/README.md +16 -1
- package/build/src/define_config.d.ts +4 -4
- package/build/src/jwks.d.ts +1 -1
- package/build/src/jwt.d.ts +2 -2
- package/build/src/types.d.ts +3 -3
- package/build/src/types.js +1 -1
- package/package.json +23 -15
package/README.md
CHANGED
|
@@ -11,6 +11,13 @@
|
|
|
11
11
|
|
|
12
12
|
> AdonisJS package to authenticate users using JWT tokens.
|
|
13
13
|
|
|
14
|
+
## Compatibility & Versions
|
|
15
|
+
|
|
16
|
+
| Package Version | AdonisJS Version | Node.js Required |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| `v0.7.x` | `AdonisJS v6` | `>= 20.6.0` |
|
|
19
|
+
| **`v0.8.x`** | **`AdonisJS v7`** | **`>= 24.0.0`** |
|
|
20
|
+
|
|
14
21
|
## Prerequisites
|
|
15
22
|
|
|
16
23
|
You have to install the auth package from AdonisJS
|
|
@@ -19,7 +26,7 @@ You have to install the auth package from AdonisJS
|
|
|
19
26
|
node ace add @adonisjs/auth
|
|
20
27
|
```
|
|
21
28
|
|
|
22
|
-
## Setup
|
|
29
|
+
## Setup (AdonisJS v7)
|
|
23
30
|
|
|
24
31
|
Install the package:
|
|
25
32
|
|
|
@@ -27,6 +34,14 @@ Install the package:
|
|
|
27
34
|
npm i @maximemrf/adonisjs-jwt
|
|
28
35
|
```
|
|
29
36
|
|
|
37
|
+
## Setup for AdonisJS v6
|
|
38
|
+
|
|
39
|
+
If you are using AdonisJS v6, you have to install the `v0.7.x` version of the package:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm i @maximemrf/adonisjs-jwt@0.7.1
|
|
43
|
+
```
|
|
44
|
+
|
|
30
45
|
## Usage
|
|
31
46
|
|
|
32
47
|
Go to `config/auth.ts` and add the following configuration:
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { GuardConfigProvider } from '@adonisjs/auth/types';
|
|
1
|
+
import type { GuardConfigProvider } from '@adonisjs/auth/types';
|
|
2
2
|
import type { HttpContext } from '@adonisjs/core/http';
|
|
3
|
-
import { JwtGuardUser, JwtUserProviderContract, JwtCookieOptions } from './types.js';
|
|
3
|
+
import type { JwtGuardUser, JwtUserProviderContract, JwtCookieOptions } from './types.js';
|
|
4
4
|
import { JwtGuard } from './jwt.js';
|
|
5
5
|
import type { StringValue } from 'ms';
|
|
6
|
-
import { AccessTokensUserProviderContract } from '@adonisjs/auth/types/access_tokens';
|
|
7
|
-
import { Options } from 'jwks-rsa';
|
|
6
|
+
import type { AccessTokensUserProviderContract } from '@adonisjs/auth/types/access_tokens';
|
|
7
|
+
import type { Options } from 'jwks-rsa';
|
|
8
8
|
export declare function jwtGuard<UserProvider extends JwtUserProviderContract<unknown>>(config: {
|
|
9
9
|
provider: UserProvider;
|
|
10
10
|
refreshTokenUserProvider?: AccessTokensUserProviderContract<unknown>;
|
package/build/src/jwks.d.ts
CHANGED
package/build/src/jwt.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { symbols } from '@adonisjs/auth';
|
|
2
|
-
import { AuthClientResponse, GuardContract } from '@adonisjs/auth/types';
|
|
2
|
+
import type { AuthClientResponse, GuardContract } from '@adonisjs/auth/types';
|
|
3
3
|
import type { HttpContext } from '@adonisjs/core/http';
|
|
4
4
|
import type { StringValue } from 'ms';
|
|
5
|
-
import { JwtUserProviderContract, JwtGuardOptions } from './types.js';
|
|
5
|
+
import type { JwtUserProviderContract, JwtGuardOptions } from './types.js';
|
|
6
6
|
export declare class JwtGuard<UserProvider extends JwtUserProviderContract<unknown>> implements GuardContract<UserProvider[typeof symbols.PROVIDER_REAL_USER]> {
|
|
7
7
|
#private;
|
|
8
8
|
constructor(ctx: HttpContext, userProvider: UserProvider, option: JwtGuardOptions<UserProvider[typeof symbols.PROVIDER_REAL_USER]>);
|
package/build/src/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { symbols } from '@adonisjs/auth';
|
|
1
|
+
import type { symbols } from '@adonisjs/auth';
|
|
2
2
|
import type { StringValue } from 'ms';
|
|
3
|
-
import { AccessTokensUserProviderContract } from '@adonisjs/auth/types/access_tokens';
|
|
4
|
-
import { Options } from 'jwks-rsa';
|
|
3
|
+
import type { AccessTokensUserProviderContract } from '@adonisjs/auth/types/access_tokens';
|
|
4
|
+
import type { Options } from 'jwks-rsa';
|
|
5
5
|
import type { CookieOptions } from '@adonisjs/core/types/http';
|
|
6
6
|
export type JwtCookieOptions = Omit<Partial<CookieOptions>, 'maxAge' | 'expires'>;
|
|
7
7
|
/**
|
package/build/src/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maximemrf/adonisjs-jwt",
|
|
3
3
|
"description": "Adonisjs v6 package for authentication with jwt token",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.6.0"
|
|
7
7
|
},
|
|
@@ -17,13 +17,18 @@
|
|
|
17
17
|
"./types": "./build/src/types.js",
|
|
18
18
|
"./jwt_config": "./build/src/define_config.js"
|
|
19
19
|
},
|
|
20
|
+
"imports": {
|
|
21
|
+
"#generated/*": "./.adonisjs/server/*.js",
|
|
22
|
+
"#transformers/*": "./app/transformers/*.js",
|
|
23
|
+
"#database/*": "./database/*.js"
|
|
24
|
+
},
|
|
20
25
|
"scripts": {
|
|
21
26
|
"clean": "del-cli build",
|
|
22
27
|
"copy:templates": "copyfiles \"stubs/**/*.stub\" build",
|
|
23
28
|
"typecheck": "tsc --noEmit",
|
|
24
29
|
"lint": "eslint .",
|
|
25
30
|
"format": "prettier --write .",
|
|
26
|
-
"quick:test": "node --import
|
|
31
|
+
"quick:test": "node --import=@poppinss/ts-exec --enable-source-maps bin/test.ts --force-exit",
|
|
27
32
|
"pretest": "npm run lint",
|
|
28
33
|
"test": "c8 npm run quick:test",
|
|
29
34
|
"prebuild": "npm run lint && npm run clean",
|
|
@@ -34,31 +39,31 @@
|
|
|
34
39
|
"prepublishOnly": "npm run build"
|
|
35
40
|
},
|
|
36
41
|
"devDependencies": {
|
|
37
|
-
"@adonisjs/assembler": "^
|
|
38
|
-
"@adonisjs/auth": "^
|
|
39
|
-
"@adonisjs/core": "^
|
|
40
|
-
"@adonisjs/eslint-config": "^
|
|
41
|
-
"@adonisjs/lucid": "^
|
|
42
|
+
"@adonisjs/assembler": "^8.0.0",
|
|
43
|
+
"@adonisjs/auth": "^10.0.0",
|
|
44
|
+
"@adonisjs/core": "^7.0.1",
|
|
45
|
+
"@adonisjs/eslint-config": "^3.0.0",
|
|
46
|
+
"@adonisjs/lucid": "^22.0.0",
|
|
42
47
|
"@adonisjs/prettier-config": "^1.4.5",
|
|
43
|
-
"@adonisjs/tsconfig": "^
|
|
48
|
+
"@adonisjs/tsconfig": "^2.0.0",
|
|
44
49
|
"@japa/assert": "^4.2.0",
|
|
45
50
|
"@japa/file-system": "^3.0.0",
|
|
46
51
|
"@japa/runner": "^5.3.0",
|
|
52
|
+
"@poppinss/ts-exec": "^1.4.4",
|
|
47
53
|
"@types/nock": "^11.1.0",
|
|
48
|
-
"@swc/core": "^1.15.11",
|
|
49
54
|
"@types/node": "^22.15.18",
|
|
50
55
|
"c8": "^10.1.3",
|
|
51
56
|
"copyfiles": "^2.4.1",
|
|
52
57
|
"del-cli": "^7.0.0",
|
|
53
|
-
"eslint": "^9.39.
|
|
58
|
+
"eslint": "^9.39.3",
|
|
54
59
|
"luxon": "^3.7.2",
|
|
55
60
|
"nock": "^14.0.11",
|
|
56
61
|
"np": "^11.0.2",
|
|
57
62
|
"prettier": "^3.8.1",
|
|
58
63
|
"sqlite3": "^5.1.7",
|
|
59
64
|
"timekeeper": "^2.3.1",
|
|
60
|
-
"
|
|
61
|
-
"
|
|
65
|
+
"typescript": "~5.9.3",
|
|
66
|
+
"youch": "^4.1.0"
|
|
62
67
|
},
|
|
63
68
|
"dependencies": {
|
|
64
69
|
"@types/jsonwebtoken": "^9.0.10",
|
|
@@ -67,7 +72,7 @@
|
|
|
67
72
|
"ms": "^2.1.3"
|
|
68
73
|
},
|
|
69
74
|
"peerDependencies": {
|
|
70
|
-
"@adonisjs/core": "^
|
|
75
|
+
"@adonisjs/core": "^7.0.1"
|
|
71
76
|
},
|
|
72
77
|
"author": "MaximeMRF",
|
|
73
78
|
"license": "MIT",
|
|
@@ -75,7 +80,10 @@
|
|
|
75
80
|
"adonisjs",
|
|
76
81
|
"adonis",
|
|
77
82
|
"jwt",
|
|
78
|
-
"authentication"
|
|
83
|
+
"authentication",
|
|
84
|
+
"jwks",
|
|
85
|
+
"refresh token",
|
|
86
|
+
"cookies"
|
|
79
87
|
],
|
|
80
88
|
"eslintConfig": {
|
|
81
89
|
"extends": "@adonisjs/eslint-config/package"
|
|
@@ -100,4 +108,4 @@
|
|
|
100
108
|
"tests/**"
|
|
101
109
|
]
|
|
102
110
|
}
|
|
103
|
-
}
|
|
111
|
+
}
|