@uipath/auth 1.195.0 → 1.196.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/authContext.d.ts +22 -0
- package/dist/index.browser.js +49 -11
- package/dist/index.d.ts +4 -1
- package/dist/index.js +59 -17
- package/dist/interactive.d.ts +9 -0
- package/dist/loginStatus.d.ts +7 -0
- package/dist/robotClientFallback.d.ts +4 -3
- package/dist/strategies/auth-strategy.d.ts +5 -1
- package/dist/strategies/browser-strategy.d.ts +3 -1
- package/dist/strategies/node-strategy.d.ts +3 -1
- package/dist/utils/envFile.d.ts +7 -2
- package/package.json +2 -2
package/dist/authContext.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type GetLoginStatusOptions, type LoginStatus } from "./loginStatus";
|
|
1
2
|
export interface AuthContext {
|
|
2
3
|
baseUrl: string;
|
|
3
4
|
accessToken: string;
|
|
@@ -13,5 +14,26 @@ export interface GetAuthContextOptions {
|
|
|
13
14
|
requireOrganizationName?: boolean;
|
|
14
15
|
requireTenantId?: boolean;
|
|
15
16
|
requireTenantName?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve credentials from this exact `.uipath/.auth` path instead of the
|
|
19
|
+
* default cwd→ancestors→home walk-up. Lets an in-process host (e.g. the VS
|
|
20
|
+
* Code extension) pin auth to a specific file — the same `envFilePath`
|
|
21
|
+
* {@link getLoginStatusAsync} already accepts — so concurrent operations
|
|
22
|
+
* against different credential files don't cross-contaminate.
|
|
23
|
+
*/
|
|
24
|
+
envFilePath?: string;
|
|
16
25
|
}
|
|
17
26
|
export declare const getAuthContext: (options?: GetAuthContextOptions) => Promise<AuthContext>;
|
|
27
|
+
export interface AuthEnvResult {
|
|
28
|
+
/** UiPath credential env vars to merge into a subprocess env. Empty when not logged in. */
|
|
29
|
+
authEnv: Record<string, string>;
|
|
30
|
+
/** The login status used to build {@link authEnv}, or undefined when it could not be read. */
|
|
31
|
+
loginStatus?: LoginStatus;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Build UiPath credential env vars from the live `uip login` status, for
|
|
35
|
+
* injecting into a spawned process. The token is refreshed so the child gets
|
|
36
|
+
* a valid bearer token, not a stale one off disk. Never throws: returns an
|
|
37
|
+
* empty `authEnv` when there is no usable login.
|
|
38
|
+
*/
|
|
39
|
+
export declare const getAuthEnv: (options?: GetLoginStatusOptions) => Promise<AuthEnvResult>;
|
package/dist/index.browser.js
CHANGED
|
@@ -328,11 +328,11 @@ var parseResourceUrl = (url) => {
|
|
|
328
328
|
if (error || !parsed)
|
|
329
329
|
return;
|
|
330
330
|
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
331
|
+
return {
|
|
332
|
+
baseUrl: parsed.origin,
|
|
333
|
+
organizationName: segments[0],
|
|
334
|
+
tenantName: segments[1]
|
|
335
|
+
};
|
|
336
336
|
};
|
|
337
337
|
var defaultLoadModule = async () => {
|
|
338
338
|
const [error, mod] = await catchError(() => import("@uipath/robot-client"));
|
|
@@ -383,6 +383,7 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
383
383
|
}
|
|
384
384
|
let organizationIdFromToken;
|
|
385
385
|
let tenantIdFromToken;
|
|
386
|
+
let issuerFromToken;
|
|
386
387
|
const [jwtError, claims] = catchError(() => parseJWT(accessToken));
|
|
387
388
|
if (!jwtError && claims) {
|
|
388
389
|
const rawOrgId = claims.prtId ?? claims.organizationId ?? claims.prt_id;
|
|
@@ -393,6 +394,10 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
393
394
|
if (typeof tenantClaim === "string" && tenantClaim.length > 0) {
|
|
394
395
|
tenantIdFromToken = tenantClaim;
|
|
395
396
|
}
|
|
397
|
+
const issClaim = claims.iss;
|
|
398
|
+
if (typeof issClaim === "string" && issClaim.length > 0) {
|
|
399
|
+
issuerFromToken = issClaim;
|
|
400
|
+
}
|
|
396
401
|
}
|
|
397
402
|
printNoticeOnce();
|
|
398
403
|
return {
|
|
@@ -401,7 +406,8 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
401
406
|
organizationName: parsedUrl.organizationName,
|
|
402
407
|
organizationId: organizationIdFromToken ?? parsedUrl.organizationName,
|
|
403
408
|
tenantName: parsedUrl.tenantName,
|
|
404
|
-
tenantId: tenantIdFromToken
|
|
409
|
+
tenantId: tenantIdFromToken,
|
|
410
|
+
issuer: issuerFromToken
|
|
405
411
|
};
|
|
406
412
|
} catch {
|
|
407
413
|
return;
|
|
@@ -503,7 +509,7 @@ var probeAsync = async (fs, candidate) => {
|
|
|
503
509
|
};
|
|
504
510
|
}
|
|
505
511
|
};
|
|
506
|
-
var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME) => {
|
|
512
|
+
var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
|
|
507
513
|
const fs = getFileSystem2();
|
|
508
514
|
if (fs.path.isAbsolute(envFilePath)) {
|
|
509
515
|
const probe2 = await probeAsync(fs, envFilePath);
|
|
@@ -514,7 +520,7 @@ var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME) =>
|
|
|
514
520
|
...probe2.unusable ? { unusable: probe2.unusable } : {}
|
|
515
521
|
};
|
|
516
522
|
}
|
|
517
|
-
const cwd = fs.env.cwd();
|
|
523
|
+
const cwd = opts?.cwd ?? fs.env.cwd();
|
|
518
524
|
let searchDir = cwd;
|
|
519
525
|
while (true) {
|
|
520
526
|
const candidate = fs.path.join(searchDir, envFilePath);
|
|
@@ -544,8 +550,8 @@ var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME) =>
|
|
|
544
550
|
...probe.unusable ? { unusable: probe.unusable } : {}
|
|
545
551
|
};
|
|
546
552
|
};
|
|
547
|
-
var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME) => {
|
|
548
|
-
const location = await resolveEnvFileLocationAsync(envFilePath);
|
|
553
|
+
var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
|
|
554
|
+
const location = await resolveEnvFileLocationAsync(envFilePath, opts);
|
|
549
555
|
if (location.exists) {
|
|
550
556
|
return { absolutePath: location.absolutePath };
|
|
551
557
|
}
|
|
@@ -782,6 +788,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
782
788
|
organizationId: robotCreds.organizationId,
|
|
783
789
|
tenantName: robotCreds.tenantName,
|
|
784
790
|
tenantId: robotCreds.tenantId,
|
|
791
|
+
issuer: robotCreds.issuer,
|
|
785
792
|
expiration: expiration2,
|
|
786
793
|
source: "robot" /* Robot */
|
|
787
794
|
};
|
|
@@ -803,6 +810,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
803
810
|
organizationId: robotCreds.organizationId,
|
|
804
811
|
tenantName: robotCreds.tenantName,
|
|
805
812
|
tenantId: robotCreds.tenantId,
|
|
813
|
+
issuer: robotCreds.issuer,
|
|
806
814
|
expiration: expiration2,
|
|
807
815
|
source: "robot" /* Robot */
|
|
808
816
|
};
|
|
@@ -960,7 +968,8 @@ var getLoginStatusAsync = async (options = {}) => {
|
|
|
960
968
|
// src/authContext.ts
|
|
961
969
|
var getAuthContext = async (options = {}) => {
|
|
962
970
|
const status = await getLoginStatusAsync({
|
|
963
|
-
ensureTokenValidityMinutes: options.ensureTokenValidityMinutes
|
|
971
|
+
ensureTokenValidityMinutes: options.ensureTokenValidityMinutes,
|
|
972
|
+
envFilePath: options.envFilePath
|
|
964
973
|
});
|
|
965
974
|
if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
|
|
966
975
|
throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
|
|
@@ -987,6 +996,34 @@ var getAuthContext = async (options = {}) => {
|
|
|
987
996
|
tenantName
|
|
988
997
|
};
|
|
989
998
|
};
|
|
999
|
+
var getAuthEnv = async (options = {}) => {
|
|
1000
|
+
const authEnv = {};
|
|
1001
|
+
let status;
|
|
1002
|
+
try {
|
|
1003
|
+
status = await getLoginStatusAsync(options);
|
|
1004
|
+
} catch {
|
|
1005
|
+
return { authEnv };
|
|
1006
|
+
}
|
|
1007
|
+
if (status.loginStatus === "Logged in" && status.accessToken) {
|
|
1008
|
+
authEnv.UIPATH_ACCESS_TOKEN = status.accessToken;
|
|
1009
|
+
if (status.baseUrl) {
|
|
1010
|
+
const org = status.organizationName || status.organizationId;
|
|
1011
|
+
const tenant = status.tenantName || status.tenantId;
|
|
1012
|
+
if (org && tenant) {
|
|
1013
|
+
authEnv.UIPATH_URL = `${status.baseUrl.replace(/\/+$/, "")}/${org}/${tenant}`;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
if (status.organizationId)
|
|
1017
|
+
authEnv.UIPATH_ORGANIZATION_ID = status.organizationId;
|
|
1018
|
+
if (status.organizationName)
|
|
1019
|
+
authEnv.UIPATH_ORGANIZATION_NAME = status.organizationName;
|
|
1020
|
+
if (status.tenantId)
|
|
1021
|
+
authEnv.UIPATH_TENANT_ID = status.tenantId;
|
|
1022
|
+
if (status.tenantName)
|
|
1023
|
+
authEnv.UIPATH_TENANT_NAME = status.tenantName;
|
|
1024
|
+
}
|
|
1025
|
+
return { authEnv, loginStatus: status };
|
|
1026
|
+
};
|
|
990
1027
|
// src/clientCredentials.ts
|
|
991
1028
|
var clientCredentialsLogin = async ({
|
|
992
1029
|
clientId,
|
|
@@ -1116,6 +1153,7 @@ export {
|
|
|
1116
1153
|
isBrowser,
|
|
1117
1154
|
getLoginStatusWithDeps,
|
|
1118
1155
|
getLoginStatusAsync,
|
|
1156
|
+
getAuthEnv,
|
|
1119
1157
|
getAuthContext,
|
|
1120
1158
|
fetchTenantsAndOrganizations,
|
|
1121
1159
|
clientCredentialsLogin,
|
package/dist/index.d.ts
CHANGED
|
@@ -20,8 +20,11 @@ interface AuthenticateOptions {
|
|
|
20
20
|
redirectUri?: URL;
|
|
21
21
|
scope?: string[];
|
|
22
22
|
organization?: string;
|
|
23
|
+
/** Max ms to wait for the browser callback; forwarded to the strategy's
|
|
24
|
+
* local callback server. Defaults to the server's 5-min cap. */
|
|
25
|
+
timeoutMs?: number;
|
|
23
26
|
}
|
|
24
|
-
export declare const authenticate: ({ baseUrl, clientId, clientSecret, redirectUri, scope, organization, }: AuthenticateOptions) => Promise<{
|
|
27
|
+
export declare const authenticate: ({ baseUrl, clientId, clientSecret, redirectUri, scope, organization, timeoutMs, }: AuthenticateOptions) => Promise<{
|
|
25
28
|
accessToken: string;
|
|
26
29
|
refreshToken: string;
|
|
27
30
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -19405,7 +19405,7 @@ __export(exports_browser_strategy, {
|
|
|
19405
19405
|
});
|
|
19406
19406
|
|
|
19407
19407
|
class BrowserAuthStrategy {
|
|
19408
|
-
async execute(url, _redirectUri, expectedState) {
|
|
19408
|
+
async execute(url, _redirectUri, expectedState, _opts) {
|
|
19409
19409
|
const global2 = getGlobalThis();
|
|
19410
19410
|
if (!global2?.window) {
|
|
19411
19411
|
throw new Error("Browser environment required for authentication");
|
|
@@ -19480,10 +19480,11 @@ __export(exports_node_strategy, {
|
|
|
19480
19480
|
});
|
|
19481
19481
|
|
|
19482
19482
|
class NodeAuthStrategy {
|
|
19483
|
-
async execute(url, redirectUri, expectedState) {
|
|
19483
|
+
async execute(url, redirectUri, expectedState, opts) {
|
|
19484
19484
|
const fs7 = getFileSystem();
|
|
19485
19485
|
const callbackUrl = await startServer({
|
|
19486
19486
|
redirectUri,
|
|
19487
|
+
timeoutMs: opts?.timeoutMs,
|
|
19487
19488
|
onListening: async () => {
|
|
19488
19489
|
let safeUrl = "";
|
|
19489
19490
|
for (const ch of url) {
|
|
@@ -20438,11 +20439,11 @@ var parseResourceUrl = (url) => {
|
|
|
20438
20439
|
if (error || !parsed)
|
|
20439
20440
|
return;
|
|
20440
20441
|
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
20441
|
-
|
|
20442
|
-
|
|
20443
|
-
|
|
20444
|
-
|
|
20445
|
-
|
|
20442
|
+
return {
|
|
20443
|
+
baseUrl: parsed.origin,
|
|
20444
|
+
organizationName: segments[0],
|
|
20445
|
+
tenantName: segments[1]
|
|
20446
|
+
};
|
|
20446
20447
|
};
|
|
20447
20448
|
var defaultLoadModule = async () => {
|
|
20448
20449
|
const [error, mod] = await catchError(() => Promise.resolve().then(() => __toESM(require_dist(), 1)));
|
|
@@ -20493,6 +20494,7 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
20493
20494
|
}
|
|
20494
20495
|
let organizationIdFromToken;
|
|
20495
20496
|
let tenantIdFromToken;
|
|
20497
|
+
let issuerFromToken;
|
|
20496
20498
|
const [jwtError, claims] = catchError(() => parseJWT(accessToken));
|
|
20497
20499
|
if (!jwtError && claims) {
|
|
20498
20500
|
const rawOrgId = claims.prtId ?? claims.organizationId ?? claims.prt_id;
|
|
@@ -20503,6 +20505,10 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
20503
20505
|
if (typeof tenantClaim === "string" && tenantClaim.length > 0) {
|
|
20504
20506
|
tenantIdFromToken = tenantClaim;
|
|
20505
20507
|
}
|
|
20508
|
+
const issClaim = claims.iss;
|
|
20509
|
+
if (typeof issClaim === "string" && issClaim.length > 0) {
|
|
20510
|
+
issuerFromToken = issClaim;
|
|
20511
|
+
}
|
|
20506
20512
|
}
|
|
20507
20513
|
printNoticeOnce();
|
|
20508
20514
|
return {
|
|
@@ -20511,7 +20517,8 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
20511
20517
|
organizationName: parsedUrl.organizationName,
|
|
20512
20518
|
organizationId: organizationIdFromToken ?? parsedUrl.organizationName,
|
|
20513
20519
|
tenantName: parsedUrl.tenantName,
|
|
20514
|
-
tenantId: tenantIdFromToken
|
|
20520
|
+
tenantId: tenantIdFromToken,
|
|
20521
|
+
issuer: issuerFromToken
|
|
20515
20522
|
};
|
|
20516
20523
|
} catch {
|
|
20517
20524
|
return;
|
|
@@ -20614,7 +20621,7 @@ var probeAsync = async (fs7, candidate) => {
|
|
|
20614
20621
|
};
|
|
20615
20622
|
}
|
|
20616
20623
|
};
|
|
20617
|
-
var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME) => {
|
|
20624
|
+
var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
|
|
20618
20625
|
const fs7 = getFileSystem();
|
|
20619
20626
|
if (fs7.path.isAbsolute(envFilePath)) {
|
|
20620
20627
|
const probe2 = await probeAsync(fs7, envFilePath);
|
|
@@ -20625,7 +20632,7 @@ var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME) =>
|
|
|
20625
20632
|
...probe2.unusable ? { unusable: probe2.unusable } : {}
|
|
20626
20633
|
};
|
|
20627
20634
|
}
|
|
20628
|
-
const cwd = fs7.env.cwd();
|
|
20635
|
+
const cwd = opts?.cwd ?? fs7.env.cwd();
|
|
20629
20636
|
let searchDir = cwd;
|
|
20630
20637
|
while (true) {
|
|
20631
20638
|
const candidate = fs7.path.join(searchDir, envFilePath);
|
|
@@ -20655,8 +20662,8 @@ var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME) =>
|
|
|
20655
20662
|
...probe.unusable ? { unusable: probe.unusable } : {}
|
|
20656
20663
|
};
|
|
20657
20664
|
};
|
|
20658
|
-
var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME) => {
|
|
20659
|
-
const location = await resolveEnvFileLocationAsync(envFilePath);
|
|
20665
|
+
var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
|
|
20666
|
+
const location = await resolveEnvFileLocationAsync(envFilePath, opts);
|
|
20660
20667
|
if (location.exists) {
|
|
20661
20668
|
return { absolutePath: location.absolutePath };
|
|
20662
20669
|
}
|
|
@@ -20893,6 +20900,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
20893
20900
|
organizationId: robotCreds.organizationId,
|
|
20894
20901
|
tenantName: robotCreds.tenantName,
|
|
20895
20902
|
tenantId: robotCreds.tenantId,
|
|
20903
|
+
issuer: robotCreds.issuer,
|
|
20896
20904
|
expiration: expiration2,
|
|
20897
20905
|
source: "robot" /* Robot */
|
|
20898
20906
|
};
|
|
@@ -20914,6 +20922,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
20914
20922
|
organizationId: robotCreds.organizationId,
|
|
20915
20923
|
tenantName: robotCreds.tenantName,
|
|
20916
20924
|
tenantId: robotCreds.tenantId,
|
|
20925
|
+
issuer: robotCreds.issuer,
|
|
20917
20926
|
expiration: expiration2,
|
|
20918
20927
|
source: "robot" /* Robot */
|
|
20919
20928
|
};
|
|
@@ -21071,7 +21080,8 @@ var getLoginStatusAsync = async (options = {}) => {
|
|
|
21071
21080
|
// src/authContext.ts
|
|
21072
21081
|
var getAuthContext = async (options = {}) => {
|
|
21073
21082
|
const status = await getLoginStatusAsync({
|
|
21074
|
-
ensureTokenValidityMinutes: options.ensureTokenValidityMinutes
|
|
21083
|
+
ensureTokenValidityMinutes: options.ensureTokenValidityMinutes,
|
|
21084
|
+
envFilePath: options.envFilePath
|
|
21075
21085
|
});
|
|
21076
21086
|
if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
|
|
21077
21087
|
throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
|
|
@@ -21098,6 +21108,34 @@ var getAuthContext = async (options = {}) => {
|
|
|
21098
21108
|
tenantName
|
|
21099
21109
|
};
|
|
21100
21110
|
};
|
|
21111
|
+
var getAuthEnv = async (options = {}) => {
|
|
21112
|
+
const authEnv = {};
|
|
21113
|
+
let status;
|
|
21114
|
+
try {
|
|
21115
|
+
status = await getLoginStatusAsync(options);
|
|
21116
|
+
} catch {
|
|
21117
|
+
return { authEnv };
|
|
21118
|
+
}
|
|
21119
|
+
if (status.loginStatus === "Logged in" && status.accessToken) {
|
|
21120
|
+
authEnv.UIPATH_ACCESS_TOKEN = status.accessToken;
|
|
21121
|
+
if (status.baseUrl) {
|
|
21122
|
+
const org = status.organizationName || status.organizationId;
|
|
21123
|
+
const tenant = status.tenantName || status.tenantId;
|
|
21124
|
+
if (org && tenant) {
|
|
21125
|
+
authEnv.UIPATH_URL = `${status.baseUrl.replace(/\/+$/, "")}/${org}/${tenant}`;
|
|
21126
|
+
}
|
|
21127
|
+
}
|
|
21128
|
+
if (status.organizationId)
|
|
21129
|
+
authEnv.UIPATH_ORGANIZATION_ID = status.organizationId;
|
|
21130
|
+
if (status.organizationName)
|
|
21131
|
+
authEnv.UIPATH_ORGANIZATION_NAME = status.organizationName;
|
|
21132
|
+
if (status.tenantId)
|
|
21133
|
+
authEnv.UIPATH_TENANT_ID = status.tenantId;
|
|
21134
|
+
if (status.tenantName)
|
|
21135
|
+
authEnv.UIPATH_TENANT_NAME = status.tenantName;
|
|
21136
|
+
}
|
|
21137
|
+
return { authEnv, loginStatus: status };
|
|
21138
|
+
};
|
|
21101
21139
|
// src/clientCredentials.ts
|
|
21102
21140
|
var clientCredentialsLogin = async ({
|
|
21103
21141
|
clientId,
|
|
@@ -21234,7 +21272,8 @@ var interactiveLoginWithDeps = async (options, deps) => {
|
|
|
21234
21272
|
tenant,
|
|
21235
21273
|
organization,
|
|
21236
21274
|
interactive,
|
|
21237
|
-
onEvent
|
|
21275
|
+
onEvent,
|
|
21276
|
+
timeoutMs
|
|
21238
21277
|
} = options;
|
|
21239
21278
|
const emit = (event) => {
|
|
21240
21279
|
if (!onEvent)
|
|
@@ -21262,7 +21301,8 @@ var interactiveLoginWithDeps = async (options, deps) => {
|
|
|
21262
21301
|
clientId,
|
|
21263
21302
|
clientSecret,
|
|
21264
21303
|
scope,
|
|
21265
|
-
organization
|
|
21304
|
+
organization,
|
|
21305
|
+
timeoutMs
|
|
21266
21306
|
});
|
|
21267
21307
|
return {
|
|
21268
21308
|
UIPATH_ACCESS_TOKEN: authTokens.accessToken,
|
|
@@ -21405,7 +21445,8 @@ var authenticate = async ({
|
|
|
21405
21445
|
clientSecret,
|
|
21406
21446
|
redirectUri,
|
|
21407
21447
|
scope,
|
|
21408
|
-
organization
|
|
21448
|
+
organization,
|
|
21449
|
+
timeoutMs
|
|
21409
21450
|
}) => {
|
|
21410
21451
|
const config = await resolveConfigAsync({
|
|
21411
21452
|
customAuthority: baseUrl,
|
|
@@ -21455,7 +21496,7 @@ var authenticate = async ({
|
|
|
21455
21496
|
const { NodeAuthStrategy: NodeAuthStrategy2 } = await Promise.resolve().then(() => (init_node_strategy(), exports_node_strategy));
|
|
21456
21497
|
strategy = new NodeAuthStrategy2;
|
|
21457
21498
|
}
|
|
21458
|
-
const code = await strategy.execute(authUrl, effectiveRedirectUriUrl, state);
|
|
21499
|
+
const code = await strategy.execute(authUrl, effectiveRedirectUriUrl, state, { timeoutMs });
|
|
21459
21500
|
return await exchangeCodeForTokens({
|
|
21460
21501
|
code,
|
|
21461
21502
|
codeVerifier: code_verifier,
|
|
@@ -21486,6 +21527,7 @@ export {
|
|
|
21486
21527
|
interactiveLogin,
|
|
21487
21528
|
getLoginStatusWithDeps,
|
|
21488
21529
|
getLoginStatusAsync,
|
|
21530
|
+
getAuthEnv,
|
|
21489
21531
|
getAuthContext,
|
|
21490
21532
|
fetchTenantsAndOrganizations,
|
|
21491
21533
|
clientCredentialsLogin,
|
package/dist/interactive.d.ts
CHANGED
|
@@ -42,6 +42,15 @@ interface InteractiveLoginOptions {
|
|
|
42
42
|
selectFromList?: SelectFromList;
|
|
43
43
|
/** Optional subscriber for user-facing progress events. */
|
|
44
44
|
onEvent?: (event: InteractiveLoginEvent) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Max ms to wait for the browser callback before the local server closes
|
|
47
|
+
* itself and the login rejects with `AUTH_TIMEOUT_ERROR_CODE`. Lets an
|
|
48
|
+
* in-process host (e.g. the VS Code extension) bound a stuck login and
|
|
49
|
+
* free the callback port — parity with the CLI killing its `uip`
|
|
50
|
+
* subprocess on timeout. Defaults to the server's 5-min cap. Only the
|
|
51
|
+
* authorization-code (browser) path uses it.
|
|
52
|
+
*/
|
|
53
|
+
timeoutMs?: number;
|
|
45
54
|
}
|
|
46
55
|
export interface InteractiveLoginDependencies {
|
|
47
56
|
resolveConfig?: typeof resolveConfigAsync;
|
package/dist/loginStatus.d.ts
CHANGED
|
@@ -27,6 +27,13 @@ export interface LoginStatus {
|
|
|
27
27
|
organizationId?: string;
|
|
28
28
|
tenantName?: string;
|
|
29
29
|
tenantId?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Identity authority derived from the access token's `iss` claim.
|
|
32
|
+
* Authoritative for both cloud (`…/identity_`) and on-prem (`…/identity`),
|
|
33
|
+
* so consumers should build identity URLs from this rather than hardcoding
|
|
34
|
+
* the gateway path. Currently populated only on the Robot-borrow path.
|
|
35
|
+
*/
|
|
36
|
+
issuer?: string;
|
|
30
37
|
expiration?: Date;
|
|
31
38
|
hint?: string;
|
|
32
39
|
source?: LoginStatusSource;
|
|
@@ -21,10 +21,11 @@ interface RobotClientModule {
|
|
|
21
21
|
export interface RobotClientFallbackResult {
|
|
22
22
|
accessToken: string;
|
|
23
23
|
baseUrl: string;
|
|
24
|
-
organizationName
|
|
25
|
-
organizationId
|
|
26
|
-
tenantName
|
|
24
|
+
organizationName?: string;
|
|
25
|
+
organizationId?: string;
|
|
26
|
+
tenantName?: string;
|
|
27
27
|
tenantId?: string;
|
|
28
|
+
issuer?: string;
|
|
28
29
|
}
|
|
29
30
|
export interface RobotClientFallbackOptions {
|
|
30
31
|
timeoutMs?: number;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export interface IAuthStrategy {
|
|
2
|
-
execute(url: string, redirectUri: URL, expectedState: string
|
|
2
|
+
execute(url: string, redirectUri: URL, expectedState: string,
|
|
3
|
+
/** Optional controls; `timeoutMs` bounds the wait for the callback. */
|
|
4
|
+
opts?: {
|
|
5
|
+
timeoutMs?: number;
|
|
6
|
+
}): Promise<string>;
|
|
3
7
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { IAuthStrategy } from "./auth-strategy";
|
|
2
2
|
export declare class BrowserAuthStrategy implements IAuthStrategy {
|
|
3
|
-
execute(url: string, _redirectUri: URL, expectedState: string
|
|
3
|
+
execute(url: string, _redirectUri: URL, expectedState: string, _opts?: {
|
|
4
|
+
timeoutMs?: number;
|
|
5
|
+
}): Promise<string>;
|
|
4
6
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { IAuthStrategy } from "./auth-strategy";
|
|
2
2
|
export declare class NodeAuthStrategy implements IAuthStrategy {
|
|
3
|
-
execute(url: string, redirectUri: URL, expectedState: string
|
|
3
|
+
execute(url: string, redirectUri: URL, expectedState: string, opts?: {
|
|
4
|
+
timeoutMs?: number;
|
|
5
|
+
}): Promise<string>;
|
|
4
6
|
}
|
package/dist/utils/envFile.d.ts
CHANGED
|
@@ -74,7 +74,9 @@ export type EnvFileLocation = {
|
|
|
74
74
|
* "not found" and the search continues; only the final candidate (the
|
|
75
75
|
* one actually returned) carries the `unusable` block.
|
|
76
76
|
*/
|
|
77
|
-
export declare const resolveEnvFileLocationAsync: (envFilePath?: string
|
|
77
|
+
export declare const resolveEnvFileLocationAsync: (envFilePath?: string, opts?: {
|
|
78
|
+
cwd?: string;
|
|
79
|
+
}) => Promise<EnvFileLocation>;
|
|
78
80
|
/**
|
|
79
81
|
* Resolve the absolute path to an environment file, returning an
|
|
80
82
|
* `errorMessage` if no existing usable file was found. Delegates the
|
|
@@ -83,8 +85,11 @@ export declare const resolveEnvFileLocationAsync: (envFilePath?: string) => Prom
|
|
|
83
85
|
* semantics including the unreadable-vs-missing distinction.
|
|
84
86
|
*
|
|
85
87
|
* @param envFilePath - Path to the credentials file (defaults to ".uipath/.auth")
|
|
88
|
+
* @param opts.cwd - Directory to start the relative-path walk-up from (defaults to the process cwd)
|
|
86
89
|
*/
|
|
87
|
-
export declare const resolveEnvFilePathAsync: (envFilePath?: string
|
|
90
|
+
export declare const resolveEnvFilePathAsync: (envFilePath?: string, opts?: {
|
|
91
|
+
cwd?: string;
|
|
92
|
+
}) => Promise<ResolveEnvFilePathResult>;
|
|
88
93
|
/**
|
|
89
94
|
* Load environment variables from a credentials file
|
|
90
95
|
* @param envPath - Path to the credentials file (relative to cwd or absolute)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/auth",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.196.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/UiPath/cli.git",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"mihaigirleanu",
|
|
38
38
|
"vlad-uipath"
|
|
39
39
|
],
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "94d71f9c52214980a1f0ae62b3f5372095788553"
|
|
41
41
|
}
|