@meistrari/auth-core 4.2.0 → 4.4.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.mts +294 -1
- package/dist/index.d.ts +294 -1
- package/dist/index.mjs +73 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3587,6 +3587,8 @@ type AdminOrganizationMemberRecord = {
|
|
|
3587
3587
|
image: string | null;
|
|
3588
3588
|
role: string | null;
|
|
3589
3589
|
lastActiveAt: string | null;
|
|
3590
|
+
/** Whether the user is banned. Present on member rows. */
|
|
3591
|
+
banned?: boolean | null;
|
|
3590
3592
|
createdAt: string;
|
|
3591
3593
|
invitationId?: string;
|
|
3592
3594
|
invitationStatus?: 'pending' | 'expired';
|
|
@@ -4016,6 +4018,250 @@ type ListAdminOrganizationApplicationMembersResult = {
|
|
|
4016
4018
|
limit: number;
|
|
4017
4019
|
offset: number;
|
|
4018
4020
|
};
|
|
4021
|
+
/**
|
|
4022
|
+
* OIDC field mapping stored on an SSO provider.
|
|
4023
|
+
*/
|
|
4024
|
+
type AdminSSOProviderOIDCMapping = {
|
|
4025
|
+
email?: string;
|
|
4026
|
+
emailVerified?: string;
|
|
4027
|
+
name?: string;
|
|
4028
|
+
image?: string;
|
|
4029
|
+
extraFields?: Record<string, unknown>;
|
|
4030
|
+
};
|
|
4031
|
+
/**
|
|
4032
|
+
* SAML field mapping stored on an SSO provider.
|
|
4033
|
+
*/
|
|
4034
|
+
type AdminSSOProviderSAMLMapping = {
|
|
4035
|
+
email?: string;
|
|
4036
|
+
emailVerified?: string;
|
|
4037
|
+
name?: string;
|
|
4038
|
+
firstName?: string;
|
|
4039
|
+
lastName?: string;
|
|
4040
|
+
extraFields?: Record<string, unknown>;
|
|
4041
|
+
};
|
|
4042
|
+
/**
|
|
4043
|
+
* OIDC configuration of an SSO provider as exposed to admins. The client
|
|
4044
|
+
* secret never leaves the API; hasClientSecret only signals that one is
|
|
4045
|
+
* stored so an edit surface can offer rotation without echoing the value.
|
|
4046
|
+
*/
|
|
4047
|
+
type AdminSSOProviderOIDCConfig = {
|
|
4048
|
+
clientId?: string;
|
|
4049
|
+
hasClientSecret: boolean;
|
|
4050
|
+
discoveryEndpoint?: string;
|
|
4051
|
+
authorizationEndpoint?: string;
|
|
4052
|
+
tokenEndpoint?: string;
|
|
4053
|
+
userInfoEndpoint?: string;
|
|
4054
|
+
jwksEndpoint?: string;
|
|
4055
|
+
tokenEndpointAuthentication?: 'client_secret_post' | 'client_secret_basic';
|
|
4056
|
+
scopes?: string[];
|
|
4057
|
+
pkce?: boolean;
|
|
4058
|
+
overrideUserInfo?: boolean;
|
|
4059
|
+
mapping?: AdminSSOProviderOIDCMapping;
|
|
4060
|
+
};
|
|
4061
|
+
/**
|
|
4062
|
+
* SAML sp/idp metadata of an SSO provider as exposed to admins, with private
|
|
4063
|
+
* key material stripped by the API.
|
|
4064
|
+
*/
|
|
4065
|
+
type AdminSSOProviderSAMLMetadata = {
|
|
4066
|
+
metadata?: string;
|
|
4067
|
+
entityID?: string;
|
|
4068
|
+
binding?: string;
|
|
4069
|
+
cert?: string;
|
|
4070
|
+
isAssertionEncrypted?: boolean;
|
|
4071
|
+
singleSignOnService?: {
|
|
4072
|
+
Binding: string;
|
|
4073
|
+
Location: string;
|
|
4074
|
+
}[];
|
|
4075
|
+
};
|
|
4076
|
+
/**
|
|
4077
|
+
* SAML configuration of an SSO provider as exposed to admins, with the SP
|
|
4078
|
+
* private keys stripped by the API.
|
|
4079
|
+
*/
|
|
4080
|
+
type AdminSSOProviderSAMLConfig = {
|
|
4081
|
+
entryPoint?: string;
|
|
4082
|
+
cert?: string;
|
|
4083
|
+
callbackUrl?: string;
|
|
4084
|
+
/** Absolute URL or relative path to redirect to when an IdP-initiated response has no safe RelayState. */
|
|
4085
|
+
idpInitiatedCallbackUrl?: string;
|
|
4086
|
+
audience?: string;
|
|
4087
|
+
idpMetadata?: AdminSSOProviderSAMLMetadata;
|
|
4088
|
+
spMetadata?: AdminSSOProviderSAMLMetadata;
|
|
4089
|
+
wantAssertionsSigned?: boolean;
|
|
4090
|
+
authnRequestsSigned?: boolean;
|
|
4091
|
+
/** Whether a key to sign AuthnRequests is stored. The key itself never leaves the API. */
|
|
4092
|
+
hasSpPrivateKey: boolean;
|
|
4093
|
+
signatureAlgorithm?: string;
|
|
4094
|
+
digestAlgorithm?: string;
|
|
4095
|
+
identifierFormat?: string;
|
|
4096
|
+
mapping?: AdminSSOProviderSAMLMapping;
|
|
4097
|
+
};
|
|
4098
|
+
/**
|
|
4099
|
+
* A single claim→role mapping stored on an SSO provider. Mappings are applied
|
|
4100
|
+
* on every SSO login: when the mapped claim matches, the user's organization
|
|
4101
|
+
* role is synced to the mapped role.
|
|
4102
|
+
*/
|
|
4103
|
+
type AdminSSOProviderRoleMapping = {
|
|
4104
|
+
/** OIDC claim or SAML attribute name read from the identity provider. */
|
|
4105
|
+
claim: string;
|
|
4106
|
+
/** Value the claim must equal (or contain, for multi-valued claims). */
|
|
4107
|
+
value: string;
|
|
4108
|
+
/** Organization role applied when the claim matches. */
|
|
4109
|
+
role: string;
|
|
4110
|
+
};
|
|
4111
|
+
/**
|
|
4112
|
+
* SSO provider row returned by the admin SSO listing endpoint.
|
|
4113
|
+
*/
|
|
4114
|
+
type AdminSSOProvider = {
|
|
4115
|
+
id: string;
|
|
4116
|
+
providerId: string;
|
|
4117
|
+
type: 'oidc' | 'saml';
|
|
4118
|
+
issuer: string;
|
|
4119
|
+
domain: string;
|
|
4120
|
+
organizationId: string | null;
|
|
4121
|
+
organizationName: string | null;
|
|
4122
|
+
userId: string | null;
|
|
4123
|
+
};
|
|
4124
|
+
/**
|
|
4125
|
+
* Full sanitized SSO provider returned by the admin SSO get and update
|
|
4126
|
+
* endpoints, carrying the editable configuration fields.
|
|
4127
|
+
*/
|
|
4128
|
+
type AdminSSOProviderDetail = AdminSSOProvider & {
|
|
4129
|
+
oidcConfig?: AdminSSOProviderOIDCConfig;
|
|
4130
|
+
samlConfig?: AdminSSOProviderSAMLConfig;
|
|
4131
|
+
/** Claim→role mappings applied on every SSO login. */
|
|
4132
|
+
roleMappings?: AdminSSOProviderRoleMapping[];
|
|
4133
|
+
/** Whether signing in through this provider may create a new user. */
|
|
4134
|
+
allowSignUp: boolean;
|
|
4135
|
+
/** Role of users no role mapping matches. Without one, role mappings refuse those users. */
|
|
4136
|
+
defaultRole?: string;
|
|
4137
|
+
};
|
|
4138
|
+
/**
|
|
4139
|
+
* OIDC configuration accepted when registering an SSO provider as a global
|
|
4140
|
+
* admin. Mirrors the SSO plugin's /sso/register body.
|
|
4141
|
+
*/
|
|
4142
|
+
type RegisterAdminSSOProviderOIDCConfig = {
|
|
4143
|
+
clientId: string;
|
|
4144
|
+
clientSecret: string;
|
|
4145
|
+
authorizationEndpoint?: string;
|
|
4146
|
+
tokenEndpoint?: string;
|
|
4147
|
+
userInfoEndpoint?: string;
|
|
4148
|
+
tokenEndpointAuthentication?: 'client_secret_post' | 'client_secret_basic';
|
|
4149
|
+
jwksEndpoint?: string;
|
|
4150
|
+
discoveryEndpoint?: string;
|
|
4151
|
+
/**
|
|
4152
|
+
* Skip OIDC discovery during registration. When true,
|
|
4153
|
+
* authorizationEndpoint, tokenEndpoint, and jwksEndpoint must be
|
|
4154
|
+
* provided manually.
|
|
4155
|
+
*/
|
|
4156
|
+
skipDiscovery?: boolean;
|
|
4157
|
+
scopes?: string[];
|
|
4158
|
+
pkce?: boolean;
|
|
4159
|
+
/**
|
|
4160
|
+
* Where user claims are read from. With 'id_token', the discovered user
|
|
4161
|
+
* info endpoint is not stored.
|
|
4162
|
+
*/
|
|
4163
|
+
claimsSource?: 'id_token' | 'userinfo';
|
|
4164
|
+
mapping?: AdminSSOProviderOIDCMapping;
|
|
4165
|
+
};
|
|
4166
|
+
/**
|
|
4167
|
+
* SAML sp/idp metadata accepted when registering or updating an SSO provider
|
|
4168
|
+
* as a global admin.
|
|
4169
|
+
*/
|
|
4170
|
+
type RegisterAdminSSOProviderSAMLMetadata = AdminSSOProviderSAMLMetadata & {
|
|
4171
|
+
privateKey?: string;
|
|
4172
|
+
privateKeyPass?: string;
|
|
4173
|
+
encPrivateKey?: string;
|
|
4174
|
+
encPrivateKeyPass?: string;
|
|
4175
|
+
};
|
|
4176
|
+
/**
|
|
4177
|
+
* SAML configuration accepted when registering an SSO provider as a global
|
|
4178
|
+
* admin. Mirrors the SSO plugin's /sso/register body.
|
|
4179
|
+
*/
|
|
4180
|
+
type RegisterAdminSSOProviderSAMLConfig = {
|
|
4181
|
+
entryPoint: string;
|
|
4182
|
+
/** IdP signing certificate. Optional when idpMetadata.metadata carries it. */
|
|
4183
|
+
cert?: string;
|
|
4184
|
+
/** Last-resort redirect after sign-in. The assertion consumer service URL is fixed by the API. */
|
|
4185
|
+
callbackUrl?: string;
|
|
4186
|
+
/** Absolute URL or relative path to redirect to when an IdP-initiated response has no safe RelayState. */
|
|
4187
|
+
idpInitiatedCallbackUrl?: string;
|
|
4188
|
+
audience?: string;
|
|
4189
|
+
/** IdP metadata XML, or the entity ID of a manually configured IdP. */
|
|
4190
|
+
idpMetadata: RegisterAdminSSOProviderSAMLMetadata;
|
|
4191
|
+
spMetadata?: RegisterAdminSSOProviderSAMLMetadata;
|
|
4192
|
+
wantAssertionsSigned?: boolean;
|
|
4193
|
+
authnRequestsSigned?: boolean;
|
|
4194
|
+
signatureAlgorithm?: string;
|
|
4195
|
+
digestAlgorithm?: string;
|
|
4196
|
+
identifierFormat?: string;
|
|
4197
|
+
privateKey?: string;
|
|
4198
|
+
mapping?: AdminSSOProviderSAMLMapping;
|
|
4199
|
+
};
|
|
4200
|
+
/**
|
|
4201
|
+
* Options accepted when registering an SSO provider as a global admin.
|
|
4202
|
+
* Provide exactly one of oidcConfig or samlConfig.
|
|
4203
|
+
*/
|
|
4204
|
+
type RegisterAdminSSOProviderOptions = {
|
|
4205
|
+
/** Identifies the provider during login and callback. */
|
|
4206
|
+
providerId: string;
|
|
4207
|
+
/** The issuer URL of the provider. */
|
|
4208
|
+
issuer: string;
|
|
4209
|
+
/** Provider email domain(s); comma-separated for multi-domain SSO. */
|
|
4210
|
+
domain: string;
|
|
4211
|
+
oidcConfig?: RegisterAdminSSOProviderOIDCConfig;
|
|
4212
|
+
samlConfig?: RegisterAdminSSOProviderSAMLConfig;
|
|
4213
|
+
/** The organization the provider belongs to. */
|
|
4214
|
+
organizationId: string;
|
|
4215
|
+
overrideUserInfo?: boolean;
|
|
4216
|
+
/** Claim→role mappings applied on every SSO login. */
|
|
4217
|
+
roleMappings?: AdminSSOProviderRoleMapping[];
|
|
4218
|
+
/** Whether signing in through this provider may create a new user. Defaults to false. */
|
|
4219
|
+
allowSignUp?: boolean;
|
|
4220
|
+
/**
|
|
4221
|
+
* Role of users no role mapping matches. Without one, role mappings refuse
|
|
4222
|
+
* those users. Required when there are no role mappings.
|
|
4223
|
+
*/
|
|
4224
|
+
defaultRole?: string;
|
|
4225
|
+
};
|
|
4226
|
+
/**
|
|
4227
|
+
* The registered SSO provider, including the redirect URI to configure at the
|
|
4228
|
+
* identity provider.
|
|
4229
|
+
*/
|
|
4230
|
+
type RegisterAdminSSOProviderResult = AdminSSOProviderDetail & {
|
|
4231
|
+
redirectURI: string;
|
|
4232
|
+
};
|
|
4233
|
+
/**
|
|
4234
|
+
* Options accepted when updating an SSO provider as a global admin.
|
|
4235
|
+
* Configuration updates are partial; omitted fields, including the OIDC
|
|
4236
|
+
* client secret, keep their stored values, and null removes a field. Empty
|
|
4237
|
+
* idpMetadata and spMetadata fields are removed as well. Identity fields cannot
|
|
4238
|
+
* change while accounts are linked to the provider.
|
|
4239
|
+
*/
|
|
4240
|
+
type UpdateAdminSSOProviderOptions = {
|
|
4241
|
+
providerId: string;
|
|
4242
|
+
issuer?: string;
|
|
4243
|
+
domain?: string;
|
|
4244
|
+
oidcConfig?: Partial<Omit<RegisterAdminSSOProviderOIDCConfig, 'claimsSource' | 'discoveryEndpoint' | 'scopes' | 'skipDiscovery' | 'userInfoEndpoint'>> & {
|
|
4245
|
+
discoveryEndpoint?: string | null;
|
|
4246
|
+
overrideUserInfo?: boolean;
|
|
4247
|
+
scopes?: string[] | null;
|
|
4248
|
+
userInfoEndpoint?: string | null;
|
|
4249
|
+
};
|
|
4250
|
+
samlConfig?: Partial<Omit<RegisterAdminSSOProviderSAMLConfig, 'audience' | 'callbackUrl' | 'identifierFormat' | 'idpInitiatedCallbackUrl'>> & {
|
|
4251
|
+
audience?: string | null;
|
|
4252
|
+
callbackUrl?: string | null;
|
|
4253
|
+
identifierFormat?: string | null;
|
|
4254
|
+
idpInitiatedCallbackUrl?: string | null;
|
|
4255
|
+
};
|
|
4256
|
+
/** Claim→role mappings applied on every SSO login. Replaces the stored set. */
|
|
4257
|
+
roleMappings?: AdminSSOProviderRoleMapping[];
|
|
4258
|
+
/** Whether signing in through this provider may create a new user. */
|
|
4259
|
+
allowSignUp?: boolean;
|
|
4260
|
+
/** Role of users no role mapping matches. Null removes it. */
|
|
4261
|
+
defaultRole?: string | null;
|
|
4262
|
+
/** Organization to link a provider that has none. Linked providers cannot move. */
|
|
4263
|
+
organizationId?: string;
|
|
4264
|
+
};
|
|
4019
4265
|
|
|
4020
4266
|
/**
|
|
4021
4267
|
* Service for global admin operations.
|
|
@@ -4033,6 +4279,20 @@ declare class AdminService {
|
|
|
4033
4279
|
* application routes that the Better Auth client cannot address
|
|
4034
4280
|
*/
|
|
4035
4281
|
constructor(client: APIClient, apiUrl: string);
|
|
4282
|
+
/**
|
|
4283
|
+
* Requests a route served by the Better Auth handler.
|
|
4284
|
+
*
|
|
4285
|
+
* better-auth types $fetch without the client's `throw: true` option, under
|
|
4286
|
+
* which it resolves to the parsed response body rather than { data, error }.
|
|
4287
|
+
*
|
|
4288
|
+
* @param path - Path relative to the client's base URL
|
|
4289
|
+
* @param request - Method, body, and path parameters
|
|
4290
|
+
* @param request.method - HTTP method
|
|
4291
|
+
* @param request.body - Request body
|
|
4292
|
+
* @param request.params - Values for the path's `:name` segments
|
|
4293
|
+
* @returns The parsed JSON response
|
|
4294
|
+
*/
|
|
4295
|
+
private requestAuthRoute;
|
|
4036
4296
|
/**
|
|
4037
4297
|
* Requests an application management route.
|
|
4038
4298
|
*
|
|
@@ -4406,6 +4666,39 @@ declare class AdminService {
|
|
|
4406
4666
|
* @returns Per-email invite outcomes
|
|
4407
4667
|
*/
|
|
4408
4668
|
inviteOrganizationUsers(options: InviteAdminOrganizationUsersOptions): Promise<InviteAdminOrganizationUsersResult>;
|
|
4669
|
+
/**
|
|
4670
|
+
* Lists every registered SSO provider as a global admin, with the linked
|
|
4671
|
+
* organization's name resolved for display.
|
|
4672
|
+
*
|
|
4673
|
+
* @returns The SSO providers
|
|
4674
|
+
*/
|
|
4675
|
+
listSSOProviders(): Promise<AdminSSOProvider[]>;
|
|
4676
|
+
/**
|
|
4677
|
+
* Fetches a single SSO provider by provider ID as a global admin, with its
|
|
4678
|
+
* editable configuration. Secrets are stripped by the API.
|
|
4679
|
+
*
|
|
4680
|
+
* @param providerId - The provider ID the provider was registered under
|
|
4681
|
+
* @returns The SSO provider with its sanitized configuration
|
|
4682
|
+
*/
|
|
4683
|
+
getSSOProvider(providerId: string): Promise<AdminSSOProviderDetail>;
|
|
4684
|
+
/**
|
|
4685
|
+
* Registers an OIDC or SAML SSO provider as a global admin. The API
|
|
4686
|
+
* delegates to the SSO plugin's own registration endpoint, so all of its
|
|
4687
|
+
* guards apply unchanged.
|
|
4688
|
+
*
|
|
4689
|
+
* @param options - Provider identity, domain, and exactly one of oidcConfig or samlConfig
|
|
4690
|
+
* @returns The registered provider, including the redirect URI to configure at the identity provider
|
|
4691
|
+
*/
|
|
4692
|
+
registerSSOProvider(options: RegisterAdminSSOProviderOptions): Promise<RegisterAdminSSOProviderResult>;
|
|
4693
|
+
/**
|
|
4694
|
+
* Partially updates an SSO provider as a global admin. Only provided
|
|
4695
|
+
* fields change; omitted configuration fields, including the OIDC client
|
|
4696
|
+
* secret, keep their stored values.
|
|
4697
|
+
*
|
|
4698
|
+
* @param options - Provider ID and the fields to change
|
|
4699
|
+
* @returns The updated provider with its sanitized configuration
|
|
4700
|
+
*/
|
|
4701
|
+
updateSSOProvider(options: UpdateAdminSSOProviderOptions): Promise<AdminSSOProviderDetail>;
|
|
4409
4702
|
}
|
|
4410
4703
|
|
|
4411
4704
|
/**
|
|
@@ -5414,4 +5707,4 @@ declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
|
|
|
5414
5707
|
declare function extractTokenPayload(token: string): DecodedJWTPayload;
|
|
5415
5708
|
|
|
5416
5709
|
export { AAL, AALBrand, AALs, ACR, ACRBrand, ACRs, AMR, AMRBrand, AMRs, ApiKeyMetadata, ApplicationConfig, ApplicationDisabledError, ApplicationError, ApplicationSessionAssuranceConfig, ApplicationSessionAssuranceError, ApplicationTokenStorage, AuthClient, AuthMethod, AuthMethodBrand, AuthMethods, AuthorizationFlowError, DEFAULT_APPLICATION_CONFIG, DEFAULT_JWT_ASSURANCE, DEFAULT_SESSION_ASSURANCE_CONFIG, DeviceAccessDeniedError, DeviceAuthorizationPendingError, DeviceAuthorizationSlowDownError, DeviceCodeExpiredError, DeviceTransientServerError, EmailOTPService, EmailRequired, InvalidCallbackURL, InvalidSocialProvider, JWTPayload, JWTPayloadAssurance, JWTPayloadUser, JWTPayloadWorkspace, LOGIN_METHODS, OAuthBeginStepUpResponse, OAuthCompleteStepUpResponse, OAuthStepUpProvider, RefreshTokenExpiredError, Roles, SENSITIVE_ACTION_ASSURANCE_POLICY, STEP_UP_MAX_AGE_SECONDS, SendOtpResponse, SessionAssurancePolicy, SessionAssuranceRequiredError, SessionAssuranceRequiredPayload, SessionAssuranceResponse, SessionAssuranceService, StepUpOption, UserNotLoggedInError, ac, assuranceFields, canStepUpWithAmr, createAPIClient, extractTokenPayload, getAalRank, invitationAdditionalFields, isAssuranceSufficientForPolicy, isSessionAssuranceSufficient, isTokenExpired, memberAdditionalFields, mergeStepUpAssurance, normalizeAmr, organizationAdditionalFields, parseApplicationDisabledPayload, parseSessionAssuranceRequiredPayload, rolesAccessControl, sessionAssurancePluginClient, userAdditionalFields, validateToken };
|
|
5417
|
-
export type { APIClient, AcceptInvitationResult, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationIdentity, AdminApplicationMember, AdminApplicationMemberOrganization, AdminApplicationMemberRecord, AdminApplicationOrganization, AdminApplicationRecord, AdminApplicationRole, AdminApplicationSecret, AdminEntitlementRule, AdminEntitlementRuleType, AdminEntitlementWithRules, AdminMember, AdminOrganization, AdminOrganizationApplication, AdminOrganizationApplicationAccess, AdminOrganizationApplicationEntitlement, AdminOrganizationApplicationMember, AdminOrganizationApplicationRole, AdminOrganizationEntitledApplication, AdminOrganizationMember, AdminOrganizationMemberApplication, AdminOrganizationMemberRecord, AdminOrganizationMemberTeam, AdminOrganizationSummary, AdminOrganizationTeam, AdminOrganizationTeamRecord, AdminUser, AdminUserAccess, AdminUserAccessApplication, AdminUserAccessOrganization, AdminUserAccessTeam, AdminUserInvitation, AdminUserOrganization, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, ApplicationDeprecation, ApplicationDisabledPayload, ApplicationRole, ApplicationScopedMember, ApplicationTokenStorageOptions, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, ClientCredentialsGrant, ClientCredentialsTokenResponse, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminApplicationRoleOptions, CreateAdminApplicationSecretOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, CreatedAdminApplicationSecret, DecodedJWTPayload, DeleteAdminOrganizationTeamOptions, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, DisableAdminApplicationOptions, EmailOTPSignInOptions, FullOrganization, FullOrganizationMember, GetAdminOrganizationApplicationOptions, GetAdminOrganizationOptions, GetAdminOrganizationsSummaryOptions, GetTokenOptions, Invitation, InvitationPasswordSetupResult, InvitationSignupStatus, InviteAdminOrganizationUsersOptions, InviteAdminOrganizationUsersResult, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationMembersOptions, ListAdminApplicationMembersResult, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationApplicationMembersOptions, ListAdminOrganizationApplicationMembersResult, ListAdminOrganizationApplicationsOptions, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsInclude, ListCandidateOrganizationsOptions, ListCandidateOrganizationsResponse, ListMembersOptions, ListOrganizationsOptions, ListOrganizationsWithMemberCountOptions, ListOrganizationsWithRoleAndMemberCountOptions, ListOrganizationsWithRoleOptions, LoginMethod, LoginMethodsResponse, Member, ExtendedOrganization as Organization, OrganizationSettings, OrganizationWithMemberCount, OrganizationWithRole, RemoveAdminMemberOptions, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SessionData, SetAdminEntitlementRulesOptions, SetAdminOrganizationApplicationRulesOptions, SetAdminUserApplicationRoleOptions, SetAdminUserPasswordOptions, SetAdminUserTeamOptions, SignInWithEmailAndPasswordOptions, SignInWithSsoOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, TeamMembersResponse, UpdateAdminApplicationRoleOptions, UpdateAdminEntitlementOptions, UpdateAdminMemberRoleOptions, UpdateAdminOrganizationOptions, UpdateAdminOrganizationTeamOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
|
5710
|
+
export type { APIClient, AcceptInvitationResult, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationIdentity, AdminApplicationMember, AdminApplicationMemberOrganization, AdminApplicationMemberRecord, AdminApplicationOrganization, AdminApplicationRecord, AdminApplicationRole, AdminApplicationSecret, AdminEntitlementRule, AdminEntitlementRuleType, AdminEntitlementWithRules, AdminMember, AdminOrganization, AdminOrganizationApplication, AdminOrganizationApplicationAccess, AdminOrganizationApplicationEntitlement, AdminOrganizationApplicationMember, AdminOrganizationApplicationRole, AdminOrganizationEntitledApplication, AdminOrganizationMember, AdminOrganizationMemberApplication, AdminOrganizationMemberRecord, AdminOrganizationMemberTeam, AdminOrganizationSummary, AdminOrganizationTeam, AdminOrganizationTeamRecord, AdminSSOProvider, AdminSSOProviderDetail, AdminSSOProviderOIDCConfig, AdminSSOProviderOIDCMapping, AdminSSOProviderRoleMapping, AdminSSOProviderSAMLConfig, AdminSSOProviderSAMLMapping, AdminSSOProviderSAMLMetadata, AdminUser, AdminUserAccess, AdminUserAccessApplication, AdminUserAccessOrganization, AdminUserAccessTeam, AdminUserInvitation, AdminUserOrganization, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, ApplicationDeprecation, ApplicationDisabledPayload, ApplicationRole, ApplicationScopedMember, ApplicationTokenStorageOptions, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, ClientCredentialsGrant, ClientCredentialsTokenResponse, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminApplicationRoleOptions, CreateAdminApplicationSecretOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, CreatedAdminApplicationSecret, DecodedJWTPayload, DeleteAdminOrganizationTeamOptions, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, DisableAdminApplicationOptions, EmailOTPSignInOptions, FullOrganization, FullOrganizationMember, GetAdminOrganizationApplicationOptions, GetAdminOrganizationOptions, GetAdminOrganizationsSummaryOptions, GetTokenOptions, Invitation, InvitationPasswordSetupResult, InvitationSignupStatus, InviteAdminOrganizationUsersOptions, InviteAdminOrganizationUsersResult, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationMembersOptions, ListAdminApplicationMembersResult, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationApplicationMembersOptions, ListAdminOrganizationApplicationMembersResult, ListAdminOrganizationApplicationsOptions, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsInclude, ListCandidateOrganizationsOptions, ListCandidateOrganizationsResponse, ListMembersOptions, ListOrganizationsOptions, ListOrganizationsWithMemberCountOptions, ListOrganizationsWithRoleAndMemberCountOptions, ListOrganizationsWithRoleOptions, LoginMethod, LoginMethodsResponse, Member, ExtendedOrganization as Organization, OrganizationSettings, OrganizationWithMemberCount, OrganizationWithRole, RegisterAdminSSOProviderOIDCConfig, RegisterAdminSSOProviderOptions, RegisterAdminSSOProviderResult, RegisterAdminSSOProviderSAMLConfig, RegisterAdminSSOProviderSAMLMetadata, RemoveAdminMemberOptions, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SessionData, SetAdminEntitlementRulesOptions, SetAdminOrganizationApplicationRulesOptions, SetAdminUserApplicationRoleOptions, SetAdminUserPasswordOptions, SetAdminUserTeamOptions, SignInWithEmailAndPasswordOptions, SignInWithSsoOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, TeamMembersResponse, UpdateAdminApplicationRoleOptions, UpdateAdminEntitlementOptions, UpdateAdminMemberRoleOptions, UpdateAdminOrganizationOptions, UpdateAdminOrganizationTeamOptions, UpdateAdminSSOProviderOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -3587,6 +3587,8 @@ type AdminOrganizationMemberRecord = {
|
|
|
3587
3587
|
image: string | null;
|
|
3588
3588
|
role: string | null;
|
|
3589
3589
|
lastActiveAt: string | null;
|
|
3590
|
+
/** Whether the user is banned. Present on member rows. */
|
|
3591
|
+
banned?: boolean | null;
|
|
3590
3592
|
createdAt: string;
|
|
3591
3593
|
invitationId?: string;
|
|
3592
3594
|
invitationStatus?: 'pending' | 'expired';
|
|
@@ -4016,6 +4018,250 @@ type ListAdminOrganizationApplicationMembersResult = {
|
|
|
4016
4018
|
limit: number;
|
|
4017
4019
|
offset: number;
|
|
4018
4020
|
};
|
|
4021
|
+
/**
|
|
4022
|
+
* OIDC field mapping stored on an SSO provider.
|
|
4023
|
+
*/
|
|
4024
|
+
type AdminSSOProviderOIDCMapping = {
|
|
4025
|
+
email?: string;
|
|
4026
|
+
emailVerified?: string;
|
|
4027
|
+
name?: string;
|
|
4028
|
+
image?: string;
|
|
4029
|
+
extraFields?: Record<string, unknown>;
|
|
4030
|
+
};
|
|
4031
|
+
/**
|
|
4032
|
+
* SAML field mapping stored on an SSO provider.
|
|
4033
|
+
*/
|
|
4034
|
+
type AdminSSOProviderSAMLMapping = {
|
|
4035
|
+
email?: string;
|
|
4036
|
+
emailVerified?: string;
|
|
4037
|
+
name?: string;
|
|
4038
|
+
firstName?: string;
|
|
4039
|
+
lastName?: string;
|
|
4040
|
+
extraFields?: Record<string, unknown>;
|
|
4041
|
+
};
|
|
4042
|
+
/**
|
|
4043
|
+
* OIDC configuration of an SSO provider as exposed to admins. The client
|
|
4044
|
+
* secret never leaves the API; hasClientSecret only signals that one is
|
|
4045
|
+
* stored so an edit surface can offer rotation without echoing the value.
|
|
4046
|
+
*/
|
|
4047
|
+
type AdminSSOProviderOIDCConfig = {
|
|
4048
|
+
clientId?: string;
|
|
4049
|
+
hasClientSecret: boolean;
|
|
4050
|
+
discoveryEndpoint?: string;
|
|
4051
|
+
authorizationEndpoint?: string;
|
|
4052
|
+
tokenEndpoint?: string;
|
|
4053
|
+
userInfoEndpoint?: string;
|
|
4054
|
+
jwksEndpoint?: string;
|
|
4055
|
+
tokenEndpointAuthentication?: 'client_secret_post' | 'client_secret_basic';
|
|
4056
|
+
scopes?: string[];
|
|
4057
|
+
pkce?: boolean;
|
|
4058
|
+
overrideUserInfo?: boolean;
|
|
4059
|
+
mapping?: AdminSSOProviderOIDCMapping;
|
|
4060
|
+
};
|
|
4061
|
+
/**
|
|
4062
|
+
* SAML sp/idp metadata of an SSO provider as exposed to admins, with private
|
|
4063
|
+
* key material stripped by the API.
|
|
4064
|
+
*/
|
|
4065
|
+
type AdminSSOProviderSAMLMetadata = {
|
|
4066
|
+
metadata?: string;
|
|
4067
|
+
entityID?: string;
|
|
4068
|
+
binding?: string;
|
|
4069
|
+
cert?: string;
|
|
4070
|
+
isAssertionEncrypted?: boolean;
|
|
4071
|
+
singleSignOnService?: {
|
|
4072
|
+
Binding: string;
|
|
4073
|
+
Location: string;
|
|
4074
|
+
}[];
|
|
4075
|
+
};
|
|
4076
|
+
/**
|
|
4077
|
+
* SAML configuration of an SSO provider as exposed to admins, with the SP
|
|
4078
|
+
* private keys stripped by the API.
|
|
4079
|
+
*/
|
|
4080
|
+
type AdminSSOProviderSAMLConfig = {
|
|
4081
|
+
entryPoint?: string;
|
|
4082
|
+
cert?: string;
|
|
4083
|
+
callbackUrl?: string;
|
|
4084
|
+
/** Absolute URL or relative path to redirect to when an IdP-initiated response has no safe RelayState. */
|
|
4085
|
+
idpInitiatedCallbackUrl?: string;
|
|
4086
|
+
audience?: string;
|
|
4087
|
+
idpMetadata?: AdminSSOProviderSAMLMetadata;
|
|
4088
|
+
spMetadata?: AdminSSOProviderSAMLMetadata;
|
|
4089
|
+
wantAssertionsSigned?: boolean;
|
|
4090
|
+
authnRequestsSigned?: boolean;
|
|
4091
|
+
/** Whether a key to sign AuthnRequests is stored. The key itself never leaves the API. */
|
|
4092
|
+
hasSpPrivateKey: boolean;
|
|
4093
|
+
signatureAlgorithm?: string;
|
|
4094
|
+
digestAlgorithm?: string;
|
|
4095
|
+
identifierFormat?: string;
|
|
4096
|
+
mapping?: AdminSSOProviderSAMLMapping;
|
|
4097
|
+
};
|
|
4098
|
+
/**
|
|
4099
|
+
* A single claim→role mapping stored on an SSO provider. Mappings are applied
|
|
4100
|
+
* on every SSO login: when the mapped claim matches, the user's organization
|
|
4101
|
+
* role is synced to the mapped role.
|
|
4102
|
+
*/
|
|
4103
|
+
type AdminSSOProviderRoleMapping = {
|
|
4104
|
+
/** OIDC claim or SAML attribute name read from the identity provider. */
|
|
4105
|
+
claim: string;
|
|
4106
|
+
/** Value the claim must equal (or contain, for multi-valued claims). */
|
|
4107
|
+
value: string;
|
|
4108
|
+
/** Organization role applied when the claim matches. */
|
|
4109
|
+
role: string;
|
|
4110
|
+
};
|
|
4111
|
+
/**
|
|
4112
|
+
* SSO provider row returned by the admin SSO listing endpoint.
|
|
4113
|
+
*/
|
|
4114
|
+
type AdminSSOProvider = {
|
|
4115
|
+
id: string;
|
|
4116
|
+
providerId: string;
|
|
4117
|
+
type: 'oidc' | 'saml';
|
|
4118
|
+
issuer: string;
|
|
4119
|
+
domain: string;
|
|
4120
|
+
organizationId: string | null;
|
|
4121
|
+
organizationName: string | null;
|
|
4122
|
+
userId: string | null;
|
|
4123
|
+
};
|
|
4124
|
+
/**
|
|
4125
|
+
* Full sanitized SSO provider returned by the admin SSO get and update
|
|
4126
|
+
* endpoints, carrying the editable configuration fields.
|
|
4127
|
+
*/
|
|
4128
|
+
type AdminSSOProviderDetail = AdminSSOProvider & {
|
|
4129
|
+
oidcConfig?: AdminSSOProviderOIDCConfig;
|
|
4130
|
+
samlConfig?: AdminSSOProviderSAMLConfig;
|
|
4131
|
+
/** Claim→role mappings applied on every SSO login. */
|
|
4132
|
+
roleMappings?: AdminSSOProviderRoleMapping[];
|
|
4133
|
+
/** Whether signing in through this provider may create a new user. */
|
|
4134
|
+
allowSignUp: boolean;
|
|
4135
|
+
/** Role of users no role mapping matches. Without one, role mappings refuse those users. */
|
|
4136
|
+
defaultRole?: string;
|
|
4137
|
+
};
|
|
4138
|
+
/**
|
|
4139
|
+
* OIDC configuration accepted when registering an SSO provider as a global
|
|
4140
|
+
* admin. Mirrors the SSO plugin's /sso/register body.
|
|
4141
|
+
*/
|
|
4142
|
+
type RegisterAdminSSOProviderOIDCConfig = {
|
|
4143
|
+
clientId: string;
|
|
4144
|
+
clientSecret: string;
|
|
4145
|
+
authorizationEndpoint?: string;
|
|
4146
|
+
tokenEndpoint?: string;
|
|
4147
|
+
userInfoEndpoint?: string;
|
|
4148
|
+
tokenEndpointAuthentication?: 'client_secret_post' | 'client_secret_basic';
|
|
4149
|
+
jwksEndpoint?: string;
|
|
4150
|
+
discoveryEndpoint?: string;
|
|
4151
|
+
/**
|
|
4152
|
+
* Skip OIDC discovery during registration. When true,
|
|
4153
|
+
* authorizationEndpoint, tokenEndpoint, and jwksEndpoint must be
|
|
4154
|
+
* provided manually.
|
|
4155
|
+
*/
|
|
4156
|
+
skipDiscovery?: boolean;
|
|
4157
|
+
scopes?: string[];
|
|
4158
|
+
pkce?: boolean;
|
|
4159
|
+
/**
|
|
4160
|
+
* Where user claims are read from. With 'id_token', the discovered user
|
|
4161
|
+
* info endpoint is not stored.
|
|
4162
|
+
*/
|
|
4163
|
+
claimsSource?: 'id_token' | 'userinfo';
|
|
4164
|
+
mapping?: AdminSSOProviderOIDCMapping;
|
|
4165
|
+
};
|
|
4166
|
+
/**
|
|
4167
|
+
* SAML sp/idp metadata accepted when registering or updating an SSO provider
|
|
4168
|
+
* as a global admin.
|
|
4169
|
+
*/
|
|
4170
|
+
type RegisterAdminSSOProviderSAMLMetadata = AdminSSOProviderSAMLMetadata & {
|
|
4171
|
+
privateKey?: string;
|
|
4172
|
+
privateKeyPass?: string;
|
|
4173
|
+
encPrivateKey?: string;
|
|
4174
|
+
encPrivateKeyPass?: string;
|
|
4175
|
+
};
|
|
4176
|
+
/**
|
|
4177
|
+
* SAML configuration accepted when registering an SSO provider as a global
|
|
4178
|
+
* admin. Mirrors the SSO plugin's /sso/register body.
|
|
4179
|
+
*/
|
|
4180
|
+
type RegisterAdminSSOProviderSAMLConfig = {
|
|
4181
|
+
entryPoint: string;
|
|
4182
|
+
/** IdP signing certificate. Optional when idpMetadata.metadata carries it. */
|
|
4183
|
+
cert?: string;
|
|
4184
|
+
/** Last-resort redirect after sign-in. The assertion consumer service URL is fixed by the API. */
|
|
4185
|
+
callbackUrl?: string;
|
|
4186
|
+
/** Absolute URL or relative path to redirect to when an IdP-initiated response has no safe RelayState. */
|
|
4187
|
+
idpInitiatedCallbackUrl?: string;
|
|
4188
|
+
audience?: string;
|
|
4189
|
+
/** IdP metadata XML, or the entity ID of a manually configured IdP. */
|
|
4190
|
+
idpMetadata: RegisterAdminSSOProviderSAMLMetadata;
|
|
4191
|
+
spMetadata?: RegisterAdminSSOProviderSAMLMetadata;
|
|
4192
|
+
wantAssertionsSigned?: boolean;
|
|
4193
|
+
authnRequestsSigned?: boolean;
|
|
4194
|
+
signatureAlgorithm?: string;
|
|
4195
|
+
digestAlgorithm?: string;
|
|
4196
|
+
identifierFormat?: string;
|
|
4197
|
+
privateKey?: string;
|
|
4198
|
+
mapping?: AdminSSOProviderSAMLMapping;
|
|
4199
|
+
};
|
|
4200
|
+
/**
|
|
4201
|
+
* Options accepted when registering an SSO provider as a global admin.
|
|
4202
|
+
* Provide exactly one of oidcConfig or samlConfig.
|
|
4203
|
+
*/
|
|
4204
|
+
type RegisterAdminSSOProviderOptions = {
|
|
4205
|
+
/** Identifies the provider during login and callback. */
|
|
4206
|
+
providerId: string;
|
|
4207
|
+
/** The issuer URL of the provider. */
|
|
4208
|
+
issuer: string;
|
|
4209
|
+
/** Provider email domain(s); comma-separated for multi-domain SSO. */
|
|
4210
|
+
domain: string;
|
|
4211
|
+
oidcConfig?: RegisterAdminSSOProviderOIDCConfig;
|
|
4212
|
+
samlConfig?: RegisterAdminSSOProviderSAMLConfig;
|
|
4213
|
+
/** The organization the provider belongs to. */
|
|
4214
|
+
organizationId: string;
|
|
4215
|
+
overrideUserInfo?: boolean;
|
|
4216
|
+
/** Claim→role mappings applied on every SSO login. */
|
|
4217
|
+
roleMappings?: AdminSSOProviderRoleMapping[];
|
|
4218
|
+
/** Whether signing in through this provider may create a new user. Defaults to false. */
|
|
4219
|
+
allowSignUp?: boolean;
|
|
4220
|
+
/**
|
|
4221
|
+
* Role of users no role mapping matches. Without one, role mappings refuse
|
|
4222
|
+
* those users. Required when there are no role mappings.
|
|
4223
|
+
*/
|
|
4224
|
+
defaultRole?: string;
|
|
4225
|
+
};
|
|
4226
|
+
/**
|
|
4227
|
+
* The registered SSO provider, including the redirect URI to configure at the
|
|
4228
|
+
* identity provider.
|
|
4229
|
+
*/
|
|
4230
|
+
type RegisterAdminSSOProviderResult = AdminSSOProviderDetail & {
|
|
4231
|
+
redirectURI: string;
|
|
4232
|
+
};
|
|
4233
|
+
/**
|
|
4234
|
+
* Options accepted when updating an SSO provider as a global admin.
|
|
4235
|
+
* Configuration updates are partial; omitted fields, including the OIDC
|
|
4236
|
+
* client secret, keep their stored values, and null removes a field. Empty
|
|
4237
|
+
* idpMetadata and spMetadata fields are removed as well. Identity fields cannot
|
|
4238
|
+
* change while accounts are linked to the provider.
|
|
4239
|
+
*/
|
|
4240
|
+
type UpdateAdminSSOProviderOptions = {
|
|
4241
|
+
providerId: string;
|
|
4242
|
+
issuer?: string;
|
|
4243
|
+
domain?: string;
|
|
4244
|
+
oidcConfig?: Partial<Omit<RegisterAdminSSOProviderOIDCConfig, 'claimsSource' | 'discoveryEndpoint' | 'scopes' | 'skipDiscovery' | 'userInfoEndpoint'>> & {
|
|
4245
|
+
discoveryEndpoint?: string | null;
|
|
4246
|
+
overrideUserInfo?: boolean;
|
|
4247
|
+
scopes?: string[] | null;
|
|
4248
|
+
userInfoEndpoint?: string | null;
|
|
4249
|
+
};
|
|
4250
|
+
samlConfig?: Partial<Omit<RegisterAdminSSOProviderSAMLConfig, 'audience' | 'callbackUrl' | 'identifierFormat' | 'idpInitiatedCallbackUrl'>> & {
|
|
4251
|
+
audience?: string | null;
|
|
4252
|
+
callbackUrl?: string | null;
|
|
4253
|
+
identifierFormat?: string | null;
|
|
4254
|
+
idpInitiatedCallbackUrl?: string | null;
|
|
4255
|
+
};
|
|
4256
|
+
/** Claim→role mappings applied on every SSO login. Replaces the stored set. */
|
|
4257
|
+
roleMappings?: AdminSSOProviderRoleMapping[];
|
|
4258
|
+
/** Whether signing in through this provider may create a new user. */
|
|
4259
|
+
allowSignUp?: boolean;
|
|
4260
|
+
/** Role of users no role mapping matches. Null removes it. */
|
|
4261
|
+
defaultRole?: string | null;
|
|
4262
|
+
/** Organization to link a provider that has none. Linked providers cannot move. */
|
|
4263
|
+
organizationId?: string;
|
|
4264
|
+
};
|
|
4019
4265
|
|
|
4020
4266
|
/**
|
|
4021
4267
|
* Service for global admin operations.
|
|
@@ -4033,6 +4279,20 @@ declare class AdminService {
|
|
|
4033
4279
|
* application routes that the Better Auth client cannot address
|
|
4034
4280
|
*/
|
|
4035
4281
|
constructor(client: APIClient, apiUrl: string);
|
|
4282
|
+
/**
|
|
4283
|
+
* Requests a route served by the Better Auth handler.
|
|
4284
|
+
*
|
|
4285
|
+
* better-auth types $fetch without the client's `throw: true` option, under
|
|
4286
|
+
* which it resolves to the parsed response body rather than { data, error }.
|
|
4287
|
+
*
|
|
4288
|
+
* @param path - Path relative to the client's base URL
|
|
4289
|
+
* @param request - Method, body, and path parameters
|
|
4290
|
+
* @param request.method - HTTP method
|
|
4291
|
+
* @param request.body - Request body
|
|
4292
|
+
* @param request.params - Values for the path's `:name` segments
|
|
4293
|
+
* @returns The parsed JSON response
|
|
4294
|
+
*/
|
|
4295
|
+
private requestAuthRoute;
|
|
4036
4296
|
/**
|
|
4037
4297
|
* Requests an application management route.
|
|
4038
4298
|
*
|
|
@@ -4406,6 +4666,39 @@ declare class AdminService {
|
|
|
4406
4666
|
* @returns Per-email invite outcomes
|
|
4407
4667
|
*/
|
|
4408
4668
|
inviteOrganizationUsers(options: InviteAdminOrganizationUsersOptions): Promise<InviteAdminOrganizationUsersResult>;
|
|
4669
|
+
/**
|
|
4670
|
+
* Lists every registered SSO provider as a global admin, with the linked
|
|
4671
|
+
* organization's name resolved for display.
|
|
4672
|
+
*
|
|
4673
|
+
* @returns The SSO providers
|
|
4674
|
+
*/
|
|
4675
|
+
listSSOProviders(): Promise<AdminSSOProvider[]>;
|
|
4676
|
+
/**
|
|
4677
|
+
* Fetches a single SSO provider by provider ID as a global admin, with its
|
|
4678
|
+
* editable configuration. Secrets are stripped by the API.
|
|
4679
|
+
*
|
|
4680
|
+
* @param providerId - The provider ID the provider was registered under
|
|
4681
|
+
* @returns The SSO provider with its sanitized configuration
|
|
4682
|
+
*/
|
|
4683
|
+
getSSOProvider(providerId: string): Promise<AdminSSOProviderDetail>;
|
|
4684
|
+
/**
|
|
4685
|
+
* Registers an OIDC or SAML SSO provider as a global admin. The API
|
|
4686
|
+
* delegates to the SSO plugin's own registration endpoint, so all of its
|
|
4687
|
+
* guards apply unchanged.
|
|
4688
|
+
*
|
|
4689
|
+
* @param options - Provider identity, domain, and exactly one of oidcConfig or samlConfig
|
|
4690
|
+
* @returns The registered provider, including the redirect URI to configure at the identity provider
|
|
4691
|
+
*/
|
|
4692
|
+
registerSSOProvider(options: RegisterAdminSSOProviderOptions): Promise<RegisterAdminSSOProviderResult>;
|
|
4693
|
+
/**
|
|
4694
|
+
* Partially updates an SSO provider as a global admin. Only provided
|
|
4695
|
+
* fields change; omitted configuration fields, including the OIDC client
|
|
4696
|
+
* secret, keep their stored values.
|
|
4697
|
+
*
|
|
4698
|
+
* @param options - Provider ID and the fields to change
|
|
4699
|
+
* @returns The updated provider with its sanitized configuration
|
|
4700
|
+
*/
|
|
4701
|
+
updateSSOProvider(options: UpdateAdminSSOProviderOptions): Promise<AdminSSOProviderDetail>;
|
|
4409
4702
|
}
|
|
4410
4703
|
|
|
4411
4704
|
/**
|
|
@@ -5414,4 +5707,4 @@ declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
|
|
|
5414
5707
|
declare function extractTokenPayload(token: string): DecodedJWTPayload;
|
|
5415
5708
|
|
|
5416
5709
|
export { AAL, AALBrand, AALs, ACR, ACRBrand, ACRs, AMR, AMRBrand, AMRs, ApiKeyMetadata, ApplicationConfig, ApplicationDisabledError, ApplicationError, ApplicationSessionAssuranceConfig, ApplicationSessionAssuranceError, ApplicationTokenStorage, AuthClient, AuthMethod, AuthMethodBrand, AuthMethods, AuthorizationFlowError, DEFAULT_APPLICATION_CONFIG, DEFAULT_JWT_ASSURANCE, DEFAULT_SESSION_ASSURANCE_CONFIG, DeviceAccessDeniedError, DeviceAuthorizationPendingError, DeviceAuthorizationSlowDownError, DeviceCodeExpiredError, DeviceTransientServerError, EmailOTPService, EmailRequired, InvalidCallbackURL, InvalidSocialProvider, JWTPayload, JWTPayloadAssurance, JWTPayloadUser, JWTPayloadWorkspace, LOGIN_METHODS, OAuthBeginStepUpResponse, OAuthCompleteStepUpResponse, OAuthStepUpProvider, RefreshTokenExpiredError, Roles, SENSITIVE_ACTION_ASSURANCE_POLICY, STEP_UP_MAX_AGE_SECONDS, SendOtpResponse, SessionAssurancePolicy, SessionAssuranceRequiredError, SessionAssuranceRequiredPayload, SessionAssuranceResponse, SessionAssuranceService, StepUpOption, UserNotLoggedInError, ac, assuranceFields, canStepUpWithAmr, createAPIClient, extractTokenPayload, getAalRank, invitationAdditionalFields, isAssuranceSufficientForPolicy, isSessionAssuranceSufficient, isTokenExpired, memberAdditionalFields, mergeStepUpAssurance, normalizeAmr, organizationAdditionalFields, parseApplicationDisabledPayload, parseSessionAssuranceRequiredPayload, rolesAccessControl, sessionAssurancePluginClient, userAdditionalFields, validateToken };
|
|
5417
|
-
export type { APIClient, AcceptInvitationResult, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationIdentity, AdminApplicationMember, AdminApplicationMemberOrganization, AdminApplicationMemberRecord, AdminApplicationOrganization, AdminApplicationRecord, AdminApplicationRole, AdminApplicationSecret, AdminEntitlementRule, AdminEntitlementRuleType, AdminEntitlementWithRules, AdminMember, AdminOrganization, AdminOrganizationApplication, AdminOrganizationApplicationAccess, AdminOrganizationApplicationEntitlement, AdminOrganizationApplicationMember, AdminOrganizationApplicationRole, AdminOrganizationEntitledApplication, AdminOrganizationMember, AdminOrganizationMemberApplication, AdminOrganizationMemberRecord, AdminOrganizationMemberTeam, AdminOrganizationSummary, AdminOrganizationTeam, AdminOrganizationTeamRecord, AdminUser, AdminUserAccess, AdminUserAccessApplication, AdminUserAccessOrganization, AdminUserAccessTeam, AdminUserInvitation, AdminUserOrganization, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, ApplicationDeprecation, ApplicationDisabledPayload, ApplicationRole, ApplicationScopedMember, ApplicationTokenStorageOptions, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, ClientCredentialsGrant, ClientCredentialsTokenResponse, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminApplicationRoleOptions, CreateAdminApplicationSecretOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, CreatedAdminApplicationSecret, DecodedJWTPayload, DeleteAdminOrganizationTeamOptions, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, DisableAdminApplicationOptions, EmailOTPSignInOptions, FullOrganization, FullOrganizationMember, GetAdminOrganizationApplicationOptions, GetAdminOrganizationOptions, GetAdminOrganizationsSummaryOptions, GetTokenOptions, Invitation, InvitationPasswordSetupResult, InvitationSignupStatus, InviteAdminOrganizationUsersOptions, InviteAdminOrganizationUsersResult, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationMembersOptions, ListAdminApplicationMembersResult, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationApplicationMembersOptions, ListAdminOrganizationApplicationMembersResult, ListAdminOrganizationApplicationsOptions, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsInclude, ListCandidateOrganizationsOptions, ListCandidateOrganizationsResponse, ListMembersOptions, ListOrganizationsOptions, ListOrganizationsWithMemberCountOptions, ListOrganizationsWithRoleAndMemberCountOptions, ListOrganizationsWithRoleOptions, LoginMethod, LoginMethodsResponse, Member, ExtendedOrganization as Organization, OrganizationSettings, OrganizationWithMemberCount, OrganizationWithRole, RemoveAdminMemberOptions, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SessionData, SetAdminEntitlementRulesOptions, SetAdminOrganizationApplicationRulesOptions, SetAdminUserApplicationRoleOptions, SetAdminUserPasswordOptions, SetAdminUserTeamOptions, SignInWithEmailAndPasswordOptions, SignInWithSsoOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, TeamMembersResponse, UpdateAdminApplicationRoleOptions, UpdateAdminEntitlementOptions, UpdateAdminMemberRoleOptions, UpdateAdminOrganizationOptions, UpdateAdminOrganizationTeamOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
|
5710
|
+
export type { APIClient, AcceptInvitationResult, AdminApplication, AdminApplicationEntitlement, AdminApplicationEntitlementRecord, AdminApplicationIdentity, AdminApplicationMember, AdminApplicationMemberOrganization, AdminApplicationMemberRecord, AdminApplicationOrganization, AdminApplicationRecord, AdminApplicationRole, AdminApplicationSecret, AdminEntitlementRule, AdminEntitlementRuleType, AdminEntitlementWithRules, AdminMember, AdminOrganization, AdminOrganizationApplication, AdminOrganizationApplicationAccess, AdminOrganizationApplicationEntitlement, AdminOrganizationApplicationMember, AdminOrganizationApplicationRole, AdminOrganizationEntitledApplication, AdminOrganizationMember, AdminOrganizationMemberApplication, AdminOrganizationMemberRecord, AdminOrganizationMemberTeam, AdminOrganizationSummary, AdminOrganizationTeam, AdminOrganizationTeamRecord, AdminSSOProvider, AdminSSOProviderDetail, AdminSSOProviderOIDCConfig, AdminSSOProviderOIDCMapping, AdminSSOProviderRoleMapping, AdminSSOProviderSAMLConfig, AdminSSOProviderSAMLMapping, AdminSSOProviderSAMLMetadata, AdminUser, AdminUserAccess, AdminUserAccessApplication, AdminUserAccessOrganization, AdminUserAccessTeam, AdminUserInvitation, AdminUserOrganization, ApiKey, ApiKeyWithoutSecret, Application, ApplicationAuthContextResponse, ApplicationDeprecation, ApplicationDisabledPayload, ApplicationRole, ApplicationScopedMember, ApplicationTokenStorageOptions, AssuranceFields, BaseOrganization, BeginOAuthStepUpParams, BillingMode, ClientCredentialsGrant, ClientCredentialsTokenResponse, CompleteAuthorizationFlowResponse, CreateAdminApplicationEntitlementOptions, CreateAdminApplicationOptions, CreateAdminApplicationRoleOptions, CreateAdminApplicationSecretOptions, CreateAdminOrganizationOptions, CreateAdminOrganizationTeamOptions, CreateApiKeyPayload, CreateTeamPayload, CreatedAdminApplicationSecret, DecodedJWTPayload, DeleteAdminOrganizationTeamOptions, DeviceAuthorizationActionResponse, DeviceAuthorizationContextResponse, DeviceAuthorizationResponse, DeviceContextApplication, DisableAdminApplicationOptions, EmailOTPSignInOptions, FullOrganization, FullOrganizationMember, GetAdminOrganizationApplicationOptions, GetAdminOrganizationOptions, GetAdminOrganizationsSummaryOptions, GetTokenOptions, Invitation, InvitationPasswordSetupResult, InvitationSignupStatus, InviteAdminOrganizationUsersOptions, InviteAdminOrganizationUsersResult, InviteUserToOrganizationOptions, JWTPayloadData, ListAdminApplicationMembersOptions, ListAdminApplicationMembersResult, ListAdminApplicationsOptions, ListAdminApplicationsResult, ListAdminOrganizationApplicationMembersOptions, ListAdminOrganizationApplicationMembersResult, ListAdminOrganizationApplicationsOptions, ListAdminOrganizationMembersOptions, ListAdminOrganizationMembersResult, ListAdminOrganizationTeamsOptions, ListAdminOrganizationTeamsResult, ListAdminOrganizationsOptions, ListAdminOrganizationsResult, ListAdminUsersOptions, ListAdminUsersResult, ListCandidateOrganizationsInclude, ListCandidateOrganizationsOptions, ListCandidateOrganizationsResponse, ListMembersOptions, ListOrganizationsOptions, ListOrganizationsWithMemberCountOptions, ListOrganizationsWithRoleAndMemberCountOptions, ListOrganizationsWithRoleOptions, LoginMethod, LoginMethodsResponse, Member, ExtendedOrganization as Organization, OrganizationSettings, OrganizationWithMemberCount, OrganizationWithRole, RegisterAdminSSOProviderOIDCConfig, RegisterAdminSSOProviderOptions, RegisterAdminSSOProviderResult, RegisterAdminSSOProviderSAMLConfig, RegisterAdminSSOProviderSAMLMetadata, RemoveAdminMemberOptions, RemoveUserFromOrganizationOptions, Role, SendVerificationOTPOptions, Session, SessionAssuranceActions, SessionData, SetAdminEntitlementRulesOptions, SetAdminOrganizationApplicationRulesOptions, SetAdminUserApplicationRoleOptions, SetAdminUserPasswordOptions, SetAdminUserTeamOptions, SignInWithEmailAndPasswordOptions, SignInWithSsoOptions, SocialSignInOptions, StartAuthorizationFlowResponse, Strict, Team, TeamMember, TeamMembersResponse, UpdateAdminApplicationRoleOptions, UpdateAdminEntitlementOptions, UpdateAdminMemberRoleOptions, UpdateAdminOrganizationOptions, UpdateAdminOrganizationTeamOptions, UpdateAdminSSOProviderOptions, UpdateApiKeyPayload, UpdateMemberRoleOptions, UpdateOrganizationPayload, UpdateTeamPayload, User, UserProfile, WhoAmIInclude, WhoAmIOptions, WhoAmIOrganization, WhoAmIResponse };
|
package/dist/index.mjs
CHANGED
|
@@ -21,7 +21,7 @@ function isTokenExpired(token, expiresInMs) {
|
|
|
21
21
|
return nowInSeconds > expirationTime;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const version = "4.
|
|
24
|
+
const version = "4.4.0";
|
|
25
25
|
|
|
26
26
|
function parsedEnumValues(schema) {
|
|
27
27
|
return Object.fromEntries(
|
|
@@ -532,6 +532,22 @@ class AdminService {
|
|
|
532
532
|
}
|
|
533
533
|
client;
|
|
534
534
|
apiUrl;
|
|
535
|
+
/**
|
|
536
|
+
* Requests a route served by the Better Auth handler.
|
|
537
|
+
*
|
|
538
|
+
* better-auth types $fetch without the client's `throw: true` option, under
|
|
539
|
+
* which it resolves to the parsed response body rather than { data, error }.
|
|
540
|
+
*
|
|
541
|
+
* @param path - Path relative to the client's base URL
|
|
542
|
+
* @param request - Method, body, and path parameters
|
|
543
|
+
* @param request.method - HTTP method
|
|
544
|
+
* @param request.body - Request body
|
|
545
|
+
* @param request.params - Values for the path's `:name` segments
|
|
546
|
+
* @returns The parsed JSON response
|
|
547
|
+
*/
|
|
548
|
+
async requestAuthRoute(path, request) {
|
|
549
|
+
return await this.client.$fetch(path, request);
|
|
550
|
+
}
|
|
535
551
|
/**
|
|
536
552
|
* Requests an application management route.
|
|
537
553
|
*
|
|
@@ -1250,6 +1266,62 @@ class AdminService {
|
|
|
1250
1266
|
});
|
|
1251
1267
|
return data;
|
|
1252
1268
|
}
|
|
1269
|
+
/**
|
|
1270
|
+
* Lists every registered SSO provider as a global admin, with the linked
|
|
1271
|
+
* organization's name resolved for display.
|
|
1272
|
+
*
|
|
1273
|
+
* @returns The SSO providers
|
|
1274
|
+
*/
|
|
1275
|
+
async listSSOProviders() {
|
|
1276
|
+
const { providers } = await this.requestAuthRoute("/admin/sso/providers", {
|
|
1277
|
+
method: "GET"
|
|
1278
|
+
});
|
|
1279
|
+
return providers;
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Fetches a single SSO provider by provider ID as a global admin, with its
|
|
1283
|
+
* editable configuration. Secrets are stripped by the API.
|
|
1284
|
+
*
|
|
1285
|
+
* @param providerId - The provider ID the provider was registered under
|
|
1286
|
+
* @returns The SSO provider with its sanitized configuration
|
|
1287
|
+
*/
|
|
1288
|
+
async getSSOProvider(providerId) {
|
|
1289
|
+
const { data } = await this.requestAuthRoute("/admin/sso/providers/:providerId", {
|
|
1290
|
+
method: "GET",
|
|
1291
|
+
params: { providerId }
|
|
1292
|
+
});
|
|
1293
|
+
return data;
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Registers an OIDC or SAML SSO provider as a global admin. The API
|
|
1297
|
+
* delegates to the SSO plugin's own registration endpoint, so all of its
|
|
1298
|
+
* guards apply unchanged.
|
|
1299
|
+
*
|
|
1300
|
+
* @param options - Provider identity, domain, and exactly one of oidcConfig or samlConfig
|
|
1301
|
+
* @returns The registered provider, including the redirect URI to configure at the identity provider
|
|
1302
|
+
*/
|
|
1303
|
+
async registerSSOProvider(options) {
|
|
1304
|
+
const { data } = await this.requestAuthRoute("/admin/sso/register", {
|
|
1305
|
+
method: "POST",
|
|
1306
|
+
body: options
|
|
1307
|
+
});
|
|
1308
|
+
return data;
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Partially updates an SSO provider as a global admin. Only provided
|
|
1312
|
+
* fields change; omitted configuration fields, including the OIDC client
|
|
1313
|
+
* secret, keep their stored values.
|
|
1314
|
+
*
|
|
1315
|
+
* @param options - Provider ID and the fields to change
|
|
1316
|
+
* @returns The updated provider with its sanitized configuration
|
|
1317
|
+
*/
|
|
1318
|
+
async updateSSOProvider(options) {
|
|
1319
|
+
const { data } = await this.requestAuthRoute("/admin/sso/update-provider", {
|
|
1320
|
+
method: "POST",
|
|
1321
|
+
body: options
|
|
1322
|
+
});
|
|
1323
|
+
return data;
|
|
1324
|
+
}
|
|
1253
1325
|
}
|
|
1254
1326
|
|
|
1255
1327
|
class BaseError extends Error {
|