@principal-ai/control-tower-core 0.1.2 → 0.1.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/dist/abstractions/AuthAdapter.d.ts +8 -5
- package/dist/abstractions/AuthAdapter.d.ts.map +1 -1
- package/dist/adapters/mock/MockAuthAdapter.d.ts +4 -1
- package/dist/adapters/mock/MockAuthAdapter.d.ts.map +1 -1
- package/dist/adapters/mock/MockAuthAdapter.js +57 -13
- package/dist/adapters/websocket/WebSocketTransportAdapter.d.ts +20 -0
- package/dist/adapters/websocket/WebSocketTransportAdapter.d.ts.map +1 -1
- package/dist/adapters/websocket/WebSocketTransportAdapter.js +195 -19
- package/dist/adapters/websocket/index.d.ts +1 -1
- package/dist/adapters/websocket/index.d.ts.map +1 -1
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.js +4 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +6 -6
- package/dist/server/BaseServer.d.ts +2 -0
- package/dist/server/BaseServer.d.ts.map +1 -1
- package/dist/server/BaseServer.js +48 -0
- package/dist/types/auth.d.ts +14 -7
- package/dist/types/auth.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type { TokenPayload, AuthResult, Credentials } from '../types';
|
|
1
|
+
import type { TokenPayload, AuthResult, Credentials, CredentialType } from '../types';
|
|
2
2
|
export interface IAuthAdapter {
|
|
3
|
-
validateToken(token: string): Promise<TokenPayload>;
|
|
4
|
-
generateToken(payload: TokenPayload): Promise<string>;
|
|
5
|
-
refreshToken(token: string): Promise<string>;
|
|
6
|
-
revokeToken(token: string): Promise<void>;
|
|
7
3
|
authenticate(credentials: Credentials): Promise<AuthResult>;
|
|
4
|
+
validateToken(token: string): Promise<TokenPayload>;
|
|
5
|
+
generateToken?(payload: TokenPayload): Promise<string>;
|
|
6
|
+
refreshToken?(token: string): Promise<string>;
|
|
7
|
+
revokeToken?(token: string): Promise<void>;
|
|
8
|
+
isAuthRequired?(): boolean;
|
|
9
|
+
getAuthTimeout?(): number;
|
|
10
|
+
getSupportedCredentialTypes?(): CredentialType[];
|
|
8
11
|
}
|
|
9
12
|
//# sourceMappingURL=AuthAdapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthAdapter.d.ts","sourceRoot":"","sources":["../../src/abstractions/AuthAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,WAAW,
|
|
1
|
+
{"version":3,"file":"AuthAdapter.d.ts","sourceRoot":"","sources":["../../src/abstractions/AuthAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,YAAY;IAE3B,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAG5D,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACpD,aAAa,CAAC,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvD,YAAY,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,WAAW,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAG3C,cAAc,CAAC,IAAI,OAAO,CAAC;IAC3B,cAAc,CAAC,IAAI,MAAM,CAAC;IAC1B,2BAA2B,CAAC,IAAI,cAAc,EAAE,CAAC;CAClD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IAuthAdapter } from '../../abstractions/AuthAdapter';
|
|
2
|
-
import type { TokenPayload, AuthResult, Credentials } from '../../types';
|
|
2
|
+
import type { TokenPayload, AuthResult, Credentials, CredentialType } from '../../types';
|
|
3
3
|
export declare class MockAuthAdapter implements IAuthAdapter {
|
|
4
4
|
private tokens;
|
|
5
5
|
private revokedTokens;
|
|
@@ -16,6 +16,9 @@ export declare class MockAuthAdapter implements IAuthAdapter {
|
|
|
16
16
|
refreshToken(token: string): Promise<string>;
|
|
17
17
|
revokeToken(token: string): Promise<void>;
|
|
18
18
|
authenticate(credentials: Credentials): Promise<AuthResult>;
|
|
19
|
+
isAuthRequired(): boolean;
|
|
20
|
+
getAuthTimeout(): number;
|
|
21
|
+
getSupportedCredentialTypes(): CredentialType[];
|
|
19
22
|
private simulateDelay;
|
|
20
23
|
addUser(username: string, password: string, payload: TokenPayload): void;
|
|
21
24
|
removeUser(username: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MockAuthAdapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/mock/MockAuthAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,WAAW,
|
|
1
|
+
{"version":3,"file":"MockAuthAdapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/mock/MockAuthAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,cAAc,EACf,MAAM,aAAa,CAAC;AAErB,qBAAa,eAAgB,YAAW,YAAY;IAClD,OAAO,CAAC,MAAM,CAAwC;IACtD,OAAO,CAAC,aAAa,CAA0B;IAC/C,OAAO,CAAC,KAAK,CAAuE;IACpF,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,YAAY,CAAa;gBAErB,OAAO,CAAC,EAAE;QACpB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B;IAoBK,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAyBnD,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBrD,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAqB5C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWzC,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAwGjE,cAAc,IAAI,OAAO;IAIzB,cAAc,IAAI,MAAM;IAIxB,2BAA2B,IAAI,cAAc,EAAE;YAKjC,aAAa;IAM3B,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI;IAIxE,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAIlC,aAAa,IAAI,MAAM;IAIvB,oBAAoB,IAAI,MAAM;IAI9B,WAAW,IAAI,IAAI;IAKnB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;CAGjC"}
|
|
@@ -78,42 +78,71 @@ export class MockAuthAdapter {
|
|
|
78
78
|
async authenticate(credentials) {
|
|
79
79
|
await this.simulateDelay();
|
|
80
80
|
if (this.shouldFailAuth) {
|
|
81
|
-
|
|
81
|
+
return {
|
|
82
|
+
success: false,
|
|
83
|
+
error: 'Mock authentication failed'
|
|
84
|
+
};
|
|
82
85
|
}
|
|
83
86
|
switch (credentials.type) {
|
|
84
87
|
case 'password': {
|
|
85
88
|
if (!credentials.username || !credentials.password) {
|
|
86
|
-
|
|
89
|
+
return {
|
|
90
|
+
success: false,
|
|
91
|
+
error: 'Username and password required'
|
|
92
|
+
};
|
|
87
93
|
}
|
|
88
94
|
const user = this.users.get(credentials.username);
|
|
89
95
|
if (!user || user.password !== credentials.password) {
|
|
90
|
-
|
|
96
|
+
return {
|
|
97
|
+
success: false,
|
|
98
|
+
error: 'Invalid credentials'
|
|
99
|
+
};
|
|
91
100
|
}
|
|
92
101
|
const token = await this.generateToken(user.payload);
|
|
93
102
|
const refreshToken = `refresh-${token}`;
|
|
94
103
|
this.tokens.set(refreshToken, user.payload);
|
|
95
104
|
return {
|
|
105
|
+
success: true,
|
|
96
106
|
token,
|
|
97
107
|
refreshToken,
|
|
98
108
|
user: user.payload,
|
|
109
|
+
userId: user.payload.userId,
|
|
99
110
|
expiresIn: 3600
|
|
100
111
|
};
|
|
101
112
|
}
|
|
102
|
-
case 'token':
|
|
113
|
+
case 'token':
|
|
114
|
+
case 'jwt':
|
|
115
|
+
case 'bearer': {
|
|
103
116
|
if (!credentials.token) {
|
|
104
|
-
|
|
117
|
+
return {
|
|
118
|
+
success: false,
|
|
119
|
+
error: 'Token required'
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
const payload = await this.validateToken(credentials.token);
|
|
124
|
+
return {
|
|
125
|
+
success: true,
|
|
126
|
+
token: credentials.token,
|
|
127
|
+
user: payload,
|
|
128
|
+
userId: payload.userId,
|
|
129
|
+
expiresIn: 3600
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
return {
|
|
134
|
+
success: false,
|
|
135
|
+
error: error.message
|
|
136
|
+
};
|
|
105
137
|
}
|
|
106
|
-
const payload = await this.validateToken(credentials.token);
|
|
107
|
-
return {
|
|
108
|
-
token: credentials.token,
|
|
109
|
-
user: payload,
|
|
110
|
-
expiresIn: 3600
|
|
111
|
-
};
|
|
112
138
|
}
|
|
113
139
|
case 'oauth': {
|
|
114
140
|
// Simulate OAuth flow
|
|
115
141
|
if (!credentials.code) {
|
|
116
|
-
|
|
142
|
+
return {
|
|
143
|
+
success: false,
|
|
144
|
+
error: 'OAuth code required'
|
|
145
|
+
};
|
|
117
146
|
}
|
|
118
147
|
// Create a mock OAuth user
|
|
119
148
|
const payload = {
|
|
@@ -124,15 +153,30 @@ export class MockAuthAdapter {
|
|
|
124
153
|
};
|
|
125
154
|
const token = await this.generateToken(payload);
|
|
126
155
|
return {
|
|
156
|
+
success: true,
|
|
127
157
|
token,
|
|
128
158
|
user: payload,
|
|
159
|
+
userId: payload.userId,
|
|
129
160
|
expiresIn: 3600
|
|
130
161
|
};
|
|
131
162
|
}
|
|
132
163
|
default:
|
|
133
|
-
|
|
164
|
+
return {
|
|
165
|
+
success: false,
|
|
166
|
+
error: 'Unsupported credential type'
|
|
167
|
+
};
|
|
134
168
|
}
|
|
135
169
|
}
|
|
170
|
+
// New methods for enhanced auth interface
|
|
171
|
+
isAuthRequired() {
|
|
172
|
+
return false; // Mock adapter doesn't require auth by default
|
|
173
|
+
}
|
|
174
|
+
getAuthTimeout() {
|
|
175
|
+
return 10000; // 10 seconds for testing
|
|
176
|
+
}
|
|
177
|
+
getSupportedCredentialTypes() {
|
|
178
|
+
return ['password', 'token', 'jwt', 'bearer', 'oauth'];
|
|
179
|
+
}
|
|
136
180
|
// Test helper methods
|
|
137
181
|
async simulateDelay() {
|
|
138
182
|
if (this.simulateLatency > 0) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ITransportAdapter } from '../../abstractions/TransportAdapter';
|
|
2
|
+
import type { IAuthAdapter } from '../../abstractions/AuthAdapter';
|
|
2
3
|
import type { ConnectionState, ConnectionOptions, Message, MessageHandler, ErrorHandler, CloseHandler } from '../../types';
|
|
3
4
|
import type { Server as HttpServer } from 'http';
|
|
4
5
|
import type { Server as HttpsServer } from 'https';
|
|
@@ -7,6 +8,15 @@ interface ClientConnection {
|
|
|
7
8
|
id: string;
|
|
8
9
|
ws: WebSocket;
|
|
9
10
|
userId?: string;
|
|
11
|
+
authenticated: boolean;
|
|
12
|
+
metadata?: Record<string, unknown>;
|
|
13
|
+
authTimeout?: NodeJS.Timeout;
|
|
14
|
+
connectedAt: number;
|
|
15
|
+
}
|
|
16
|
+
export interface WebSocketTransportConfig {
|
|
17
|
+
authTimeout?: number;
|
|
18
|
+
closeOnAuthFailure?: boolean;
|
|
19
|
+
requireAuth?: boolean;
|
|
10
20
|
}
|
|
11
21
|
export declare class WebSocketTransportAdapter implements ITransportAdapter {
|
|
12
22
|
private state;
|
|
@@ -20,10 +30,18 @@ export declare class WebSocketTransportAdapter implements ITransportAdapter {
|
|
|
20
30
|
private webSocketPath?;
|
|
21
31
|
private clients;
|
|
22
32
|
private mode;
|
|
33
|
+
private authAdapter?;
|
|
34
|
+
private config;
|
|
35
|
+
constructor(config?: WebSocketTransportConfig);
|
|
36
|
+
setAuthAdapter(auth: IAuthAdapter): void;
|
|
23
37
|
connect(url: string, _options?: ConnectionOptions): Promise<void>;
|
|
24
38
|
attach(server: HttpServer | HttpsServer, path?: string): Promise<void>;
|
|
25
39
|
attachToWebSocketServer(wss: WebSocketServer): Promise<void>;
|
|
26
40
|
private handleConnection;
|
|
41
|
+
private handleClientMessage;
|
|
42
|
+
private handleAuthMessage;
|
|
43
|
+
private extractBearerToken;
|
|
44
|
+
private sendToClient;
|
|
27
45
|
disconnect(): Promise<void>;
|
|
28
46
|
send(message: Message): Promise<void>;
|
|
29
47
|
onMessage(handler: MessageHandler): void;
|
|
@@ -32,8 +50,10 @@ export declare class WebSocketTransportAdapter implements ITransportAdapter {
|
|
|
32
50
|
getState(): ConnectionState;
|
|
33
51
|
isConnected(): boolean;
|
|
34
52
|
getConnectedClients(): ClientConnection[];
|
|
53
|
+
getAuthenticatedClients(): ClientConnection[];
|
|
35
54
|
getClientCount(): number;
|
|
36
55
|
getMode(): 'standalone' | 'integration';
|
|
56
|
+
isAuthRequired(): boolean;
|
|
37
57
|
private generateId;
|
|
38
58
|
}
|
|
39
59
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebSocketTransportAdapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/websocket/WebSocketTransportAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,YAAY,
|
|
1
|
+
{"version":3,"file":"WebSocketTransportAdapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/websocket/WebSocketTransportAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,YAAY,EAGb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAEhD,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,SAAS,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,qBAAa,yBAA0B,YAAW,iBAAiB;IACjE,OAAO,CAAC,KAAK,CAAmC;IAChD,OAAO,CAAC,eAAe,CAAkC;IACzD,OAAO,CAAC,aAAa,CAAgC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B,OAAO,IAAI,YAAY,GAAG,aAAa;IAIvC,cAAc,IAAI,OAAO;IAIzB,OAAO,CAAC,UAAU;CAGnB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WebSocketServer, WebSocket } from 'ws';
|
|
2
2
|
export class WebSocketTransportAdapter {
|
|
3
|
-
constructor() {
|
|
3
|
+
constructor(config) {
|
|
4
4
|
this.state = 'disconnected';
|
|
5
5
|
this.messageHandlers = new Set();
|
|
6
6
|
this.errorHandlers = new Set();
|
|
@@ -8,6 +8,23 @@ export class WebSocketTransportAdapter {
|
|
|
8
8
|
// Client management
|
|
9
9
|
this.clients = new Map();
|
|
10
10
|
this.mode = 'standalone';
|
|
11
|
+
this.config = {
|
|
12
|
+
authTimeout: config?.authTimeout ?? 5000,
|
|
13
|
+
closeOnAuthFailure: config?.closeOnAuthFailure ?? false,
|
|
14
|
+
requireAuth: config?.requireAuth ?? false,
|
|
15
|
+
...config
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
// Set the auth adapter
|
|
19
|
+
setAuthAdapter(auth) {
|
|
20
|
+
this.authAdapter = auth;
|
|
21
|
+
// Update requireAuth based on auth adapter's preference
|
|
22
|
+
if (auth.isAuthRequired) {
|
|
23
|
+
this.config.requireAuth = auth.isAuthRequired();
|
|
24
|
+
}
|
|
25
|
+
if (auth.getAuthTimeout) {
|
|
26
|
+
this.config.authTimeout = auth.getAuthTimeout();
|
|
27
|
+
}
|
|
11
28
|
}
|
|
12
29
|
// Standalone mode implementation
|
|
13
30
|
async connect(url, _options) {
|
|
@@ -91,38 +108,188 @@ export class WebSocketTransportAdapter {
|
|
|
91
108
|
throw error;
|
|
92
109
|
}
|
|
93
110
|
}
|
|
94
|
-
handleConnection(ws, req) {
|
|
111
|
+
async handleConnection(ws, req) {
|
|
95
112
|
const clientId = this.generateId();
|
|
113
|
+
// Step 1: Try header authentication if auth adapter is available
|
|
114
|
+
let authenticated = false;
|
|
115
|
+
let authResult = null;
|
|
116
|
+
if (this.authAdapter && req.headers.authorization) {
|
|
117
|
+
const token = this.extractBearerToken(req.headers.authorization);
|
|
118
|
+
if (token) {
|
|
119
|
+
try {
|
|
120
|
+
authResult = await this.authAdapter.authenticate({
|
|
121
|
+
type: 'bearer',
|
|
122
|
+
token: token
|
|
123
|
+
});
|
|
124
|
+
authenticated = authResult.success;
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
// Header auth failed but don't reject connection
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// Step 2: Create client with auth state
|
|
96
132
|
const client = {
|
|
97
133
|
id: clientId,
|
|
98
134
|
ws,
|
|
99
|
-
|
|
135
|
+
authenticated,
|
|
136
|
+
userId: authResult?.userId || (authResult?.user?.userId),
|
|
137
|
+
metadata: authResult?.metadata || authResult?.user?.metadata,
|
|
138
|
+
connectedAt: Date.now()
|
|
100
139
|
};
|
|
101
140
|
this.clients.set(clientId, client);
|
|
141
|
+
// Step 3: Set up message handling
|
|
102
142
|
ws.on('message', (data) => {
|
|
103
|
-
|
|
104
|
-
const message = JSON.parse(data.toString());
|
|
105
|
-
// Add clientId to message payload for routing
|
|
106
|
-
const enrichedMessage = {
|
|
107
|
-
...message,
|
|
108
|
-
payload: {
|
|
109
|
-
...message.payload,
|
|
110
|
-
clientId
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
this.messageHandlers.forEach(handler => handler(enrichedMessage));
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
this.errorHandlers.forEach(handler => handler(error));
|
|
117
|
-
}
|
|
143
|
+
this.handleClientMessage(clientId, data);
|
|
118
144
|
});
|
|
119
145
|
ws.on('error', (error) => {
|
|
120
146
|
this.errorHandlers.forEach(handler => handler(error));
|
|
121
147
|
});
|
|
122
148
|
ws.on('close', (_code, _reason) => {
|
|
149
|
+
// Clear auth timeout if exists
|
|
150
|
+
if (client.authTimeout) {
|
|
151
|
+
clearTimeout(client.authTimeout);
|
|
152
|
+
}
|
|
123
153
|
this.clients.delete(clientId);
|
|
124
|
-
// Don't emit close for individual clients, only for server shutdown
|
|
125
154
|
});
|
|
155
|
+
// Step 4: Set auth timeout if not authenticated and auth is required
|
|
156
|
+
if (!authenticated && this.config.requireAuth && this.authAdapter) {
|
|
157
|
+
client.authTimeout = setTimeout(() => {
|
|
158
|
+
if (!client.authenticated) {
|
|
159
|
+
ws.close(1008, 'Authentication timeout');
|
|
160
|
+
this.clients.delete(clientId);
|
|
161
|
+
}
|
|
162
|
+
}, this.config.authTimeout);
|
|
163
|
+
}
|
|
164
|
+
// Step 5: Notify about connection (with auth status)
|
|
165
|
+
const connectionMessage = {
|
|
166
|
+
id: this.generateId(),
|
|
167
|
+
type: 'connection',
|
|
168
|
+
payload: {
|
|
169
|
+
clientId,
|
|
170
|
+
authenticated,
|
|
171
|
+
userId: client.userId,
|
|
172
|
+
metadata: client.metadata
|
|
173
|
+
},
|
|
174
|
+
timestamp: Date.now()
|
|
175
|
+
};
|
|
176
|
+
this.messageHandlers.forEach(handler => handler(connectionMessage));
|
|
177
|
+
}
|
|
178
|
+
async handleClientMessage(clientId, data) {
|
|
179
|
+
const client = this.clients.get(clientId);
|
|
180
|
+
if (!client)
|
|
181
|
+
return;
|
|
182
|
+
try {
|
|
183
|
+
const message = JSON.parse(data.toString());
|
|
184
|
+
// Special handling for authentication messages
|
|
185
|
+
if (message.type === 'authenticate' && !client.authenticated && this.authAdapter) {
|
|
186
|
+
await this.handleAuthMessage(client, message);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
// Reject messages from unauthenticated clients if auth is required
|
|
190
|
+
if (this.config.requireAuth && !client.authenticated) {
|
|
191
|
+
this.sendToClient(client, {
|
|
192
|
+
id: this.generateId(),
|
|
193
|
+
type: 'error',
|
|
194
|
+
payload: { error: 'Authentication required' },
|
|
195
|
+
timestamp: Date.now()
|
|
196
|
+
});
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
// Add clientId to message payload for routing
|
|
200
|
+
const enrichedMessage = {
|
|
201
|
+
...message,
|
|
202
|
+
payload: {
|
|
203
|
+
...message.payload,
|
|
204
|
+
clientId
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
this.messageHandlers.forEach(handler => handler(enrichedMessage));
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
this.errorHandlers.forEach(handler => handler(error));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
async handleAuthMessage(client, message) {
|
|
214
|
+
if (!this.authAdapter) {
|
|
215
|
+
this.sendToClient(client, {
|
|
216
|
+
id: this.generateId(),
|
|
217
|
+
type: 'auth_error',
|
|
218
|
+
payload: { error: 'No auth adapter configured' },
|
|
219
|
+
timestamp: Date.now()
|
|
220
|
+
});
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
try {
|
|
224
|
+
const credentials = message.payload;
|
|
225
|
+
const result = await this.authAdapter.authenticate(credentials);
|
|
226
|
+
if (result.success) {
|
|
227
|
+
// Clear auth timeout
|
|
228
|
+
if (client.authTimeout) {
|
|
229
|
+
clearTimeout(client.authTimeout);
|
|
230
|
+
client.authTimeout = undefined;
|
|
231
|
+
}
|
|
232
|
+
// Update client state
|
|
233
|
+
client.authenticated = true;
|
|
234
|
+
client.userId = result.userId || result.user?.userId;
|
|
235
|
+
client.metadata = result.metadata || result.user?.metadata;
|
|
236
|
+
// Send success response
|
|
237
|
+
this.sendToClient(client, {
|
|
238
|
+
id: this.generateId(),
|
|
239
|
+
type: 'auth_success',
|
|
240
|
+
payload: {
|
|
241
|
+
userId: client.userId,
|
|
242
|
+
metadata: client.metadata
|
|
243
|
+
},
|
|
244
|
+
timestamp: Date.now()
|
|
245
|
+
});
|
|
246
|
+
// Notify handlers about authentication
|
|
247
|
+
const authMessage = {
|
|
248
|
+
id: this.generateId(),
|
|
249
|
+
type: 'client_authenticated',
|
|
250
|
+
payload: {
|
|
251
|
+
clientId: client.id,
|
|
252
|
+
userId: client.userId,
|
|
253
|
+
metadata: client.metadata
|
|
254
|
+
},
|
|
255
|
+
timestamp: Date.now()
|
|
256
|
+
};
|
|
257
|
+
this.messageHandlers.forEach(handler => handler(authMessage));
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
// Send error response
|
|
261
|
+
this.sendToClient(client, {
|
|
262
|
+
id: this.generateId(),
|
|
263
|
+
type: 'auth_error',
|
|
264
|
+
payload: { error: result.error || 'Authentication failed' },
|
|
265
|
+
timestamp: Date.now()
|
|
266
|
+
});
|
|
267
|
+
// Optionally close connection
|
|
268
|
+
if (this.config.closeOnAuthFailure) {
|
|
269
|
+
client.ws.close(1008, 'Authentication failed');
|
|
270
|
+
this.clients.delete(client.id);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
catch (error) {
|
|
275
|
+
this.sendToClient(client, {
|
|
276
|
+
id: this.generateId(),
|
|
277
|
+
type: 'auth_error',
|
|
278
|
+
payload: { error: error.message },
|
|
279
|
+
timestamp: Date.now()
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
extractBearerToken(authHeader) {
|
|
284
|
+
if (authHeader.startsWith('Bearer ')) {
|
|
285
|
+
return authHeader.substring(7);
|
|
286
|
+
}
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
sendToClient(client, message) {
|
|
290
|
+
if (client.ws.readyState === WebSocket.OPEN) {
|
|
291
|
+
client.ws.send(JSON.stringify(message));
|
|
292
|
+
}
|
|
126
293
|
}
|
|
127
294
|
async disconnect() {
|
|
128
295
|
if (this.state === 'disconnected') {
|
|
@@ -132,6 +299,9 @@ export class WebSocketTransportAdapter {
|
|
|
132
299
|
// Close all client connections
|
|
133
300
|
for (const [_clientId, client] of this.clients) {
|
|
134
301
|
try {
|
|
302
|
+
if (client.authTimeout) {
|
|
303
|
+
clearTimeout(client.authTimeout);
|
|
304
|
+
}
|
|
135
305
|
client.ws.close(1000, 'Server shutting down');
|
|
136
306
|
}
|
|
137
307
|
catch {
|
|
@@ -192,12 +362,18 @@ export class WebSocketTransportAdapter {
|
|
|
192
362
|
getConnectedClients() {
|
|
193
363
|
return Array.from(this.clients.values());
|
|
194
364
|
}
|
|
365
|
+
getAuthenticatedClients() {
|
|
366
|
+
return Array.from(this.clients.values()).filter(c => c.authenticated);
|
|
367
|
+
}
|
|
195
368
|
getClientCount() {
|
|
196
369
|
return this.clients.size;
|
|
197
370
|
}
|
|
198
371
|
getMode() {
|
|
199
372
|
return this.mode;
|
|
200
373
|
}
|
|
374
|
+
isAuthRequired() {
|
|
375
|
+
return this.config.requireAuth ?? false;
|
|
376
|
+
}
|
|
201
377
|
generateId() {
|
|
202
378
|
return Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
203
379
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { WebSocketTransportAdapter } from './WebSocketTransportAdapter';
|
|
1
|
+
export { WebSocketTransportAdapter, type WebSocketTransportConfig } from './WebSocketTransportAdapter';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/websocket/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/websocket/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,KAAK,wBAAwB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseClient.d.ts","sourceRoot":"","sources":["../../src/client/BaseClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAGf,KAAK,EACL,SAAS,EACT,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,WAAW,EACZ,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAA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S,IAAI,MAAM,GAAG,IAAI;YAKZ,aAAa;YAkCb,WAAW;YAIX,WAAW;YAcX,gBAAgB;YAMhB,cAAc;YAQd,oBAAoB;YAIpB,kBAAkB;YAIlB,kBAAkB;YAIlB,gBAAgB;YAIhB,qBAAqB;YAQrB,iBAAiB;YAKjB,iBAAiB;IA0B/B,OAAO,CAAC,UAAU;CAGnB"}
|
|
@@ -33,8 +33,10 @@ export class BaseClient extends TypedEventEmitter {
|
|
|
33
33
|
// Authenticate if credentials provided and auth adapter available
|
|
34
34
|
if (credentials && this.auth) {
|
|
35
35
|
const authResult = await this.auth.authenticate(credentials);
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
if (authResult.success && authResult.token) {
|
|
37
|
+
this.authToken = authResult.token;
|
|
38
|
+
this.userId = authResult.user?.userId || authResult.userId || '';
|
|
39
|
+
}
|
|
38
40
|
}
|
|
39
41
|
const options = {
|
|
40
42
|
url,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { EventType, BaseEvent, FileAction, FileChangeEvent, GitStatusEvent, CommitEvent, BranchChangeEvent, CursorPositionEvent, Event, TokenPayload, AuthResult, CredentialType, OAuthProvider, Credentials, JWTConfig, OAuthConfig, AuthProvider, RoomPermission, Room, RoomUser, UserStatus, RoomState, RoomConfig, LockType, LockPriority, Lock, LockRequest, LockQueueItem, LockState, ConnectionState, ConnectionOptions, Message, MessageHandler, ErrorHandler, CloseHandler } from './types';
|
|
2
2
|
export { ITransportAdapter, IStorageAdapter, StorageOperation, IAuthAdapter, TypedEventEmitter, EventListener, UnsubscribeFn, RoomManager, LockManager, DefaultRoomManager, DefaultLockManager } from './abstractions';
|
|
3
3
|
export { MockTransportAdapter, MockStorageAdapter, MockAuthAdapter } from './adapters/mock';
|
|
4
|
-
export { WebSocketTransportAdapter } from './adapters/websocket';
|
|
4
|
+
export { WebSocketTransportAdapter, type WebSocketTransportConfig } from './adapters/websocket';
|
|
5
5
|
export { BaseClient, ClientBuilder, type ClientConfig, type ClientEvents } from './client';
|
|
6
6
|
export { BaseServer, ServerBuilder, type ServerConfig, type ServerEvents, type ConnectedClient } from './server';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,SAAS,EACT,SAAS,EACT,UAAU,EACV,eAAe,EACf,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,EAEL,YAAY,EACZ,UAAU,EACV,cAAc,EACd,aAAa,EACb,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EAEZ,cAAc,EACd,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,UAAU,EAEV,QAAQ,EACR,YAAY,EACZ,IAAI,EACJ,WAAW,EACX,aAAa,EACb,SAAS,EAET,eAAe,EACf,iBAAiB,EACjB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,YAAY,EACb,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,yBAAyB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,SAAS,EACT,SAAS,EACT,UAAU,EACV,eAAe,EACf,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,EAEL,YAAY,EACZ,UAAU,EACV,cAAc,EACd,aAAa,EACb,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EAEZ,cAAc,EACd,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,UAAU,EAEV,QAAQ,EACR,YAAY,EACZ,IAAI,EACJ,WAAW,EACX,aAAa,EACb,SAAS,EAET,eAAe,EACf,iBAAiB,EACjB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,YAAY,EACb,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,yBAAyB,EACzB,KAAK,wBAAwB,EAC9B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,UAAU,EACV,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,UAAU,EACV,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACrB,MAAM,UAAU,CAAC"}
|