@uipath/auth
Advanced tools
| import type { AuthFlow } from "./types"; | ||
| /** | ||
| * Whether the session acts as a person or as an external application. | ||
| * Deliberately coarse — `authFlow` carries the precision. | ||
| */ | ||
| export type IdentityType = "User" | "Application"; | ||
| /** | ||
| * Who the current session acts as, as reported by the access token. | ||
| * | ||
| * Every field here is read from *unverified* token claims (base64 decode, no | ||
| * signature check) and exists to be shown to a human. Never branch on it for | ||
| * an authorization or trust decision. | ||
| */ | ||
| export interface SessionIdentity { | ||
| type: IdentityType; | ||
| /** Absent when the CLI did not run the flow itself (e.g. Robot-borrowed). */ | ||
| authFlow?: AuthFlow; | ||
| /** User identities only — the token's `sub`. */ | ||
| userId?: string; | ||
| userEmail?: string; | ||
| userName?: string; | ||
| /** | ||
| * Application identities only. User tokens also carry a `client_id` — the | ||
| * CLI's own — and surfacing that would read as if an app were acting. | ||
| */ | ||
| clientId?: string; | ||
| } | ||
| /** Narrow an on-disk `UIPATH_AUTH_FLOW` value to a known flow. */ | ||
| export declare const parseAuthFlow: (value: string | undefined) => AuthFlow | undefined; | ||
| /** | ||
| * Derive the acting identity from an access token and, when known, the flow | ||
| * that produced it. Returns undefined when neither says anything — better to | ||
| * omit the fields than to guess at who is acting. | ||
| */ | ||
| export declare const resolveSessionIdentity: (accessToken: string | undefined, authFlow?: AuthFlow) => SessionIdentity | undefined; |
@@ -9,4 +9,5 @@ /** Home directory for UiPath CLI auth data: ~/.uipath/ */ | ||
| export declare const DEFAULT_AUTH_TIMEOUT_MS: number; | ||
| export declare const AUTH_TIMEOUT_ERROR_CODE = "EAUTHTIMEOUT"; | ||
| export declare const AUTH_CANCELLED_ERROR_CODE = "EAUTHCANCELLED"; | ||
| /** Localhost OIDC redirect URI. */ | ||
| export declare const DEFAULT_REDIRECT_URI = "http://localhost:8104/oidc/login"; |
@@ -7,2 +7,3 @@ export * from "./authContext"; | ||
| export * from "./logout"; | ||
| export { type IdentityType, parseAuthFlow, resolveSessionIdentity, type SessionIdentity, } from "./sessionIdentity"; | ||
| export { fetchTenantsAndOrganizations, type Tenant, type TenantsAndOrganizations, } from "./tenantSelection"; | ||
@@ -9,0 +10,0 @@ export * from "./tokenRefresh"; |
+2
-2
@@ -5,3 +5,3 @@ export * from "./authContext"; | ||
| export { type AuthFileConfig, InvalidBaseUrlError, setAuthFileConfig, } from "./config"; | ||
| export { AUTH_CANCELLED_ERROR_CODE, DEFAULT_AUTH_TIMEOUT_MS, } from "./constants"; | ||
| export { AUTH_CANCELLED_ERROR_CODE, AUTH_TIMEOUT_ERROR_CODE, DEFAULT_AUTH_TIMEOUT_MS, } from "./constants"; | ||
| export { ENFORCE_ROBOT_AUTH_VAR, ENV_AUTH_ENABLE_VAR, ENV_AUTH_VARS, EnvAuthConfigError, isEnvAuthEnabled, isRobotAuthEnforced, readAuthFromEnv, } from "./envAuth"; | ||
@@ -15,3 +15,3 @@ export { FederatedCredentialsAuthenticationError, federatedCredentialsLogin, JWT_BEARER_ASSERTION_TYPE, } from "./federatedCredentials"; | ||
| export { INVALID_TENANT_CODE, InvalidTenantError, isTenantSelectionError, type SelectFromList, selectTenantWithDeps, TENANT_SELECTION_REQUIRED_CODE, TenantSelectionError, TenantSelectionRequiredError, } from "./selectTenant"; | ||
| export { AUTH_TIMEOUT_ERROR_CODE } from "./server"; | ||
| export { type IdentityType, parseAuthFlow, resolveSessionIdentity, type SessionIdentity, } from "./sessionIdentity"; | ||
| export { fetchTenantsAndOrganizations, type Tenant, type TenantsAndOrganizations, } from "./tenantSelection"; | ||
@@ -18,0 +18,0 @@ export * from "./tokenRefresh"; |
@@ -5,2 +5,3 @@ import { getFileSystem } from "@uipath/filesystem"; | ||
| import { tryRobotClientFallback } from "./robotClientFallback"; | ||
| import { type SessionIdentity } from "./sessionIdentity"; | ||
| import { refreshAccessToken } from "./tokenRefresh"; | ||
@@ -14,6 +15,11 @@ import { loadEnvFileAsync, resolveEnvFilePathAsync, saveEnvFileAsync } from "./utils/envFile"; | ||
| export type LoginStatusValue = "Logged in" | "Not logged in" | "Expired" | "Refresh Failed"; | ||
| export declare enum LoginStatusSource { | ||
| File = "file", | ||
| /** | ||
| * Where the CLI read the credential from — not who is acting and not how they | ||
| * authenticated. See {@link SessionIdentity} for those; the three are | ||
| * independent (a `Robot` credential normally carries a `User` identity). | ||
| */ | ||
| export declare enum CredentialSource { | ||
| SavedLogin = "saved-login", | ||
| Robot = "robot", | ||
| Env = "env" | ||
| EnvironmentVariables = "env-vars" | ||
| } | ||
@@ -43,4 +49,11 @@ export interface TokenRefreshTelemetry { | ||
| hint?: string; | ||
| source?: LoginStatusSource; | ||
| source?: CredentialSource; | ||
| /** | ||
| * Who the session acts as, read from the access token's claims. Present | ||
| * whenever a token is available to derive it from — including `"Expired"`, | ||
| * so the user can see whose session lapsed. Display only: the claims are | ||
| * not signature-verified. | ||
| */ | ||
| identity?: SessionIdentity; | ||
| /** | ||
| * True when a refresh rotated successfully at the identity server but | ||
@@ -47,0 +60,0 @@ * persisting the new pair to disk failed. The returned `accessToken` is |
+2
-2
@@ -1,2 +0,3 @@ | ||
| export declare const AUTH_TIMEOUT_ERROR_CODE = "EAUTHTIMEOUT"; | ||
| import { AUTH_TIMEOUT_ERROR_CODE } from "./constants"; | ||
| export { AUTH_TIMEOUT_ERROR_CODE }; | ||
| interface StartCallbackServerProps { | ||
@@ -15,2 +16,1 @@ redirectUri: URL; | ||
| export declare const startServer: ({ redirectUri, timeoutMs, onListening, signal, }: StartCallbackServerProps) => Promise<URL>; | ||
| export {}; |
+2
-2
| { | ||
| "name": "@uipath/auth", | ||
| "license": "MIT", | ||
| "version": "1.200.0-preview.109", | ||
| "version": "1.201.0-preview.115", | ||
| "repository": { | ||
@@ -40,3 +40,3 @@ "type": "git", | ||
| ], | ||
| "gitHead": "fcc01cdae81bbd0c25d3d4fc287537a9d19d99f4" | ||
| "gitHead": "f1086b73654d7728cb71f280588b3e0c77d535fc" | ||
| } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1171439
0.73%35
2.94%25273
0.86%