@enterprisestandard/react 0.0.5-beta.20260115.3 → 0.0.5-beta.20260115.4
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/dist/index.d.ts +2573 -41
- package/dist/index.js +3732 -144
- package/dist/index.js.map +1 -0
- package/package.json +3 -1
- package/dist/group-store.d.ts +0 -164
- package/dist/group-store.d.ts.map +0 -1
- package/dist/group-store.js +0 -127
- package/dist/iam.d.ts +0 -206
- package/dist/iam.d.ts.map +0 -1
- package/dist/iam.js +0 -680
- package/dist/index.d.ts.map +0 -1
- package/dist/session-store.d.ts +0 -179
- package/dist/session-store.d.ts.map +0 -1
- package/dist/session-store.js +0 -105
- package/dist/sso-server.d.ts +0 -13
- package/dist/sso-server.d.ts.map +0 -1
- package/dist/sso-server.js +0 -46
- package/dist/sso.d.ts +0 -104
- package/dist/sso.d.ts.map +0 -1
- package/dist/sso.js +0 -820
- package/dist/tenant-server.d.ts +0 -8
- package/dist/tenant-server.d.ts.map +0 -1
- package/dist/tenant-server.js +0 -6
- package/dist/tenant.d.ts +0 -280
- package/dist/tenant.d.ts.map +0 -1
- package/dist/tenant.js +0 -324
- package/dist/types/base-user.d.ts +0 -27
- package/dist/types/base-user.d.ts.map +0 -1
- package/dist/types/base-user.js +0 -1
- package/dist/types/enterprise-user.d.ts +0 -158
- package/dist/types/enterprise-user.d.ts.map +0 -1
- package/dist/types/enterprise-user.js +0 -1
- package/dist/types/oidc-schema.d.ts +0 -86
- package/dist/types/oidc-schema.d.ts.map +0 -1
- package/dist/types/oidc-schema.js +0 -328
- package/dist/types/scim-schema.d.ts +0 -419
- package/dist/types/scim-schema.d.ts.map +0 -1
- package/dist/types/scim-schema.js +0 -519
- package/dist/types/standard-schema.d.ts +0 -56
- package/dist/types/standard-schema.d.ts.map +0 -1
- package/dist/types/standard-schema.js +0 -1
- package/dist/types/user.d.ts +0 -41
- package/dist/types/user.d.ts.map +0 -1
- package/dist/types/user.js +0 -1
- package/dist/types/workload-schema.d.ts +0 -106
- package/dist/types/workload-schema.d.ts.map +0 -1
- package/dist/types/workload-schema.js +0 -208
- package/dist/ui/sign-in-loading.d.ts +0 -5
- package/dist/ui/sign-in-loading.d.ts.map +0 -1
- package/dist/ui/sign-in-loading.js +0 -8
- package/dist/ui/signed-in.d.ts +0 -3
- package/dist/ui/signed-in.d.ts.map +0 -1
- package/dist/ui/signed-in.js +0 -8
- package/dist/ui/signed-out.d.ts +0 -3
- package/dist/ui/signed-out.d.ts.map +0 -1
- package/dist/ui/signed-out.js +0 -8
- package/dist/ui/sso-provider.d.ts +0 -35
- package/dist/ui/sso-provider.d.ts.map +0 -1
- package/dist/ui/sso-provider.js +0 -275
- package/dist/user-store.d.ts +0 -161
- package/dist/user-store.d.ts.map +0 -1
- package/dist/user-store.js +0 -114
- package/dist/utils.d.ts +0 -9
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -23
- package/dist/vault.d.ts +0 -18
- package/dist/vault.d.ts.map +0 -1
- package/dist/vault.js +0 -22
- package/dist/workload-server.d.ts +0 -127
- package/dist/workload-server.d.ts.map +0 -1
- package/dist/workload-server.js +0 -167
- package/dist/workload-token-store.d.ts +0 -187
- package/dist/workload-token-store.d.ts.map +0 -1
- package/dist/workload-token-store.js +0 -95
- package/dist/workload.d.ts +0 -227
- package/dist/workload.d.ts.map +0 -1
- package/dist/workload.js +0 -691
package/dist/session-store.d.ts
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session management for tracking user sessions and enabling backchannel logout.
|
|
3
|
-
*
|
|
4
|
-
* Session stores are optional - the package works with JWT cookies alone.
|
|
5
|
-
* Sessions are only required for backchannel logout functionality.
|
|
6
|
-
*
|
|
7
|
-
* ## Session Validation Strategies
|
|
8
|
-
*
|
|
9
|
-
* When using a session store, you can configure when sessions are validated:
|
|
10
|
-
*
|
|
11
|
-
* ### 'always' (default)
|
|
12
|
-
* Validates session on every authenticated request.
|
|
13
|
-
* - **Security**: Maximum - immediate session revocation
|
|
14
|
-
* - **Performance**: InMemory ~0.00005ms, Redis ~1-2ms per request
|
|
15
|
-
* - **Backchannel Logout**: Takes effect immediately
|
|
16
|
-
* - **Use when**: Security is paramount, using InMemory or Redis backend
|
|
17
|
-
*
|
|
18
|
-
* ### 'refresh-only'
|
|
19
|
-
* Validates session only during token refresh (typically every 5-15 minutes).
|
|
20
|
-
* - **Security**: Good - 5-15 minute revocation window
|
|
21
|
-
* - **Performance**: 99% reduction in session lookups
|
|
22
|
-
* - **Backchannel Logout**: Takes effect within token TTL (5-15 min)
|
|
23
|
-
* - **Use when**: Performance is critical AND delayed revocation is acceptable
|
|
24
|
-
* - **WARNING**: Compromised sessions remain valid until next refresh
|
|
25
|
-
*
|
|
26
|
-
* ### 'disabled'
|
|
27
|
-
* Never validates sessions against the store.
|
|
28
|
-
* - **Security**: None - backchannel logout doesn't work
|
|
29
|
-
* - **Performance**: No overhead
|
|
30
|
-
* - **Use when**: Cookie-only mode without session store
|
|
31
|
-
* - **WARNING**: Do not use with session_store configured
|
|
32
|
-
*
|
|
33
|
-
* ## Performance Characteristics
|
|
34
|
-
*
|
|
35
|
-
* | Backend | Lookup Time | Impact on Request | Recommendation |
|
|
36
|
-
* |--------------|-------------|-------------------|------------------------|
|
|
37
|
-
* | InMemory | <0.00005ms | Negligible | Use 'always' |
|
|
38
|
-
* | Redis | 1-2ms | 2-4% increase | Use 'always' or test |
|
|
39
|
-
* | Database | 5-20ms | 10-40% increase | Use Redis cache layer |
|
|
40
|
-
*
|
|
41
|
-
* ## Example Usage
|
|
42
|
-
*
|
|
43
|
-
* ```typescript
|
|
44
|
-
* import { sso, InMemorySessionStore } from '@enterprisestandard/react/server';
|
|
45
|
-
*
|
|
46
|
-
* // Maximum security (default)
|
|
47
|
-
* const secure = sso({
|
|
48
|
-
* // ... other config
|
|
49
|
-
* session_store: new InMemorySessionStore(),
|
|
50
|
-
* session_validation: 'always', // Immediate revocation
|
|
51
|
-
* });
|
|
52
|
-
*
|
|
53
|
-
* // High performance
|
|
54
|
-
* const fast = sso({
|
|
55
|
-
* // ... other config
|
|
56
|
-
* session_store: new InMemorySessionStore(),
|
|
57
|
-
* session_validation: {
|
|
58
|
-
* strategy: 'refresh-only' // 5-15 min revocation delay
|
|
59
|
-
* }
|
|
60
|
-
* });
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
/**
|
|
64
|
-
* Core session data tracked for each authenticated user session.
|
|
65
|
-
*
|
|
66
|
-
* @template TExtended - Type-safe custom data that consumers can add to sessions
|
|
67
|
-
*/
|
|
68
|
-
export type Session<TExtended = {}> = {
|
|
69
|
-
/**
|
|
70
|
-
* Session ID from the Identity Provider (from `sid` claim in ID token).
|
|
71
|
-
* This is the unique identifier for the session.
|
|
72
|
-
*/
|
|
73
|
-
sid: string;
|
|
74
|
-
/**
|
|
75
|
-
* Subject identifier (user ID) from the Identity Provider.
|
|
76
|
-
* From the `sub` claim in the ID token.
|
|
77
|
-
*/
|
|
78
|
-
sub: string;
|
|
79
|
-
/**
|
|
80
|
-
* Timestamp when the session was created.
|
|
81
|
-
*/
|
|
82
|
-
createdAt: Date;
|
|
83
|
-
/**
|
|
84
|
-
* Timestamp of the last activity in this session.
|
|
85
|
-
* Can be updated to track session activity.
|
|
86
|
-
*/
|
|
87
|
-
lastActivityAt: Date;
|
|
88
|
-
/**
|
|
89
|
-
* Allow consumers to add runtime data to sessions.
|
|
90
|
-
*/
|
|
91
|
-
[key: string]: unknown;
|
|
92
|
-
} & TExtended;
|
|
93
|
-
/**
|
|
94
|
-
* Abstract interface for session storage backends.
|
|
95
|
-
*
|
|
96
|
-
* Consumers can implement this interface to use different storage backends:
|
|
97
|
-
* - Redis
|
|
98
|
-
* - Database (PostgreSQL, MySQL, etc.)
|
|
99
|
-
* - Distributed cache
|
|
100
|
-
* - Custom solutions
|
|
101
|
-
*
|
|
102
|
-
* @template TExtended - Type-safe custom data that consumers can add to sessions
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```typescript
|
|
106
|
-
* // Custom session data
|
|
107
|
-
* type MySessionData = {
|
|
108
|
-
* ipAddress: string;
|
|
109
|
-
* userAgent: string;
|
|
110
|
-
* };
|
|
111
|
-
*
|
|
112
|
-
* // Implement custom store
|
|
113
|
-
* class RedisSessionStore implements SessionStore<MySessionData> {
|
|
114
|
-
* async create(session: Session<MySessionData>): Promise<void> {
|
|
115
|
-
* await redis.set(`session:${session.sid}`, JSON.stringify(session));
|
|
116
|
-
* }
|
|
117
|
-
* // ... other methods
|
|
118
|
-
* }
|
|
119
|
-
* ```
|
|
120
|
-
*/
|
|
121
|
-
export interface SessionStore<TExtended = {}> {
|
|
122
|
-
/**
|
|
123
|
-
* Create a new session in the store.
|
|
124
|
-
*
|
|
125
|
-
* @param session - The session data to store
|
|
126
|
-
* @throws Error if session with same sid already exists
|
|
127
|
-
*/
|
|
128
|
-
create(session: Session<TExtended>): Promise<void>;
|
|
129
|
-
/**
|
|
130
|
-
* Retrieve a session by its IdP session ID (sid).
|
|
131
|
-
*
|
|
132
|
-
* @param sid - The session.sid from the Identity Provider
|
|
133
|
-
* @returns The session if found, null otherwise
|
|
134
|
-
*/
|
|
135
|
-
get(sid: string): Promise<Session<TExtended> | null>;
|
|
136
|
-
/**
|
|
137
|
-
* Update an existing session with partial data.
|
|
138
|
-
*
|
|
139
|
-
* Commonly used to update lastActivityAt or add custom fields.
|
|
140
|
-
*
|
|
141
|
-
* @param sid - The session.sid to update
|
|
142
|
-
* @param data - Partial session data to merge
|
|
143
|
-
* @throws Error if session not found
|
|
144
|
-
*/
|
|
145
|
-
update(sid: string, data: Partial<Session<TExtended>>): Promise<void>;
|
|
146
|
-
/**
|
|
147
|
-
* Delete a session by its IdP session ID (sid).
|
|
148
|
-
*
|
|
149
|
-
* Used for both normal logout and backchannel logout flows.
|
|
150
|
-
*
|
|
151
|
-
* @param sid - The session.sid to delete
|
|
152
|
-
*/
|
|
153
|
-
delete(sid: string): Promise<void>;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* In-memory session store implementation using Maps.
|
|
157
|
-
*
|
|
158
|
-
* Suitable for:
|
|
159
|
-
* - Development and testing
|
|
160
|
-
* - Single-server deployments
|
|
161
|
-
* - Applications without high availability requirements
|
|
162
|
-
*
|
|
163
|
-
* NOT suitable for:
|
|
164
|
-
* - Multi-server deployments (sessions not shared)
|
|
165
|
-
* - High availability scenarios (sessions lost on restart)
|
|
166
|
-
* - Production applications with distributed architecture
|
|
167
|
-
*
|
|
168
|
-
* For production, implement SessionStore with Redis or a database.
|
|
169
|
-
*
|
|
170
|
-
* @template TExtended - Type-safe custom data that consumers can add to sessions
|
|
171
|
-
*/
|
|
172
|
-
export declare class InMemorySessionStore<TExtended = {}> implements SessionStore<TExtended> {
|
|
173
|
-
private sessions;
|
|
174
|
-
create(session: Session<TExtended>): Promise<void>;
|
|
175
|
-
get(sid: string): Promise<Session<TExtended> | null>;
|
|
176
|
-
update(sid: string, data: Partial<Session<TExtended>>): Promise<void>;
|
|
177
|
-
delete(sid: string): Promise<void>;
|
|
178
|
-
}
|
|
179
|
-
//# sourceMappingURL=session-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../src/session-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH;;;;GAIG;AACH,MAAM,MAAM,OAAO,CAAC,SAAS,GAAG,EAAE,IAAI;IACpC;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAEhB;;;OAGG;IACH,cAAc,EAAE,IAAI,CAAC;IAErB;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,GAA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4
|
-
* Session stores are optional - the package works with JWT cookies alone.
|
|
5
|
-
* Sessions are only required for backchannel logout functionality.
|
|
6
|
-
*
|
|
7
|
-
* ## Session Validation Strategies
|
|
8
|
-
*
|
|
9
|
-
* When using a session store, you can configure when sessions are validated:
|
|
10
|
-
*
|
|
11
|
-
* ### 'always' (default)
|
|
12
|
-
* Validates session on every authenticated request.
|
|
13
|
-
* - **Security**: Maximum - immediate session revocation
|
|
14
|
-
* - **Performance**: InMemory ~0.00005ms, Redis ~1-2ms per request
|
|
15
|
-
* - **Backchannel Logout**: Takes effect immediately
|
|
16
|
-
* - **Use when**: Security is paramount, using InMemory or Redis backend
|
|
17
|
-
*
|
|
18
|
-
* ### 'refresh-only'
|
|
19
|
-
* Validates session only during token refresh (typically every 5-15 minutes).
|
|
20
|
-
* - **Security**: Good - 5-15 minute revocation window
|
|
21
|
-
* - **Performance**: 99% reduction in session lookups
|
|
22
|
-
* - **Backchannel Logout**: Takes effect within token TTL (5-15 min)
|
|
23
|
-
* - **Use when**: Performance is critical AND delayed revocation is acceptable
|
|
24
|
-
* - **WARNING**: Compromised sessions remain valid until next refresh
|
|
25
|
-
*
|
|
26
|
-
* ### 'disabled'
|
|
27
|
-
* Never validates sessions against the store.
|
|
28
|
-
* - **Security**: None - backchannel logout doesn't work
|
|
29
|
-
* - **Performance**: No overhead
|
|
30
|
-
* - **Use when**: Cookie-only mode without session store
|
|
31
|
-
* - **WARNING**: Do not use with session_store configured
|
|
32
|
-
*
|
|
33
|
-
* ## Performance Characteristics
|
|
34
|
-
*
|
|
35
|
-
* | Backend | Lookup Time | Impact on Request | Recommendation |
|
|
36
|
-
* |--------------|-------------|-------------------|------------------------|
|
|
37
|
-
* | InMemory | <0.00005ms | Negligible | Use 'always' |
|
|
38
|
-
* | Redis | 1-2ms | 2-4% increase | Use 'always' or test |
|
|
39
|
-
* | Database | 5-20ms | 10-40% increase | Use Redis cache layer |
|
|
40
|
-
*
|
|
41
|
-
* ## Example Usage
|
|
42
|
-
*
|
|
43
|
-
* ```typescript
|
|
44
|
-
* import { sso, InMemorySessionStore } from '@enterprisestandard/react/server';
|
|
45
|
-
*
|
|
46
|
-
* // Maximum security (default)
|
|
47
|
-
* const secure = sso({
|
|
48
|
-
* // ... other config
|
|
49
|
-
* session_store: new InMemorySessionStore(),
|
|
50
|
-
* session_validation: 'always', // Immediate revocation
|
|
51
|
-
* });
|
|
52
|
-
*
|
|
53
|
-
* // High performance
|
|
54
|
-
* const fast = sso({
|
|
55
|
-
* // ... other config
|
|
56
|
-
* session_store: new InMemorySessionStore(),
|
|
57
|
-
* session_validation: {
|
|
58
|
-
* strategy: 'refresh-only' // 5-15 min revocation delay
|
|
59
|
-
* }
|
|
60
|
-
* });
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
/**
|
|
64
|
-
* In-memory session store implementation using Maps.
|
|
65
|
-
*
|
|
66
|
-
* Suitable for:
|
|
67
|
-
* - Development and testing
|
|
68
|
-
* - Single-server deployments
|
|
69
|
-
* - Applications without high availability requirements
|
|
70
|
-
*
|
|
71
|
-
* NOT suitable for:
|
|
72
|
-
* - Multi-server deployments (sessions not shared)
|
|
73
|
-
* - High availability scenarios (sessions lost on restart)
|
|
74
|
-
* - Production applications with distributed architecture
|
|
75
|
-
*
|
|
76
|
-
* For production, implement SessionStore with Redis or a database.
|
|
77
|
-
*
|
|
78
|
-
* @template TExtended - Type-safe custom data that consumers can add to sessions
|
|
79
|
-
*/
|
|
80
|
-
export class InMemorySessionStore {
|
|
81
|
-
constructor() {
|
|
82
|
-
this.sessions = new Map();
|
|
83
|
-
}
|
|
84
|
-
async create(session) {
|
|
85
|
-
if (this.sessions.has(session.sid)) {
|
|
86
|
-
throw new Error(`Session with sid ${session.sid} already exists`);
|
|
87
|
-
}
|
|
88
|
-
this.sessions.set(session.sid, session);
|
|
89
|
-
}
|
|
90
|
-
async get(sid) {
|
|
91
|
-
return this.sessions.get(sid) ?? null;
|
|
92
|
-
}
|
|
93
|
-
async update(sid, data) {
|
|
94
|
-
const session = this.sessions.get(sid);
|
|
95
|
-
if (!session) {
|
|
96
|
-
throw new Error(`Session with sid ${sid} not found`);
|
|
97
|
-
}
|
|
98
|
-
// Merge the update data
|
|
99
|
-
const updated = { ...session, ...data };
|
|
100
|
-
this.sessions.set(sid, updated);
|
|
101
|
-
}
|
|
102
|
-
async delete(sid) {
|
|
103
|
-
this.sessions.delete(sid);
|
|
104
|
-
}
|
|
105
|
-
}
|
package/dist/sso-server.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { EnterpriseStandard } from '.';
|
|
2
|
-
import type { LoginConfig } from './sso';
|
|
3
|
-
/**
|
|
4
|
-
* Helper gets the user from the Request using the supplied EnterpriseStandard or the default instance
|
|
5
|
-
*/
|
|
6
|
-
export declare function getUser(request: Request, es?: EnterpriseStandard): Promise<import(".").User | undefined>;
|
|
7
|
-
export declare function getRequiredUser(request: Request, es?: EnterpriseStandard): Promise<import(".").User>;
|
|
8
|
-
export declare function initiateLogin(config: LoginConfig, es?: EnterpriseStandard): Promise<Response>;
|
|
9
|
-
export declare function callback(request: Request, es?: EnterpriseStandard): Promise<Response>;
|
|
10
|
-
export declare function handler(request: Request, es?: EnterpriseStandard): Promise<Response>;
|
|
11
|
-
export * from './tenant-server';
|
|
12
|
-
export * from './workload-server';
|
|
13
|
-
//# sourceMappingURL=sso-server.d.ts.map
|
package/dist/sso-server.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sso-server.d.ts","sourceRoot":"","sources":["../src/sso-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,GAAG,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAezC;;GAEG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,kBAAkB,yCAEtE;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,kBAAkB,6BAI9E;AAED,wBAAsB,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,EAAE,kBAAkB,qBAI/E;AAED,wBAAsB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,kBAAkB,qBAIvE;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,kBAAkB,qBAItE;AAGD,cAAc,iBAAiB,CAAC;AAEhC,cAAc,mBAAmB,CAAC"}
|
package/dist/sso-server.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { getES } from './utils.js';
|
|
2
|
-
/**
|
|
3
|
-
* Returns a 503 response indicating that the SSO is unavailable
|
|
4
|
-
*/
|
|
5
|
-
function unavailable(error) {
|
|
6
|
-
error = error ?? 'SSO Unavailable';
|
|
7
|
-
new Response(JSON.stringify({ error }), {
|
|
8
|
-
status: 503,
|
|
9
|
-
statusText: error,
|
|
10
|
-
headers: { 'Content-Type': 'application/json' },
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Helper gets the user from the Request using the supplied EnterpriseStandard or the default instance
|
|
15
|
-
*/
|
|
16
|
-
export async function getUser(request, es) {
|
|
17
|
-
return getES(es)?.sso.getUser(request);
|
|
18
|
-
}
|
|
19
|
-
export async function getRequiredUser(request, es) {
|
|
20
|
-
const sso = getES(es)?.sso;
|
|
21
|
-
if (!sso)
|
|
22
|
-
throw unavailable();
|
|
23
|
-
return sso.getRequiredUser(request);
|
|
24
|
-
}
|
|
25
|
-
export async function initiateLogin(config, es) {
|
|
26
|
-
const sso = getES(es)?.sso;
|
|
27
|
-
if (!sso)
|
|
28
|
-
throw unavailable();
|
|
29
|
-
return sso.initiateLogin(config);
|
|
30
|
-
}
|
|
31
|
-
export async function callback(request, es) {
|
|
32
|
-
const sso = getES(es)?.sso;
|
|
33
|
-
if (!sso)
|
|
34
|
-
throw unavailable();
|
|
35
|
-
return sso.callbackHandler(request);
|
|
36
|
-
}
|
|
37
|
-
export async function handler(request, es) {
|
|
38
|
-
es = getES(es);
|
|
39
|
-
if (!es)
|
|
40
|
-
throw unavailable();
|
|
41
|
-
return es.sso.handler(request, es);
|
|
42
|
-
}
|
|
43
|
-
// Tenant server helpers
|
|
44
|
-
export * from './tenant-server.js';
|
|
45
|
-
// Workload server helpers
|
|
46
|
-
export * from './workload-server.js';
|
package/dist/sso.d.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import type { EnterpriseStandard } from '.';
|
|
2
|
-
import type { SessionStore } from './session-store';
|
|
3
|
-
import type { IdTokenClaims, OidcCallbackParams, TokenResponse } from './types/oidc-schema';
|
|
4
|
-
import type { StandardSchemaV1 } from './types/standard-schema';
|
|
5
|
-
import type { User } from './types/user';
|
|
6
|
-
import type { UserStore } from './user-store';
|
|
7
|
-
export type SSOConfig<TSessionData = {}, TUserData = {}> = {
|
|
8
|
-
authority?: string;
|
|
9
|
-
token_url?: string;
|
|
10
|
-
authorization_url?: string;
|
|
11
|
-
client_id?: string;
|
|
12
|
-
client_secret?: string;
|
|
13
|
-
redirect_uri?: string;
|
|
14
|
-
response_type?: 'code';
|
|
15
|
-
scope?: string;
|
|
16
|
-
silent_redirect_uri?: string;
|
|
17
|
-
jwks_uri?: string;
|
|
18
|
-
cookies_prefix?: string;
|
|
19
|
-
cookies_path?: string;
|
|
20
|
-
cookies_secure?: boolean;
|
|
21
|
-
cookies_same_site?: 'Strict' | 'Lax';
|
|
22
|
-
end_session_endpoint?: string;
|
|
23
|
-
revocation_endpoint?: string;
|
|
24
|
-
session_store?: SessionStore<TSessionData>;
|
|
25
|
-
/**
|
|
26
|
-
* Optional handler defaults. These are merged with per-call overrides in
|
|
27
|
-
* `sso.handler`, with per-call values taking precedence.
|
|
28
|
-
*/
|
|
29
|
-
loginUrl?: string;
|
|
30
|
-
userUrl?: string;
|
|
31
|
-
errorUrl?: string;
|
|
32
|
-
landingUrl?: string;
|
|
33
|
-
tokenUrl?: string;
|
|
34
|
-
refreshUrl?: string;
|
|
35
|
-
jwksUrl?: string;
|
|
36
|
-
logoutUrl?: string;
|
|
37
|
-
logoutBackChannelUrl?: string;
|
|
38
|
-
validation?: {
|
|
39
|
-
callbackParams?: StandardSchemaV1<unknown, OidcCallbackParams>;
|
|
40
|
-
idTokenClaims?: StandardSchemaV1<unknown, IdTokenClaims>;
|
|
41
|
-
tokenResponse?: StandardSchemaV1<unknown, TokenResponse>;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Optional user store for persisting user profiles from SSO authentication.
|
|
45
|
-
* When configured, users are automatically stored/updated on each login.
|
|
46
|
-
*/
|
|
47
|
-
user_store?: UserStore<TUserData>;
|
|
48
|
-
/**
|
|
49
|
-
* Enable Just-In-Time (JIT) user provisioning.
|
|
50
|
-
* When enabled, new users are automatically created in the user_store on their first login.
|
|
51
|
-
* When disabled (default), only existing users in the user_store are updated on login.
|
|
52
|
-
* Requires user_store to be configured.
|
|
53
|
-
* @default false
|
|
54
|
-
*/
|
|
55
|
-
enable_jit_user_provisioning?: boolean;
|
|
56
|
-
};
|
|
57
|
-
type SSOConfigWithDefaults<TSessionData = {}, TUserData = {}> = SSOConfig<TSessionData, TUserData> & {
|
|
58
|
-
authority: string;
|
|
59
|
-
token_url: string;
|
|
60
|
-
authorization_url: string;
|
|
61
|
-
client_id: string;
|
|
62
|
-
redirect_uri: string;
|
|
63
|
-
response_type: 'code';
|
|
64
|
-
scope: string;
|
|
65
|
-
cookies_secure: boolean;
|
|
66
|
-
cookies_same_site: string;
|
|
67
|
-
cookies_prefix: string;
|
|
68
|
-
cookies_path: string;
|
|
69
|
-
};
|
|
70
|
-
export type ESConfig = {
|
|
71
|
-
es?: EnterpriseStandard;
|
|
72
|
-
};
|
|
73
|
-
export type LoginConfig = {
|
|
74
|
-
landingUrl: string;
|
|
75
|
-
errorUrl?: string;
|
|
76
|
-
} & ESConfig;
|
|
77
|
-
export type SSOHandlerConfig = {
|
|
78
|
-
loginUrl?: string;
|
|
79
|
-
userUrl?: string;
|
|
80
|
-
errorUrl?: string;
|
|
81
|
-
landingUrl?: string;
|
|
82
|
-
tokenUrl?: string;
|
|
83
|
-
refreshUrl?: string;
|
|
84
|
-
jwksUrl?: string;
|
|
85
|
-
logoutUrl?: string;
|
|
86
|
-
logoutBackChannelUrl?: string;
|
|
87
|
-
validation?: {
|
|
88
|
-
callbackParams?: StandardSchemaV1<unknown, OidcCallbackParams>;
|
|
89
|
-
idTokenClaims?: StandardSchemaV1<unknown, IdTokenClaims>;
|
|
90
|
-
tokenResponse?: StandardSchemaV1<unknown, TokenResponse>;
|
|
91
|
-
};
|
|
92
|
-
} & ESConfig;
|
|
93
|
-
export type SSO<TSessionData = {}, TUserData = {}> = SSOConfigWithDefaults<TSessionData, TUserData> & {
|
|
94
|
-
getUser: (request: Request) => Promise<User | undefined>;
|
|
95
|
-
getRequiredUser: (request: Request) => Promise<User>;
|
|
96
|
-
getJwt: (request: Request) => Promise<string | undefined>;
|
|
97
|
-
initiateLogin: (config: LoginConfig, requestUrl?: string) => Promise<Response>;
|
|
98
|
-
logout: (request: Request, config?: LoginConfig) => Promise<Response>;
|
|
99
|
-
callbackHandler: (request: Request) => Promise<Response>;
|
|
100
|
-
handler: (request: Request, es?: EnterpriseStandard) => Promise<Response>;
|
|
101
|
-
};
|
|
102
|
-
export declare function sso<TSessionData = {}, TUserData = {}>(config?: SSOConfig<TSessionData, TUserData>): SSO<TSessionData, TUserData>;
|
|
103
|
-
export {};
|
|
104
|
-
//# sourceMappingURL=sso.d.ts.map
|
package/dist/sso.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sso.d.ts","sourceRoot":"","sources":["../src/sso.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,GAAG,CAAC;AAC5C,OAAO,KAAK,EAAW,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