@travetto/auth-session 6.0.0-rc.2 → 6.0.0-rc.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/README.md +3 -1
- package/package.json +3 -3
- package/src/session.ts +2 -0
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ npm install @travetto/auth-session
|
|
|
13
13
|
yarn add @travetto/auth-session
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
This is a module that adds session support to the [Authentication](https://github.com/travetto/travetto/tree/main/module/auth#readme "Authentication scaffolding for the Travetto framework") framework, via [Data Modeling Support](https://github.com/travetto/travetto/tree/main/module/model#readme "Datastore abstraction for core operations.") storage. The concept here, is that the [Authentication](https://github.com/travetto/travetto/tree/main/module/auth#readme "Authentication scaffolding for the Travetto framework") module provides the solid foundation for ensuring authentication to the system, and transitively to the session data. The [Principal](https://github.com/travetto/travetto/tree/main/module/auth/src/types/principal.ts#
|
|
16
|
+
This is a module that adds session support to the [Authentication](https://github.com/travetto/travetto/tree/main/module/auth#readme "Authentication scaffolding for the Travetto framework") framework, via [Data Modeling Support](https://github.com/travetto/travetto/tree/main/module/model#readme "Datastore abstraction for core operations.") storage. The concept here, is that the [Authentication](https://github.com/travetto/travetto/tree/main/module/auth#readme "Authentication scaffolding for the Travetto framework") module provides the solid foundation for ensuring authentication to the system, and transitively to the session data. The [Principal](https://github.com/travetto/travetto/tree/main/module/auth/src/types/principal.ts#L8) provides a session identifier, which refers to a unique authentication session. Each login will produce a novel session id. This id provides the contract between [Authentication](https://github.com/travetto/travetto/tree/main/module/auth#readme "Authentication scaffolding for the Travetto framework") and[Auth Session](https://github.com/travetto/travetto/tree/main/module/auth-session#readme "Session provider for the travetto auth module.").
|
|
17
17
|
|
|
18
18
|
This session identifier, is then used when retrieving data from [Data Modeling Support](https://github.com/travetto/travetto/tree/main/module/model#readme "Datastore abstraction for core operations.") storage. This storage mechanism is not tied to a request/response model, but the [Web Auth Session](https://github.com/travetto/travetto/tree/main/module/auth-web-session#readme "Web authentication session integration support for the Travetto framework") does provide a natural integration with the [Web API](https://github.com/travetto/travetto/tree/main/module/web#readme "Declarative api for Web Applications with support for the dependency injection.") module.
|
|
19
19
|
|
|
@@ -25,6 +25,7 @@ Within the framework the sessions are stored against any [Data Modeling Support]
|
|
|
25
25
|
* [Elasticsearch Model Source](https://github.com/travetto/travetto/tree/main/module/model-elasticsearch#readme "Elasticsearch backing for the travetto model module, with real-time modeling support for Elasticsearch mappings.")
|
|
26
26
|
* [File Model Support](https://github.com/travetto/travetto/tree/main/module/model-file#readme "File system backing for the travetto model module.")
|
|
27
27
|
* [Memory Model Support](https://github.com/travetto/travetto/tree/main/module/model-memory#readme "Memory backing for the travetto model module.")
|
|
28
|
+
|
|
28
29
|
While the expiry is not necessarily a hard requirement, the implementation without it can be quite messy. To that end, the ability to add [ModelExpirySupport](https://github.com/travetto/travetto/tree/main/module/model/src/types/expiry.ts#L10) to the model provider would be the natural extension point if more expiry support is needed.
|
|
29
30
|
|
|
30
31
|
**Code: Sample usage of Session Service**
|
|
@@ -63,4 +64,5 @@ The [SessionService](https://github.com/travetto/travetto/tree/main/module/auth-
|
|
|
63
64
|
* load
|
|
64
65
|
* read/modify
|
|
65
66
|
* persist
|
|
67
|
+
|
|
66
68
|
And note, persist is intelligent enough to only update the data store if the expiration date has changed or if the data in the session has been modified.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/auth-session",
|
|
3
|
-
"version": "6.0.0-rc.
|
|
3
|
+
"version": "6.0.0-rc.3",
|
|
4
4
|
"description": "Session provider for the travetto auth module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auth",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"directory": "module/auth-session"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@travetto/auth": "^6.0.0-rc.
|
|
28
|
+
"@travetto/auth": "^6.0.0-rc.3",
|
|
29
29
|
"@travetto/config": "^6.0.0-rc.2",
|
|
30
30
|
"@travetto/model": "^6.0.0-rc.2"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@travetto/test": "^6.0.0-rc.
|
|
33
|
+
"@travetto/test": "^6.0.0-rc.3"
|
|
34
34
|
},
|
|
35
35
|
"peerDependenciesMeta": {
|
|
36
36
|
"@travetto/test": {
|
package/src/session.ts
CHANGED
|
@@ -2,11 +2,13 @@ import { AnyMap, castKey, castTo } from '@travetto/runtime';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @concrete
|
|
5
|
+
* @web_contextual
|
|
5
6
|
*/
|
|
6
7
|
export interface SessionData extends AnyMap { }
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Full session object, with metadata
|
|
11
|
+
* @web_contextual
|
|
10
12
|
*/
|
|
11
13
|
export class Session<T extends SessionData = SessionData> {
|
|
12
14
|
/**
|