@finueva/auth 0.20.0 → 0.21.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/device.d.ts +1 -1
- package/dist/device.js +9 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +137 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +9 -1
- package/dist/{types-Cv_qxcBP.d.ts → types-sJ_vACZ3.d.ts} +54 -2
- package/package.json +1 -1
package/dist/device.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as
|
|
1
|
+
import { $ as PasskeyInventory, At as UpdateOrganizationDisplayInput, B as OrganizationDisplay, C as CreatedOrganizationTeam, Dt as TwoFactorStatus, Ft as AuthErrorCode, G as OrganizationMemberPage, H as OrganizationInvitationPage, It as AuthErrorStatus, J as OrganizationTeam, K as OrganizationPage, Lt as UserApiCredential, Mt as UpdateProfileInput, O as DriveCredential, Pt as AuthError, Rt as UserApiCredentialInput, S as CreatedOrganizationMemberInvitation, St as SocialIdTokenProvider, U as OrganizationMember, V as OrganizationInvitation, W as OrganizationMemberAuthority, X as OrganizationTeamMemberPage, Y as OrganizationTeamDisplay, Z as OrganizationTeamPage, b as CreateOrganizationMemberInvitationInput, c as AuthSessionInventory, i as AuthOrganization, jt as UpdateOrganizationTeamDisplayInput, k as DriveCredentialInput, lt as ReceivedOrganizationInvitation, m as CeremonyHandoffInput, p as CeremonyHandoff, q as OrganizationPageInput, s as AuthSession, ut as ReceivedOrganizationInvitationPage, x as CreatedOrganization, xt as SocialIdTokenInput } from "./types-sJ_vACZ3.js";
|
|
2
2
|
//#region src/device.d.ts
|
|
3
3
|
type DeviceAuthorizationErrorCode = "device_access_denied" | "device_authorization_cancelled" | "device_code_expired" | "invalid_device_authorization" | "identity_authority_unavailable";
|
|
4
4
|
declare class DeviceAuthorizationError extends Error {
|
package/dist/device.js
CHANGED
|
@@ -178,6 +178,7 @@ const messages = {
|
|
|
178
178
|
invalid_credentials: "The credentials are invalid.",
|
|
179
179
|
invalid_auth_input: "The authentication input is invalid.",
|
|
180
180
|
account_conflict: "The account is not available.",
|
|
181
|
+
social_signup_required: "No account is available for this social sign-in. Start sign-up to create one.",
|
|
181
182
|
google_recovery_in_progress: "A Google connection is already being completed. Return to that sign-in, or wait up to ten minutes and restart.",
|
|
182
183
|
google_recovery_not_required: "Google account recovery is not required.",
|
|
183
184
|
google_recovery_invalid: "The Google account recovery request is invalid.",
|
|
@@ -198,6 +199,7 @@ const messages = {
|
|
|
198
199
|
organization_context_too_large: "The organization context is too large.",
|
|
199
200
|
credential_rate_limited: "Credential requests are temporarily limited.",
|
|
200
201
|
auth_request_rate_limited: "Authentication requests are temporarily limited.",
|
|
202
|
+
organization_slug_unavailable: "The organization address is unavailable.",
|
|
201
203
|
state_conflict: "The authentication state conflicts with the request.",
|
|
202
204
|
access_denied: "Access is denied.",
|
|
203
205
|
platform_target_unavailable: "The platform administration target is unavailable.",
|
|
@@ -653,7 +655,12 @@ function fromAccountAuthorityError(value, status, retryAfter) {
|
|
|
653
655
|
function fromSocialIdTokenAuthorityError(value, status, retryAfter) {
|
|
654
656
|
const code = isObject(value) && typeof value.code === "string" ? value.code : void 0;
|
|
655
657
|
if (code === "INVALID_TOKEN" || code === "FAILED_TO_GET_USER_INFO" || code === "USER_EMAIL_NOT_FOUND") return new AuthError("invalid_credentials", 401);
|
|
656
|
-
if (code === "OAUTH_LINK_ERROR")
|
|
658
|
+
if (code === "OAUTH_LINK_ERROR") {
|
|
659
|
+
const message = isObject(value) && typeof value.message === "string" ? value.message : void 0;
|
|
660
|
+
if (message === "account not linked") return new AuthError("account_conflict", 409);
|
|
661
|
+
if (message === "signup disabled") return new AuthError("social_signup_required", 409);
|
|
662
|
+
return authorityUnavailable();
|
|
663
|
+
}
|
|
657
664
|
return fromAccountAuthorityError(value, status, retryAfter);
|
|
658
665
|
}
|
|
659
666
|
function authorityUnavailable() {
|
|
@@ -667,6 +674,7 @@ function fromOrganizationReadAuthorityError(value, status) {
|
|
|
667
674
|
}
|
|
668
675
|
function fromOrganizationMutationAuthorityError(value, status, retryAfter) {
|
|
669
676
|
if (status === 400 || status === 413 || status === 415) return new AuthError("invalid_request", 400);
|
|
677
|
+
if (status === 409 && isObject(value) && value.code === "ORGANIZATION_SLUG_UNAVAILABLE") return new AuthError("organization_slug_unavailable", 409);
|
|
670
678
|
if (status === 409) return new AuthError("state_conflict", 409);
|
|
671
679
|
if (status === 429) return new AuthError("auth_request_rate_limited", 429, parseRetryAfter(retryAfter));
|
|
672
680
|
const code = isObject(value) && typeof value.code === "string" ? value.code : void 0;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as PasskeyInventory, A as EnterpriseConnection, At as UpdateOrganizationDisplayInput, B as OrganizationDisplay, C as CreatedOrganizationTeam, Ct as SuspendedOrganizationMember, D as DepartedOrganizationMemberPage, Dt as TwoFactorStatus, E as DepartedOrganizationMember, Et as TwoFactorEnrollment, F as InvitationDecline, Ft as AuthErrorCode, G as OrganizationMemberPage, H as OrganizationInvitationPage, I as OrganizationClosure, It as AuthErrorStatus, J as OrganizationTeam, K as OrganizationPage, L as OrganizationClosureCancelInput, Lt as UserApiCredential, M as EnterpriseConnectionSetup, Mt as UpdateProfileInput, N as FinuevaAuthClient, Nt as WorkspaceSelection, O as DriveCredential, Ot as TwoFactorStepUpInput, P as InvitationAcceptance, Pt as AuthError, Q as OrganizationWorkspaceSelection, R as OrganizationClosureStartInput, Rt as UserApiCredentialInput, S as CreatedOrganizationMemberInvitation, St as SocialIdTokenProvider, T as DeletedOrganizationTeam, Tt as SuspendedOrganizationMemberStatus, U as OrganizationMember, V as OrganizationInvitation, W as OrganizationMemberAuthority, X as OrganizationTeamMemberPage, Y as OrganizationTeamDisplay, Z as OrganizationTeamPage, _ as ClosingOrganization, _t as ScimCredentialIssuance, a as AuthPersistence, at as PlatformRoleApproval, b as CreateOrganizationMemberInvitationInput, bt as SignInInput, c as AuthSessionInventory, ct as PlatformStatus, d as AuthUser, dt as RecentAuthenticationStatus, et as PasskeySummary, f as CanceledOrganizationInvitation, ft as RemovedOrganizationMember, g as CeremonyReturnInput, gt as RotateScimCredentialInput, h as CeremonyRecentAuthenticationRequest, ht as RestoredOrganizationMember, i as AuthOrganization, it as PlatformRoleApplied, j as EnterpriseConnectionAction, jt as UpdateOrganizationTeamDisplayInput, k as DriveCredentialInput, kt as UpdateEnterpriseConnectionInput, l as AuthSessionSummary, lt as ReceivedOrganizationInvitation, m as CeremonyHandoffInput, mt as ResentOrganizationInvitation, n as AddedOrganizationTeamMember, nt as PlatformBootstrapRoleChangeInput, o as AuthPersistenceDriver, ot as PlatformRoleChangeRecentAuthenticationInput, p as CeremonyHandoff, pt as RemovedOrganizationTeamMember, q as OrganizationPageInput, r as AuthClientOptions, rt as PlatformRole, s as AuthSession, st as PlatformRoleFirstApproval, t as AcceptInvitationInput, tt as PersonalWorkspaceSelection, u as AuthState, ut as ReceivedOrganizationInvitationPage, v as ClosingOrganizationList, vt as ScimCredentialState, w as DeclineInvitationInput, wt as SuspendedOrganizationMemberPage, x as CreatedOrganization, xt as SocialIdTokenInput, y as CreateEnterpriseConnectionInput, yt as SendVerificationEmailInput, z as OrganizationDeparture } from "./types-sJ_vACZ3.js";
|
|
2
2
|
//#region src/client.d.ts
|
|
3
3
|
declare function createAuthClient(options: AuthClientOptions): FinuevaAuthClient;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { type AcceptInvitationInput, type AddedOrganizationTeamMember, type AuthClientOptions, AuthError, type AuthErrorCode, type AuthErrorStatus, type AuthOrganization, type AuthPersistence, type AuthPersistenceDriver, type AuthSession, type AuthSessionInventory, type AuthSessionSummary, type AuthState, type AuthUser, type CanceledOrganizationInvitation, type CeremonyHandoff, type CeremonyHandoffInput, type CeremonyRecentAuthenticationRequest, type CeremonyReturnInput, type ClosingOrganization, type ClosingOrganizationList, type CreateOrganizationMemberInvitationInput, type CreatedOrganization, type CreatedOrganizationMemberInvitation, type CreatedOrganizationTeam, type DeclineInvitationInput, type DeletedOrganizationTeam, type DepartedOrganizationMember, type DepartedOrganizationMemberPage, type DriveCredential, type DriveCredentialInput, type EnterpriseConnection, type FinuevaAuthClient, type InvitationAcceptance, type InvitationDecline, type OrganizationClosure, type OrganizationClosureCancelInput, type OrganizationClosureStartInput, type OrganizationDeparture, type OrganizationDisplay, type OrganizationInvitation, type OrganizationInvitationPage, type OrganizationMember, type OrganizationMemberAuthority, type OrganizationMemberPage, type OrganizationPage, type OrganizationPageInput, type OrganizationTeam, type OrganizationTeamDisplay, type OrganizationTeamMemberPage, type OrganizationTeamPage, type OrganizationWorkspaceSelection, type PasskeyInventory, type PasskeySummary, type PersonalWorkspaceSelection, type PlatformBootstrapRoleChangeInput, type PlatformRole, type PlatformRoleApplied, type PlatformRoleApproval, type PlatformRoleChangeRecentAuthenticationInput, type PlatformRoleFirstApproval, type PlatformStatus, type ReceivedOrganizationInvitation, type ReceivedOrganizationInvitationPage, type RecentAuthenticationStatus, type RemovedOrganizationMember, type RemovedOrganizationTeamMember, type ResentOrganizationInvitation, type RestoredOrganizationMember, type RotateScimCredentialInput, type ScimCredentialIssuance, type ScimCredentialState, type SendVerificationEmailInput, type SignInInput, type SocialIdTokenInput, type SocialIdTokenProvider, type SuspendedOrganizationMember, type SuspendedOrganizationMemberPage, type SuspendedOrganizationMemberStatus, type TwoFactorEnrollment, type TwoFactorStatus, type TwoFactorStepUpInput, type UpdateOrganizationDisplayInput, type UpdateOrganizationTeamDisplayInput, type UpdateProfileInput, type UserApiCredential, type UserApiCredentialInput, type WorkspaceSelection, createAuthClient };
|
|
5
|
+
export { type AcceptInvitationInput, type AddedOrganizationTeamMember, type AuthClientOptions, AuthError, type AuthErrorCode, type AuthErrorStatus, type AuthOrganization, type AuthPersistence, type AuthPersistenceDriver, type AuthSession, type AuthSessionInventory, type AuthSessionSummary, type AuthState, type AuthUser, type CanceledOrganizationInvitation, type CeremonyHandoff, type CeremonyHandoffInput, type CeremonyRecentAuthenticationRequest, type CeremonyReturnInput, type ClosingOrganization, type ClosingOrganizationList, type CreateEnterpriseConnectionInput, type CreateOrganizationMemberInvitationInput, type CreatedOrganization, type CreatedOrganizationMemberInvitation, type CreatedOrganizationTeam, type DeclineInvitationInput, type DeletedOrganizationTeam, type DepartedOrganizationMember, type DepartedOrganizationMemberPage, type DriveCredential, type DriveCredentialInput, type EnterpriseConnection, type EnterpriseConnectionAction, type EnterpriseConnectionSetup, type FinuevaAuthClient, type InvitationAcceptance, type InvitationDecline, type OrganizationClosure, type OrganizationClosureCancelInput, type OrganizationClosureStartInput, type OrganizationDeparture, type OrganizationDisplay, type OrganizationInvitation, type OrganizationInvitationPage, type OrganizationMember, type OrganizationMemberAuthority, type OrganizationMemberPage, type OrganizationPage, type OrganizationPageInput, type OrganizationTeam, type OrganizationTeamDisplay, type OrganizationTeamMemberPage, type OrganizationTeamPage, type OrganizationWorkspaceSelection, type PasskeyInventory, type PasskeySummary, type PersonalWorkspaceSelection, type PlatformBootstrapRoleChangeInput, type PlatformRole, type PlatformRoleApplied, type PlatformRoleApproval, type PlatformRoleChangeRecentAuthenticationInput, type PlatformRoleFirstApproval, type PlatformStatus, type ReceivedOrganizationInvitation, type ReceivedOrganizationInvitationPage, type RecentAuthenticationStatus, type RemovedOrganizationMember, type RemovedOrganizationTeamMember, type ResentOrganizationInvitation, type RestoredOrganizationMember, type RotateScimCredentialInput, type ScimCredentialIssuance, type ScimCredentialState, type SendVerificationEmailInput, type SignInInput, type SocialIdTokenInput, type SocialIdTokenProvider, type SuspendedOrganizationMember, type SuspendedOrganizationMemberPage, type SuspendedOrganizationMemberStatus, type TwoFactorEnrollment, type TwoFactorStatus, type TwoFactorStepUpInput, type UpdateEnterpriseConnectionInput, type UpdateOrganizationDisplayInput, type UpdateOrganizationTeamDisplayInput, type UpdateProfileInput, type UserApiCredential, type UserApiCredentialInput, type WorkspaceSelection, createAuthClient };
|
package/dist/index.js
CHANGED
|
@@ -2537,6 +2537,7 @@ const messages = {
|
|
|
2537
2537
|
invalid_credentials: "The credentials are invalid.",
|
|
2538
2538
|
invalid_auth_input: "The authentication input is invalid.",
|
|
2539
2539
|
account_conflict: "The account is not available.",
|
|
2540
|
+
social_signup_required: "No account is available for this social sign-in. Start sign-up to create one.",
|
|
2540
2541
|
google_recovery_in_progress: "A Google connection is already being completed. Return to that sign-in, or wait up to ten minutes and restart.",
|
|
2541
2542
|
google_recovery_not_required: "Google account recovery is not required.",
|
|
2542
2543
|
google_recovery_invalid: "The Google account recovery request is invalid.",
|
|
@@ -2557,6 +2558,7 @@ const messages = {
|
|
|
2557
2558
|
organization_context_too_large: "The organization context is too large.",
|
|
2558
2559
|
credential_rate_limited: "Credential requests are temporarily limited.",
|
|
2559
2560
|
auth_request_rate_limited: "Authentication requests are temporarily limited.",
|
|
2561
|
+
organization_slug_unavailable: "The organization address is unavailable.",
|
|
2560
2562
|
state_conflict: "The authentication state conflicts with the request.",
|
|
2561
2563
|
access_denied: "Access is denied.",
|
|
2562
2564
|
platform_target_unavailable: "The platform administration target is unavailable.",
|
|
@@ -3434,7 +3436,12 @@ function fromAccountAuthorityError(value, status, retryAfter) {
|
|
|
3434
3436
|
function fromSocialIdTokenAuthorityError(value, status, retryAfter) {
|
|
3435
3437
|
const code = isObject(value) && typeof value.code === "string" ? value.code : void 0;
|
|
3436
3438
|
if (code === "INVALID_TOKEN" || code === "FAILED_TO_GET_USER_INFO" || code === "USER_EMAIL_NOT_FOUND") return new AuthError("invalid_credentials", 401);
|
|
3437
|
-
if (code === "OAUTH_LINK_ERROR")
|
|
3439
|
+
if (code === "OAUTH_LINK_ERROR") {
|
|
3440
|
+
const message = isObject(value) && typeof value.message === "string" ? value.message : void 0;
|
|
3441
|
+
if (message === "account not linked") return new AuthError("account_conflict", 409);
|
|
3442
|
+
if (message === "signup disabled") return new AuthError("social_signup_required", 409);
|
|
3443
|
+
return authorityUnavailable();
|
|
3444
|
+
}
|
|
3438
3445
|
return fromAccountAuthorityError(value, status, retryAfter);
|
|
3439
3446
|
}
|
|
3440
3447
|
function authorityUnavailable() {
|
|
@@ -3453,6 +3460,7 @@ function fromOrganizationReadAuthorityError(value, status) {
|
|
|
3453
3460
|
}
|
|
3454
3461
|
function fromOrganizationMutationAuthorityError(value, status, retryAfter) {
|
|
3455
3462
|
if (status === 400 || status === 413 || status === 415) return new AuthError("invalid_request", 400);
|
|
3463
|
+
if (status === 409 && isObject(value) && value.code === "ORGANIZATION_SLUG_UNAVAILABLE") return new AuthError("organization_slug_unavailable", 409);
|
|
3456
3464
|
if (status === 409) return new AuthError("state_conflict", 409);
|
|
3457
3465
|
if (status === 429) return new AuthError("auth_request_rate_limited", 429, parseRetryAfter(retryAfter));
|
|
3458
3466
|
const code = isObject(value) && typeof value.code === "string" ? value.code : void 0;
|
|
@@ -5083,6 +5091,75 @@ function fromEnterpriseAdministrationError(value, status, retryAfter) {
|
|
|
5083
5091
|
if (status === 429) return new AuthError("auth_request_rate_limited", 429, parseRetryAfter(retryAfter));
|
|
5084
5092
|
return authorityUnavailable();
|
|
5085
5093
|
}
|
|
5094
|
+
const setupKeys = [
|
|
5095
|
+
"id",
|
|
5096
|
+
"revision",
|
|
5097
|
+
"issuer",
|
|
5098
|
+
"clientId",
|
|
5099
|
+
"enabled",
|
|
5100
|
+
"memberJit",
|
|
5101
|
+
"domain",
|
|
5102
|
+
"domainVerified",
|
|
5103
|
+
"validatedAt",
|
|
5104
|
+
"testedAt",
|
|
5105
|
+
"dnsRecordName",
|
|
5106
|
+
"dnsRecordValue",
|
|
5107
|
+
"challengeExpiresAt",
|
|
5108
|
+
"redirectUri"
|
|
5109
|
+
];
|
|
5110
|
+
function normalizeEnterpriseConnectionSetup(value) {
|
|
5111
|
+
if (!exact(value, setupKeys) || typeof value.id !== "string" || !idPattern.test(value.id) || typeof value.issuer !== "string" || value.issuer.length > 2048 || !value.issuer.startsWith("https://") || typeof value.clientId !== "string" || value.clientId.length < 1 || value.clientId.length > 256 || typeof value.domain !== "string" || !/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/.test(value.domain) || value.domain.length > 253 || value.dnsRecordName !== `_finueva-sso.${value.domain}` || typeof value.dnsRecordValue !== "string" || !/^finueva-sso=[A-Za-z0-9_-]{43}$/.test(value.dnsRecordValue) || typeof value.redirectUri !== "string" || value.redirectUri.length > 2048 || !Number.isSafeInteger(value.revision) || value.revision < 0) throw authorityUnavailable();
|
|
5112
|
+
let redirect;
|
|
5113
|
+
try {
|
|
5114
|
+
redirect = new URL(value.redirectUri);
|
|
5115
|
+
} catch {
|
|
5116
|
+
throw authorityUnavailable();
|
|
5117
|
+
}
|
|
5118
|
+
if (redirect.protocol !== "https:" || redirect.username || redirect.password || redirect.search || redirect.hash || !redirect.pathname.endsWith(`/enterprise/callback/${value.id}`)) throw authorityUnavailable();
|
|
5119
|
+
return {
|
|
5120
|
+
id: value.id,
|
|
5121
|
+
revision: value.revision,
|
|
5122
|
+
issuer: value.issuer,
|
|
5123
|
+
clientId: value.clientId,
|
|
5124
|
+
enabled: bool(value.enabled),
|
|
5125
|
+
memberJit: bool(value.memberJit),
|
|
5126
|
+
domain: value.domain,
|
|
5127
|
+
domainVerified: bool(value.domainVerified),
|
|
5128
|
+
validatedAt: date(value.validatedAt, true),
|
|
5129
|
+
testedAt: date(value.testedAt, true),
|
|
5130
|
+
dnsRecordName: value.dnsRecordName,
|
|
5131
|
+
dnsRecordValue: value.dnsRecordValue,
|
|
5132
|
+
challengeExpiresAt: date(value.challengeExpiresAt, false),
|
|
5133
|
+
redirectUri: value.redirectUri
|
|
5134
|
+
};
|
|
5135
|
+
}
|
|
5136
|
+
function normalizeEnterpriseConnectionSetups(value) {
|
|
5137
|
+
if (!exact(value, ["connections"]) || !Array.isArray(value.connections) || value.connections.length > 10) throw authorityUnavailable();
|
|
5138
|
+
return value.connections.map(normalizeEnterpriseConnectionSetup);
|
|
5139
|
+
}
|
|
5140
|
+
function normalizeEnterpriseConnectionAction(value) {
|
|
5141
|
+
if (exact(value, ["removed"]) && value.removed === true) return { removed: true };
|
|
5142
|
+
return normalizeEnterpriseConnectionSetup(value);
|
|
5143
|
+
}
|
|
5144
|
+
function enterpriseInputString(value, max) {
|
|
5145
|
+
if (typeof value !== "string" || value.length < 1 || value.length > max) throw new TypeError("Enterprise configuration is invalid");
|
|
5146
|
+
return value;
|
|
5147
|
+
}
|
|
5148
|
+
function enterpriseInputBoolean(value) {
|
|
5149
|
+
if (typeof value !== "boolean") throw new TypeError("Enterprise configuration is invalid");
|
|
5150
|
+
return value;
|
|
5151
|
+
}
|
|
5152
|
+
function normalizeEnterpriseTestAuthorization(value) {
|
|
5153
|
+
if (!exact(value, ["url"]) || typeof value.url !== "string" || value.url.length > 16384) throw authorityUnavailable();
|
|
5154
|
+
let url;
|
|
5155
|
+
try {
|
|
5156
|
+
url = new URL(value.url);
|
|
5157
|
+
} catch {
|
|
5158
|
+
throw authorityUnavailable();
|
|
5159
|
+
}
|
|
5160
|
+
if (url.protocol !== "https:" || url.username || url.password || url.hash || !url.searchParams.get("state") || url.searchParams.get("response_type") !== "code") throw authorityUnavailable();
|
|
5161
|
+
return { url: value.url };
|
|
5162
|
+
}
|
|
5086
5163
|
//#endregion
|
|
5087
5164
|
//#region src/user-api/credential.ts
|
|
5088
5165
|
function userApiApplication(input) {
|
|
@@ -6084,6 +6161,65 @@ function createAuthClient(options) {
|
|
|
6084
6161
|
async listEnterpriseConnections(organizationId) {
|
|
6085
6162
|
return enterpriseRequest("GET", `${normalizeIdInput(organizationId)}/connections`, void 0, normalizeEnterpriseConnections);
|
|
6086
6163
|
},
|
|
6164
|
+
async startEnterpriseConnectionTest(organizationId, connectionId, input) {
|
|
6165
|
+
if (signOutRequest || activeAccountMutationGeneration !== void 0 || invitationRequest) throw new AuthError("state_conflict", 409);
|
|
6166
|
+
const generation = authorityGeneration;
|
|
6167
|
+
const value = await requestJson(joinURL(authOrigin, "api/v1/auth/enterprise/test-sign-in"), {
|
|
6168
|
+
fetch: fetchImpl,
|
|
6169
|
+
timeoutMs,
|
|
6170
|
+
method: "POST",
|
|
6171
|
+
headers: { "content-type": "application/json" },
|
|
6172
|
+
body: {
|
|
6173
|
+
organizationId: normalizeIdInput(organizationId),
|
|
6174
|
+
connectionId: normalizeIdInput(connectionId),
|
|
6175
|
+
expectedRevision: normalizeRevision(input?.expectedRevision),
|
|
6176
|
+
applicationId: normalizeIdInput(input?.applicationId),
|
|
6177
|
+
returnTo: enterpriseInputString(input?.returnTo, 2048)
|
|
6178
|
+
},
|
|
6179
|
+
mapError: fromEnterpriseAdministrationError
|
|
6180
|
+
});
|
|
6181
|
+
if (generation !== authorityGeneration) throw new AuthError("state_conflict", 409);
|
|
6182
|
+
return normalizeEnterpriseTestAuthorization(value);
|
|
6183
|
+
},
|
|
6184
|
+
async listEnterpriseConnectionSetups(organizationId) {
|
|
6185
|
+
return enterpriseRequest("GET", `${normalizeIdInput(organizationId)}/connection-setup`, void 0, normalizeEnterpriseConnectionSetups);
|
|
6186
|
+
},
|
|
6187
|
+
async createEnterpriseConnection(organizationId, input) {
|
|
6188
|
+
const body = {
|
|
6189
|
+
requestId: enterpriseInputString(input?.requestId, 36),
|
|
6190
|
+
issuer: enterpriseInputString(input?.issuer, 2048),
|
|
6191
|
+
clientId: enterpriseInputString(input?.clientId, 256),
|
|
6192
|
+
clientSecret: enterpriseInputString(input?.clientSecret, 512),
|
|
6193
|
+
domain: enterpriseInputString(input?.domain, 253),
|
|
6194
|
+
memberJit: enterpriseInputBoolean(input?.memberJit)
|
|
6195
|
+
};
|
|
6196
|
+
return enterpriseRequest("POST", `${normalizeIdInput(organizationId)}/connection-setup`, body, normalizeEnterpriseConnectionSetup);
|
|
6197
|
+
},
|
|
6198
|
+
async updateEnterpriseConnection(organizationId, connectionId, input) {
|
|
6199
|
+
const body = {
|
|
6200
|
+
expectedRevision: normalizeRevision(input?.expectedRevision),
|
|
6201
|
+
issuer: enterpriseInputString(input?.issuer, 2048),
|
|
6202
|
+
clientId: enterpriseInputString(input?.clientId, 256),
|
|
6203
|
+
memberJit: enterpriseInputBoolean(input?.memberJit),
|
|
6204
|
+
...input?.clientSecret === void 0 ? {} : { clientSecret: enterpriseInputString(input.clientSecret, 512) }
|
|
6205
|
+
};
|
|
6206
|
+
return enterpriseRequest("POST", `${normalizeIdInput(organizationId)}/connection-setup/${normalizeIdInput(connectionId)}`, body, normalizeEnterpriseConnectionSetup);
|
|
6207
|
+
},
|
|
6208
|
+
async actOnEnterpriseConnection(organizationId, connectionId, input) {
|
|
6209
|
+
if (![
|
|
6210
|
+
"challenge",
|
|
6211
|
+
"verify",
|
|
6212
|
+
"validate",
|
|
6213
|
+
"enable",
|
|
6214
|
+
"disable",
|
|
6215
|
+
"archive"
|
|
6216
|
+
].includes(input?.action)) throw new TypeError("Enterprise action is invalid");
|
|
6217
|
+
const body = {
|
|
6218
|
+
expectedRevision: normalizeRevision(input?.expectedRevision),
|
|
6219
|
+
action: input.action
|
|
6220
|
+
};
|
|
6221
|
+
return enterpriseRequest("POST", `${normalizeIdInput(organizationId)}/connection-setup/${normalizeIdInput(connectionId)}/actions`, body, normalizeEnterpriseConnectionAction);
|
|
6222
|
+
},
|
|
6087
6223
|
async getScimCredential(organizationId, connectionId) {
|
|
6088
6224
|
return enterpriseRequest("GET", scimCredentialPath(organizationId, connectionId), void 0, (value) => normalizeScimCredentialState(value));
|
|
6089
6225
|
},
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as
|
|
1
|
+
import { At as UpdateOrganizationDisplayInput, B as OrganizationDisplay, C as CreatedOrganizationTeam, F as InvitationDecline, Ft as AuthErrorCode, G as OrganizationMemberPage, H as OrganizationInvitationPage, It as AuthErrorStatus, J as OrganizationTeam, K as OrganizationPage, Lt as UserApiCredential, Nt as WorkspaceSelection, O as DriveCredential, P as InvitationAcceptance, Pt as AuthError, Q as OrganizationWorkspaceSelection, Rt as UserApiCredentialInput, S as CreatedOrganizationMemberInvitation, St as SocialIdTokenProvider, T as DeletedOrganizationTeam, U as OrganizationMember, V as OrganizationInvitation, W as OrganizationMemberAuthority, X as OrganizationTeamMemberPage, Y as OrganizationTeamDisplay, Z as OrganizationTeamPage, b as CreateOrganizationMemberInvitationInput, d as AuthUser, f as CanceledOrganizationInvitation, ft as RemovedOrganizationMember, i as AuthOrganization, jt as UpdateOrganizationTeamDisplayInput, k as DriveCredentialInput, lt as ReceivedOrganizationInvitation, mt as ResentOrganizationInvitation, n as AddedOrganizationTeamMember, pt as RemovedOrganizationTeamMember, q as OrganizationPageInput, s as AuthSession, t as AcceptInvitationInput, tt as PersonalWorkspaceSelection, ut as ReceivedOrganizationInvitationPage, w as DeclineInvitationInput, x as CreatedOrganization, xt as SocialIdTokenInput, z as OrganizationDeparture } from "./types-sJ_vACZ3.js";
|
|
2
2
|
//#region src/google-recovery.d.ts
|
|
3
3
|
interface GoogleAccountRecoveryInput {
|
|
4
4
|
idToken: {
|
package/dist/server.js
CHANGED
|
@@ -3,6 +3,7 @@ const messages = {
|
|
|
3
3
|
invalid_credentials: "The credentials are invalid.",
|
|
4
4
|
invalid_auth_input: "The authentication input is invalid.",
|
|
5
5
|
account_conflict: "The account is not available.",
|
|
6
|
+
social_signup_required: "No account is available for this social sign-in. Start sign-up to create one.",
|
|
6
7
|
google_recovery_in_progress: "A Google connection is already being completed. Return to that sign-in, or wait up to ten minutes and restart.",
|
|
7
8
|
google_recovery_not_required: "Google account recovery is not required.",
|
|
8
9
|
google_recovery_invalid: "The Google account recovery request is invalid.",
|
|
@@ -23,6 +24,7 @@ const messages = {
|
|
|
23
24
|
organization_context_too_large: "The organization context is too large.",
|
|
24
25
|
credential_rate_limited: "Credential requests are temporarily limited.",
|
|
25
26
|
auth_request_rate_limited: "Authentication requests are temporarily limited.",
|
|
27
|
+
organization_slug_unavailable: "The organization address is unavailable.",
|
|
26
28
|
state_conflict: "The authentication state conflicts with the request.",
|
|
27
29
|
access_denied: "Access is denied.",
|
|
28
30
|
platform_target_unavailable: "The platform administration target is unavailable.",
|
|
@@ -518,7 +520,12 @@ function fromAccountAuthorityError(value, status, retryAfter) {
|
|
|
518
520
|
function fromSocialIdTokenAuthorityError(value, status, retryAfter) {
|
|
519
521
|
const code = isObject$1(value) && typeof value.code === "string" ? value.code : void 0;
|
|
520
522
|
if (code === "INVALID_TOKEN" || code === "FAILED_TO_GET_USER_INFO" || code === "USER_EMAIL_NOT_FOUND") return new AuthError("invalid_credentials", 401);
|
|
521
|
-
if (code === "OAUTH_LINK_ERROR")
|
|
523
|
+
if (code === "OAUTH_LINK_ERROR") {
|
|
524
|
+
const message = isObject$1(value) && typeof value.message === "string" ? value.message : void 0;
|
|
525
|
+
if (message === "account not linked") return new AuthError("account_conflict", 409);
|
|
526
|
+
if (message === "signup disabled") return new AuthError("social_signup_required", 409);
|
|
527
|
+
return authorityUnavailable();
|
|
528
|
+
}
|
|
522
529
|
return fromAccountAuthorityError(value, status, retryAfter);
|
|
523
530
|
}
|
|
524
531
|
function authorityUnavailable() {
|
|
@@ -537,6 +544,7 @@ function fromOrganizationReadAuthorityError(value, status) {
|
|
|
537
544
|
}
|
|
538
545
|
function fromOrganizationMutationAuthorityError(value, status, retryAfter) {
|
|
539
546
|
if (status === 400 || status === 413 || status === 415) return new AuthError("invalid_request", 400);
|
|
547
|
+
if (status === 409 && isObject$1(value) && value.code === "ORGANIZATION_SLUG_UNAVAILABLE") return new AuthError("organization_slug_unavailable", 409);
|
|
540
548
|
if (status === 409) return new AuthError("state_conflict", 409);
|
|
541
549
|
if (status === 429) return new AuthError("auth_request_rate_limited", 429, parseRetryAfter(retryAfter));
|
|
542
550
|
const code = isObject$1(value) && typeof value.code === "string" ? value.code : void 0;
|
|
@@ -10,7 +10,7 @@ interface UserApiCredential {
|
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/errors.d.ts
|
|
13
|
-
type AuthErrorCode = "invalid_credentials" | "invalid_auth_input" | "account_conflict" | "google_recovery_in_progress" | "google_recovery_not_required" | "google_recovery_invalid" | "google_recovery_expired" | "google_recovery_account_mismatch" | "password_reset_invalid" | "authentication_required" | "request_origin_denied" | "invalid_request" | "invalid_invitation" | "invitation_unavailable" | "recipient_unavailable" | "invitation_recipient_mismatch" | "invitation_recovery_required" | "membership_removal_recovery_required" | "email_verification_required" | "invalid_workspace_selection" | "organization_context_too_large" | "credential_rate_limited" | "auth_request_rate_limited" | "state_conflict" | "access_denied" | "platform_target_unavailable" | "platform_quorum_unavailable" | "platform_recovery_required" | "identity_authority_unavailable" | "two_factor_required" | "two_factor_code_invalid" | "two_factor_challenge_expired" | "two_factor_locked" | "recent_sign_in_required" | "enterprise_recovery_required" | "recent_authentication_required" | "organization_closure_confirmation_mismatch" | "organization_closure_cancellation_ended" | "ceremony_return_refused" | "password_sign_in_required";
|
|
13
|
+
type AuthErrorCode = "invalid_credentials" | "invalid_auth_input" | "account_conflict" | "social_signup_required" | "google_recovery_in_progress" | "google_recovery_not_required" | "google_recovery_invalid" | "google_recovery_expired" | "google_recovery_account_mismatch" | "password_reset_invalid" | "authentication_required" | "request_origin_denied" | "invalid_request" | "invalid_invitation" | "invitation_unavailable" | "recipient_unavailable" | "invitation_recipient_mismatch" | "invitation_recovery_required" | "membership_removal_recovery_required" | "email_verification_required" | "invalid_workspace_selection" | "organization_context_too_large" | "credential_rate_limited" | "auth_request_rate_limited" | "organization_slug_unavailable" | "state_conflict" | "access_denied" | "platform_target_unavailable" | "platform_quorum_unavailable" | "platform_recovery_required" | "identity_authority_unavailable" | "two_factor_required" | "two_factor_code_invalid" | "two_factor_challenge_expired" | "two_factor_locked" | "recent_sign_in_required" | "enterprise_recovery_required" | "recent_authentication_required" | "organization_closure_confirmation_mismatch" | "organization_closure_cancellation_ended" | "ceremony_return_refused" | "password_sign_in_required";
|
|
14
14
|
type AuthErrorStatus = 400 | 401 | 403 | 404 | 405 | 409 | 410 | 413 | 415 | 422 | 429 | 503;
|
|
15
15
|
declare class AuthError extends Error {
|
|
16
16
|
readonly code: AuthErrorCode;
|
|
@@ -346,6 +346,41 @@ interface EnterpriseConnection {
|
|
|
346
346
|
roleMappingConfigured: boolean;
|
|
347
347
|
updatedAt: Date;
|
|
348
348
|
}
|
|
349
|
+
/** OIDC self-service configuration. Client secrets are write-only. */
|
|
350
|
+
interface EnterpriseConnectionSetup {
|
|
351
|
+
id: string;
|
|
352
|
+
revision: number;
|
|
353
|
+
issuer: string;
|
|
354
|
+
clientId: string;
|
|
355
|
+
enabled: boolean;
|
|
356
|
+
memberJit: boolean;
|
|
357
|
+
domain: string;
|
|
358
|
+
domainVerified: boolean;
|
|
359
|
+
validatedAt: Date | null;
|
|
360
|
+
testedAt: Date | null;
|
|
361
|
+
dnsRecordName: string;
|
|
362
|
+
dnsRecordValue: string;
|
|
363
|
+
challengeExpiresAt: Date;
|
|
364
|
+
redirectUri: string;
|
|
365
|
+
}
|
|
366
|
+
interface CreateEnterpriseConnectionInput {
|
|
367
|
+
/** Keep this UUID unchanged when retrying the same creation attempt. */
|
|
368
|
+
requestId: string;
|
|
369
|
+
issuer: string;
|
|
370
|
+
clientId: string;
|
|
371
|
+
clientSecret: string;
|
|
372
|
+
domain: string;
|
|
373
|
+
memberJit: boolean;
|
|
374
|
+
}
|
|
375
|
+
interface UpdateEnterpriseConnectionInput {
|
|
376
|
+
expectedRevision: number;
|
|
377
|
+
issuer: string;
|
|
378
|
+
clientId: string;
|
|
379
|
+
/** Omit to keep the current secret. It cannot be read back. */
|
|
380
|
+
clientSecret?: string;
|
|
381
|
+
memberJit: boolean;
|
|
382
|
+
}
|
|
383
|
+
type EnterpriseConnectionAction = "challenge" | "verify" | "validate" | "enable" | "disable" | "archive";
|
|
349
384
|
interface ScimCredentialState {
|
|
350
385
|
status: "active" | "revoked" | "unissued";
|
|
351
386
|
revision: number | null;
|
|
@@ -545,6 +580,23 @@ interface FinuevaAuthClient {
|
|
|
545
580
|
signIn(input: SignInInput): Promise<AuthSession>;
|
|
546
581
|
/** Cookie-only. A manual owner or admin reads the organization's enterprise connection status. */
|
|
547
582
|
listEnterpriseConnections(organizationId: string): Promise<EnterpriseConnection[]>;
|
|
583
|
+
listEnterpriseConnectionSetups(organizationId: string): Promise<EnterpriseConnectionSetup[]>;
|
|
584
|
+
/** Test OIDC without changing the admin's session or creating membership. Navigate to the returned HTTPS URL. */
|
|
585
|
+
startEnterpriseConnectionTest(organizationId: string, connectionId: string, input: {
|
|
586
|
+
expectedRevision: number;
|
|
587
|
+
applicationId: string;
|
|
588
|
+
returnTo: string;
|
|
589
|
+
}): Promise<{
|
|
590
|
+
url: string;
|
|
591
|
+
}>;
|
|
592
|
+
createEnterpriseConnection(organizationId: string, input: CreateEnterpriseConnectionInput): Promise<EnterpriseConnectionSetup>;
|
|
593
|
+
updateEnterpriseConnection(organizationId: string, connectionId: string, input: UpdateEnterpriseConnectionInput): Promise<EnterpriseConnectionSetup>;
|
|
594
|
+
actOnEnterpriseConnection(organizationId: string, connectionId: string, input: {
|
|
595
|
+
expectedRevision: number;
|
|
596
|
+
action: EnterpriseConnectionAction;
|
|
597
|
+
}): Promise<EnterpriseConnectionSetup | {
|
|
598
|
+
removed: true;
|
|
599
|
+
}>;
|
|
548
600
|
/** Cookie-only. Reads SCIM credential state for an eligible managed-lifecycle connection. */
|
|
549
601
|
getScimCredential(organizationId: string, connectionId: string): Promise<ScimCredentialState>;
|
|
550
602
|
issueScimCredential(organizationId: string, connectionId: string): Promise<ScimCredentialIssuance>;
|
|
@@ -588,4 +640,4 @@ interface FinuevaAuthClient {
|
|
|
588
640
|
onSessionChange(listener: (session: AuthSession | null) => void): () => void;
|
|
589
641
|
}
|
|
590
642
|
//#endregion
|
|
591
|
-
export {
|
|
643
|
+
export { PasskeyInventory as $, EnterpriseConnection as A, UpdateOrganizationDisplayInput as At, OrganizationDisplay as B, CreatedOrganizationTeam as C, SuspendedOrganizationMember as Ct, DepartedOrganizationMemberPage as D, TwoFactorStatus as Dt, DepartedOrganizationMember as E, TwoFactorEnrollment as Et, InvitationDecline as F, AuthErrorCode as Ft, OrganizationMemberPage as G, OrganizationInvitationPage as H, OrganizationClosure as I, AuthErrorStatus as It, OrganizationTeam as J, OrganizationPage as K, OrganizationClosureCancelInput as L, UserApiCredential as Lt, EnterpriseConnectionSetup as M, UpdateProfileInput as Mt, FinuevaAuthClient as N, WorkspaceSelection as Nt, DriveCredential as O, TwoFactorStepUpInput as Ot, InvitationAcceptance as P, AuthError as Pt, OrganizationWorkspaceSelection as Q, OrganizationClosureStartInput as R, UserApiCredentialInput as Rt, CreatedOrganizationMemberInvitation as S, SocialIdTokenProvider as St, DeletedOrganizationTeam as T, SuspendedOrganizationMemberStatus as Tt, OrganizationMember as U, OrganizationInvitation as V, OrganizationMemberAuthority as W, OrganizationTeamMemberPage as X, OrganizationTeamDisplay as Y, OrganizationTeamPage as Z, ClosingOrganization as _, ScimCredentialIssuance as _t, AuthPersistence as a, PlatformRoleApproval as at, CreateOrganizationMemberInvitationInput as b, SignInInput as bt, AuthSessionInventory as c, PlatformStatus as ct, AuthUser as d, RecentAuthenticationStatus as dt, PasskeySummary as et, CanceledOrganizationInvitation as f, RemovedOrganizationMember as ft, CeremonyReturnInput as g, RotateScimCredentialInput as gt, CeremonyRecentAuthenticationRequest as h, RestoredOrganizationMember as ht, AuthOrganization as i, PlatformRoleApplied as it, EnterpriseConnectionAction as j, UpdateOrganizationTeamDisplayInput as jt, DriveCredentialInput as k, UpdateEnterpriseConnectionInput as kt, AuthSessionSummary as l, ReceivedOrganizationInvitation as lt, CeremonyHandoffInput as m, ResentOrganizationInvitation as mt, AddedOrganizationTeamMember as n, PlatformBootstrapRoleChangeInput as nt, AuthPersistenceDriver as o, PlatformRoleChangeRecentAuthenticationInput as ot, CeremonyHandoff as p, RemovedOrganizationTeamMember as pt, OrganizationPageInput as q, AuthClientOptions as r, PlatformRole as rt, AuthSession as s, PlatformRoleFirstApproval as st, AcceptInvitationInput as t, PersonalWorkspaceSelection as tt, AuthState as u, ReceivedOrganizationInvitationPage as ut, ClosingOrganizationList as v, ScimCredentialState as vt, DeclineInvitationInput as w, SuspendedOrganizationMemberPage as wt, CreatedOrganization as x, SocialIdTokenInput as xt, CreateEnterpriseConnectionInput as y, SendVerificationEmailInput as yt, OrganizationDeparture as z };
|