@microsoft/rayfin-auth-provider-fabric 1.36.0-alpha.1756 → 1.36.0-beta.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/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type { FabricAuthOptions } from './types.js';
2
2
  export type { EntraTokenSignInOptions } from './signInWithEntraToken.js';
3
- export { signInWithEntraToken } from './signInWithEntraToken.js';
3
+ export { signInWithEntraToken, signInWithBrokeredToken, } from './signInWithEntraToken.js';
4
4
  export { bridgeFabricCallback } from './bridgeFabricCallback.js';
5
5
  export { embeddedFabricLogin } from './embeddedFabricLogin.js';
6
6
  export { ensureSignedInWithFabric } from './ensureSignedInWithFabric.js';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { signInWithEntraToken } from './signInWithEntraToken.js';
1
+ export { signInWithEntraToken, signInWithBrokeredToken, } from './signInWithEntraToken.js';
2
2
  // Functions
3
3
  export { bridgeFabricCallback } from './bridgeFabricCallback.js';
4
4
  export { embeddedFabricLogin } from './embeddedFabricLogin.js';
@@ -1,4 +1,4 @@
1
- import type { Auth, OpaqueSession } from '@microsoft/rayfin-auth';
1
+ import type { Auth, OpaqueSession, TokenResponse } from '@microsoft/rayfin-auth';
2
2
  /** Options for signing in to a Fabric AppBackend with an existing Entra token. */
3
3
  export interface EntraTokenSignInOptions {
4
4
  /** Already-acquired delegated Entra access token, without a Bearer prefix. */
@@ -24,5 +24,29 @@ export interface EntraTokenSignInOptions {
24
24
  * const session = await signInWithEntraToken(client.auth, { entraToken });
25
25
  * ```
26
26
  */
27
+ /**
28
+ * Establishes an authenticated session on `auth` from a token response that
29
+ * was already obtained from this backend's brokered-token exchange
30
+ * (`POST /api/auth/v1/brokered/token`) by a trusted caller other than the
31
+ * browser -- for example a local development host that performed the
32
+ * exchange itself so it can reach an HTTP-only local backend, which
33
+ * {@link signInWithEntraToken}'s HTTPS requirement would otherwise reject.
34
+ * No network request is made here; the response is validated and installed
35
+ * directly.
36
+ *
37
+ * Prefer {@link signInWithEntraToken} when the raw Entra token is available
38
+ * in-browser and the configured backend is HTTPS-reachable -- it performs
39
+ * this exchange for you.
40
+ *
41
+ * @param auth - The Auth instance used by your SDK clients.
42
+ * @param tokenResponse - The token response returned by the brokered exchange.
43
+ * @returns The installed session metadata, without access or refresh tokens.
44
+ * @throws `AuthError` when the token response is malformed.
45
+ * @example
46
+ * ```typescript
47
+ * const session = await signInWithBrokeredToken(client.auth, tokenResponse);
48
+ * ```
49
+ */
50
+ export declare function signInWithBrokeredToken(auth: Auth, tokenResponse: TokenResponse): Promise<OpaqueSession>;
27
51
  export declare function signInWithEntraToken(auth: Auth, options: EntraTokenSignInOptions): Promise<OpaqueSession>;
28
52
  //# sourceMappingURL=signInWithEntraToken.d.ts.map
@@ -103,6 +103,35 @@ function sanitizeSignInFailure(error) {
103
103
  * const session = await signInWithEntraToken(client.auth, { entraToken });
104
104
  * ```
105
105
  */
106
+ /**
107
+ * Establishes an authenticated session on `auth` from a token response that
108
+ * was already obtained from this backend's brokered-token exchange
109
+ * (`POST /api/auth/v1/brokered/token`) by a trusted caller other than the
110
+ * browser -- for example a local development host that performed the
111
+ * exchange itself so it can reach an HTTP-only local backend, which
112
+ * {@link signInWithEntraToken}'s HTTPS requirement would otherwise reject.
113
+ * No network request is made here; the response is validated and installed
114
+ * directly.
115
+ *
116
+ * Prefer {@link signInWithEntraToken} when the raw Entra token is available
117
+ * in-browser and the configured backend is HTTPS-reachable -- it performs
118
+ * this exchange for you.
119
+ *
120
+ * @param auth - The Auth instance used by your SDK clients.
121
+ * @param tokenResponse - The token response returned by the brokered exchange.
122
+ * @returns The installed session metadata, without access or refresh tokens.
123
+ * @throws `AuthError` when the token response is malformed.
124
+ * @example
125
+ * ```typescript
126
+ * const session = await signInWithBrokeredToken(client.auth, tokenResponse);
127
+ * ```
128
+ */
129
+ export async function signInWithBrokeredToken(auth, tokenResponse) {
130
+ const validated = validateTokenResponse(tokenResponse);
131
+ return runProviderSignIn(auth, () => createSessionFromTokenResponse(auth, validated, {
132
+ persistBeforeCommit: true,
133
+ })).catch(sanitizeSignInFailure);
134
+ }
106
135
  export async function signInWithEntraToken(auth, options) {
107
136
  const token = options?.entraToken;
108
137
  if (typeof token !== 'string' ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/rayfin-auth-provider-fabric",
3
- "version": "1.36.0-alpha.1756",
3
+ "version": "1.36.0-beta.0",
4
4
  "description": "Fabric brokered authentication provider for Rayfin SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,9 +13,9 @@
13
13
  ],
14
14
  "type": "module",
15
15
  "dependencies": {
16
- "@microsoft/rayfin-auth": "1.36.0-alpha.1756",
17
- "@microsoft/rayfin-lib": "1.36.0-alpha.1756",
18
- "@microsoft/fabric-embedded-host": "1.36.0-alpha.1756"
16
+ "@microsoft/rayfin-auth": "1.36.0-beta.0",
17
+ "@microsoft/rayfin-lib": "1.36.0-beta.0",
18
+ "@microsoft/fabric-embedded-host": "1.36.0-beta.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "typescript": "^5.8.3",