@rtc-agent/component 0.3.0-rc.4 → 0.3.1-rc.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/bin/rtc-agent-setup.js +4 -3
- package/dist/assets/{index.browser-CWSfggKe.js → index.browser-FXjGjhZV.js} +2 -2
- package/dist/assets/{shared-worker-1s_f3JBa.js → shared-worker-ChKqqB9z.js} +7834 -7831
- package/dist/controllers/auth.controller.d.ts +32 -3
- package/dist/controllers/auth.controller.d.ts.map +1 -1
- package/dist/{en-US-CFXbInuG.js → en-US-qRU5F_oZ.js} +1 -1
- package/dist/{highlight-languages-Dps3C_wF.js → highlight-languages-DU-ex2mb.js} +1 -1
- package/dist/{index-BfhJToDJ.js → index-CFX5JHDY.js} +8669 -8476
- package/dist/index.js +1 -1
- package/dist/index.umd.js +429 -429
- package/dist/stats.html +1 -1
- package/dist/types/factory.d.ts +23 -3
- package/dist/types/factory.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -34,6 +34,10 @@ export declare class AuthController implements ReactiveController {
|
|
|
34
34
|
private _externalTokens;
|
|
35
35
|
/** Auth provider */
|
|
36
36
|
private _authProvider?;
|
|
37
|
+
/** Flag to indicate Token Exchange mode (vs OAuth2 Redirect mode). */
|
|
38
|
+
private _isTokenExchangeMode;
|
|
39
|
+
/** OAuth2Client instance for Token Exchange mode. */
|
|
40
|
+
private _oauth2Client?;
|
|
37
41
|
/**
|
|
38
42
|
* Callback fired when auth state transitions to logged-in.
|
|
39
43
|
*
|
|
@@ -89,7 +93,12 @@ export declare class AuthController implements ReactiveController {
|
|
|
89
93
|
* Use this for complex authentication flows, multi-tenant applications,
|
|
90
94
|
* or custom token rotation strategies.
|
|
91
95
|
*
|
|
92
|
-
*
|
|
96
|
+
* Two modes are supported:
|
|
97
|
+
* 1. OAuth2 Redirect (default): Host manages tokens via getToken()/refreshToken()
|
|
98
|
+
* 2. Token Exchange: Host provides external JWT via getExchangeToken(),
|
|
99
|
+
* component exchanges it for RTC JWT via OAuth2Client.tokenExchange()
|
|
100
|
+
*
|
|
101
|
+
* @param provider - The auth provider interface
|
|
93
102
|
*/
|
|
94
103
|
setAuthProvider(provider: AuthProvider): void;
|
|
95
104
|
/** Get current access token (for API requests) */
|
|
@@ -98,12 +107,30 @@ export declare class AuthController implements ReactiveController {
|
|
|
98
107
|
* Get the current access token, resolving it asynchronously if needed.
|
|
99
108
|
*
|
|
100
109
|
* Priority:
|
|
101
|
-
* 1.
|
|
102
|
-
* 2.
|
|
110
|
+
* 1. Token Exchange mode - calls provider.getExchangeToken() + tokenExchange()
|
|
111
|
+
* 2. Auth provider - calls provider.getToken()
|
|
112
|
+
* 3. Stored token (internal auth) - returns _state.accessToken
|
|
103
113
|
*
|
|
104
114
|
* @returns The access token string, or undefined if unavailable.
|
|
105
115
|
*/
|
|
106
116
|
getAccessTokenAsync(): Promise<string | undefined>;
|
|
117
|
+
/**
|
|
118
|
+
* Perform Token Exchange: call getExchangeToken() + tokenExchange().
|
|
119
|
+
*
|
|
120
|
+
* Flow:
|
|
121
|
+
* 1. Call authProvider.getExchangeToken() to get external JWT
|
|
122
|
+
* 2. Call OAuth2Client.tokenExchange() to get RTC JWT
|
|
123
|
+
* 3. Save RTC JWT to state (persisted via setTokens-like logic)
|
|
124
|
+
* 4. Schedule refresh timer
|
|
125
|
+
*
|
|
126
|
+
* Error handling:
|
|
127
|
+
* - getExchangeToken() fails → logout
|
|
128
|
+
* - tokenExchange() fails → retry 1 time (handled by OAuth2Client), still fails → logout
|
|
129
|
+
*
|
|
130
|
+
* @returns true if exchange succeeded, false otherwise
|
|
131
|
+
*/
|
|
132
|
+
private _performTokenExchange;
|
|
133
|
+
private _doTokenExchange;
|
|
107
134
|
private _login;
|
|
108
135
|
private _logout;
|
|
109
136
|
/**
|
|
@@ -113,6 +140,8 @@ export declare class AuthController implements ReactiveController {
|
|
|
113
140
|
* - `_authProvider`: released so the host app's provider can be GC'd
|
|
114
141
|
* - `_refreshTimer`: cleared to prevent orphaned setTimeout callbacks
|
|
115
142
|
* - `_externalTokens`: reset so next login cycle starts clean
|
|
143
|
+
* - `_isTokenExchangeMode`: reset to default
|
|
144
|
+
* - `_oauth2Client`: released for GC
|
|
116
145
|
*/
|
|
117
146
|
private _performLogout;
|
|
118
147
|
/** Load tokens from localStorage */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/auth.controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAC,kBAAkB,EAAE,sBAAsB,EAAC,MAAM,KAAK,CAAC;AACpE,OAAO,KAAK,EAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"auth.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/auth.controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAC,kBAAkB,EAAE,sBAAsB,EAAC,MAAM,KAAK,CAAC;AACpE,OAAO,KAAK,EAAC,kBAAkB,EAAwB,MAAM,mBAAmB,CAAC;AACjF,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AActD,UAAU,eAAe;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,cAAe,YAAW,kBAAkB;IACrD,IAAI,EAAE,sBAAsB,GAAG,WAAW,CAAC;IAE3C,OAAO,CAAC,MAAM,CAAsC;IACpD,OAAO,CAAC,aAAa,CAAC,CAAgC;IACtD,OAAO,CAAC,uBAAuB,CAAC,CAAa;IAC7C,+EAA+E;IAC/E,OAAO,CAAC,WAAW,C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