@omnitron-dev/titan-auth 0.4.6 → 0.4.8
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 +26 -47
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,58 +1,37 @@
|
|
|
1
1
|
# @omnitron-dev/titan-auth
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
JWT authentication, session verification and identity propagation for Titan applications. Netron uses the admitted identity to enforce method authorization.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Capabilities
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Token issuance and verification, HTTP adapters and async invocation context.
|
|
8
|
+
- Shared-session authentication with a current revocable authority.
|
|
9
|
+
- An optional authenticated Netron session-authority service.
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```sh
|
|
10
14
|
pnpm add @omnitron-dev/titan-auth
|
|
11
15
|
```
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
optionally `activeRefreshTokenId` from one consistent database snapshot. A missing
|
|
31
|
-
or revoked session is rejected; an unavailable or malformed authority returns 503.
|
|
32
|
-
The token's subject must own the session. Current grants replace its role and
|
|
33
|
-
permission claims, so a database role edit does not depend on cache invalidation.
|
|
34
|
-
|
|
35
|
-
`SessionAuthorityService` from `./preset/session-authority` is an optional Netron
|
|
36
|
-
adapter for cooperating backends. Its `resolve({ sessionId, userId })` method
|
|
37
|
-
requires both `service_role` and `sessions.resolve`; it returns no bearer tokens.
|
|
38
|
-
The application owns the authenticated transport, deadline, database and lifecycle.
|
|
39
|
-
Deploy the authority endpoint before its consumers. Authority unavailability
|
|
40
|
-
refuses protected requests; replicate the owner and its database for availability.
|
|
41
|
-
|
|
42
|
-
Registry mode remains available with `sessionRedis` and optional `sessionLookup`.
|
|
43
|
-
The lookup can recover a registry miss, but this preset never writes Redis:
|
|
44
|
-
restoration must serialize with revocation in the adapter. Cached registry hits
|
|
45
|
-
are only as current as the application's registry update protocol. Prefer canonical
|
|
46
|
-
mode where revocation must reflect committed database state on the next request.
|
|
47
|
-
|
|
48
|
-
Tokens require bounded subject/session identifiers and an unexpired `exp`.
|
|
49
|
-
Human sessions cannot claim `service_role`. The authentication-result cache is
|
|
50
|
-
disabled in this preset (`cacheTtl` is deprecated); signature caching is separate.
|
|
51
|
-
Netron revalidates token-backed persistent peers before calls, property access and
|
|
52
|
-
core tasks, and binds the checked identity to that invocation's async context.
|
|
53
|
-
An already admitted invocation retains its identity; critical mutations should
|
|
54
|
-
also check resource ownership and authority under the transaction's locks.
|
|
17
|
+
```ts
|
|
18
|
+
import { TitanAuthModule } from '@omnitron-dev/titan-auth';
|
|
19
|
+
|
|
20
|
+
export function authentication(jwtSecret: string) {
|
|
21
|
+
return TitanAuthModule.forRoot({ algorithm: 'HS256', jwtSecret });
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Provide the configured module through the application's imports and keep secrets in its configuration boundary. Authentication alone does not grant access: declare roles, permissions or policies on protected Netron methods.
|
|
26
|
+
|
|
27
|
+
For database-backed revocation, use `createSharedSessionAuthManager` from `./preset/shared-session` with `sessionAuthority(sessionId, userId)`. The authority returns current session ownership, expiry, revocation and grants from one consistent snapshot. Missing or revoked sessions reject; unavailable or malformed authority returns 503. Human sessions cannot claim `service_role`.
|
|
28
|
+
|
|
29
|
+
`./preset/session-authority` exposes an optional `SessionAuthorityService`; callers require both `service_role` and `sessions.resolve`. The application owns the transport, database and lifecycle. Critical mutations should also check resource ownership inside their transaction.
|
|
30
|
+
|
|
31
|
+
## Documentation
|
|
32
|
+
|
|
33
|
+
[Public API](src/index.ts) · [Package exports](package.json) · [Omni](../../README.md)
|
|
55
34
|
|
|
56
35
|
## License
|
|
57
36
|
|
|
58
|
-
MIT
|
|
37
|
+
[MIT](../../LICENSE).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnitron-dev/titan-auth",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "JWT authentication module for Titan framework",
|
|
5
5
|
"author": "LuxQuant",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@omnitron-dev/access": "0.4.
|
|
32
|
+
"@omnitron-dev/access": "0.4.8",
|
|
33
33
|
"jose": "^6.2.14",
|
|
34
34
|
"reflect-metadata": "^0.2.2"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@omnitron-dev/titan": "0.4.
|
|
37
|
+
"@omnitron-dev/titan": "0.4.8"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@omnitron-dev/titan": "0.4.
|
|
40
|
+
"@omnitron-dev/titan": "0.4.8",
|
|
41
41
|
"@types/node": "26.6.6",
|
|
42
42
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
43
43
|
"vitest": "^5.0.5",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"url": "git+https://github.com/omnitron-dev/omni.git",
|
|
49
49
|
"directory": "packages/titan-auth"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "1ae8568eebc2581e2cc2428bd3ca1cf570ed3f03",
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "../../scripts/build-package.sh -p ./tsconfig.json",
|
|
54
54
|
"test": "vitest run",
|