mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: Update WebAuthn verification API to use initial values and remove unused endpoint
This commit is contained in:
@@ -120,7 +120,7 @@ const LoginPage: () => JSX.Element = () => {
|
||||
const verifyResult: HTTPResponse<JSONObject> = await API.post({
|
||||
url: VERIFY_WEBAUTHN_AUTH_API_URL,
|
||||
data: {
|
||||
userId: data.userId,
|
||||
...initialValues,
|
||||
challenge: data.challenge,
|
||||
credential: {
|
||||
id: credential.id,
|
||||
|
||||
@@ -18,8 +18,8 @@ export const GENERATE_WEBAUTHN_AUTH_OPTIONS_API_URL: URL = URL.fromURL(
|
||||
).addRoute(new Route("/user-webauthn/generate-authentication-options"));
|
||||
|
||||
export const VERIFY_WEBAUTHN_AUTH_API_URL: URL = URL.fromURL(
|
||||
APP_API_URL,
|
||||
).addRoute(new Route("/user-webauthn/verify-authentication"));
|
||||
IDENTITY_URL,
|
||||
).addRoute(new Route("/verify-webauthn-auth"));
|
||||
|
||||
export const SERVICE_PROVIDER_LOGIN_URL: URL = URL.fromURL(
|
||||
IDENTITY_URL,
|
||||
|
||||
@@ -16,7 +16,6 @@ import Response from "../Utils/Response";
|
||||
import { JSONObject } from "../../Types/JSON";
|
||||
import CommonAPI from "./CommonAPI";
|
||||
import DatabaseCommonInteractionProps from "../../Types/BaseDatabase/DatabaseCommonInteractionProps";
|
||||
import User from "../../Models/DatabaseModels/User";
|
||||
|
||||
export default class UserWebAuthnAPI extends BaseAPI<
|
||||
UserWebAuthn,
|
||||
@@ -94,30 +93,5 @@ export default class UserWebAuthnAPI extends BaseAPI<
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
this.router.post(
|
||||
`${new this.entityType().getCrudApiPath()?.toString()}/verify-authentication`,
|
||||
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
||||
try {
|
||||
const data: JSONObject = req.body;
|
||||
|
||||
const userId: string = data["userId"] as string;
|
||||
const challenge: string = data["challenge"] as string;
|
||||
const credential: any = data["credential"];
|
||||
|
||||
const user: User = await UserWebAuthnService.verifyAuthentication({
|
||||
userId: userId,
|
||||
challenge: challenge,
|
||||
credential: credential,
|
||||
});
|
||||
|
||||
return Response.sendJsonObjectResponse(req, res, {
|
||||
user: User.toJSON(user, User),
|
||||
});
|
||||
} catch (err) {
|
||||
next(err);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user