herald-auth-web 0.5.1 → 0.5.2

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.js CHANGED
@@ -838,6 +838,14 @@ var verify = (options) => (options.client ?? client).post({
838
838
  ...options.headers
839
839
  }
840
840
  });
841
+ var ldapLogin = (options) => (options.client ?? client).post({
842
+ url: "/api/auth/{realmId}/login/ldap",
843
+ ...options,
844
+ headers: {
845
+ "Content-Type": "application/json",
846
+ ...options.headers
847
+ }
848
+ });
841
849
  var handlePasskey2FaOptions = (options) => (options.client ?? client).post({
842
850
  url: "/api/auth/{realmId}/login/passkey/2fa/options",
843
851
  ...options,
@@ -1178,6 +1186,31 @@ function createAuth(deps) {
1178
1186
  );
1179
1187
  return toLoginResult(body, deps);
1180
1188
  },
1189
+ /**
1190
+ * Corporate-directory (LDAP) login. Mirrors `login()`: the directory
1191
+ * credentials are verified server-side (search-then-bind) and the 200 body
1192
+ * is normalized through the same `toLoginResult` multi-branch handling
1193
+ * (success tokens / second-factor / consent / oauth-redirect).
1194
+ */
1195
+ async loginWithLdap(payload) {
1196
+ const body = await resolveOp(
1197
+ ldapLogin({
1198
+ client: client2,
1199
+ path: { realmId },
1200
+ body: {
1201
+ clientId: deps.clientId,
1202
+ username: payload.username,
1203
+ password: payload.password,
1204
+ ...payload.turnstileToken ? { turnstileToken: payload.turnstileToken } : {},
1205
+ ...payload.agreements ? { agreements: payload.agreements } : {},
1206
+ ...payload.oauthClientId ? { oauthClientId: payload.oauthClientId } : {},
1207
+ ...payload.redirectUri ? { redirectUri: payload.redirectUri } : {},
1208
+ ...payload.state ? { state: payload.state } : {}
1209
+ }
1210
+ })
1211
+ );
1212
+ return toLoginResult(body, deps);
1213
+ },
1181
1214
  async verifyTotp(payload) {
1182
1215
  const body = await resolveOp(
1183
1216
  handleVerifyTotp({