summaryrefslogtreecommitdiff
path: root/web/src
diff options
context:
space:
mode:
authorJames Elliott <james-d-elliott@users.noreply.github.com>2023-04-15 02:04:42 +1000
committerGitHub <noreply@github.com>2023-04-15 02:04:42 +1000
commit2733fc040cc43269889f5e11fd64c1fdb2e09ebd (patch)
tree2459462966d202d1177fb166a83a476c2e9c5a51 /web/src
parent37a49b21af4550525890a84b5a7ccf6f1ed51243 (diff)
refactor: webauthn naming (#5243)
Signed-off-by: James Elliott <james-d-elliott@users.noreply.github.com>
Diffstat (limited to 'web/src')
-rw-r--r--web/src/App.tsx6
-rw-r--r--web/src/constants/Routes.ts4
-rw-r--r--web/src/services/Api.ts8
-rw-r--r--web/src/services/RegisterDevice.ts6
-rw-r--r--web/src/services/Webauthn.ts22
-rw-r--r--web/src/views/DeviceRegistration/RegisterWebAuthn.tsx (renamed from web/src/views/DeviceRegistration/RegisterWebauthn.tsx)4
-rw-r--r--web/src/views/LoginPortal/LoginPortal.tsx4
-rw-r--r--web/src/views/LoginPortal/SecondFactor/SecondFactorForm.tsx12
8 files changed, 33 insertions, 33 deletions
diff --git a/web/src/App.tsx b/web/src/App.tsx
index 77ea8aff7..ab8be3fa1 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -12,7 +12,7 @@ import {
IndexRoute,
LogoutRoute,
RegisterOneTimePasswordRoute,
- RegisterWebauthnRoute,
+ RegisterWebAuthnRoute,
ResetPasswordStep1Route,
ResetPasswordStep2Route,
} from "@constants/Routes";
@@ -28,7 +28,7 @@ import {
getTheme,
} from "@utils/Configuration";
import RegisterOneTimePassword from "@views/DeviceRegistration/RegisterOneTimePassword";
-import RegisterWebauthn from "@views/DeviceRegistration/RegisterWebauthn";
+import RegisterWebAuthn from "@views/DeviceRegistration/RegisterWebAuthn";
import BaseLoadingPage from "@views/LoadingPage/BaseLoadingPage";
import ConsentView from "@views/LoginPortal/ConsentView/ConsentView";
import LoginPortal from "@views/LoginPortal/LoginPortal";
@@ -89,7 +89,7 @@ const App: React.FC<Props> = (props: Props) => {
<Routes>
<Route path={ResetPasswordStep1Route} element={<ResetPasswordStep1 />} />
<Route path={ResetPasswordStep2Route} element={<ResetPasswordStep2 />} />
- <Route path={RegisterWebauthnRoute} element={<RegisterWebauthn />} />
+ <Route path={RegisterWebAuthnRoute} element={<RegisterWebAuthn />} />
<Route path={RegisterOneTimePasswordRoute} element={<RegisterOneTimePassword />} />
<Route path={LogoutRoute} element={<SignOut />} />
<Route path={ConsentRoute} element={<ConsentView />} />
diff --git a/web/src/constants/Routes.ts b/web/src/constants/Routes.ts
index 55c7f576f..25d47d342 100644
--- a/web/src/constants/Routes.ts
+++ b/web/src/constants/Routes.ts
@@ -3,12 +3,12 @@ export const AuthenticatedRoute: string = "/authenticated";
export const ConsentRoute: string = "/consent";
export const SecondFactorRoute: string = "/2fa/";
-export const SecondFactorWebauthnSubRoute: string = "webauthn";
+export const SecondFactorWebAuthnSubRoute: string = "webauthn";
export const SecondFactorTOTPSubRoute: string = "one-time-password";
export const SecondFactorPushSubRoute: string = "push-notification";
export const ResetPasswordStep1Route: string = "/reset-password/step1";
export const ResetPasswordStep2Route: string = "/reset-password/step2";
-export const RegisterWebauthnRoute: string = "/webauthn/register";
+export const RegisterWebAuthnRoute: string = "/webauthn/register";
export const RegisterOneTimePasswordRoute: string = "/one-time-password/register";
export const LogoutRoute: string = "/logout";
diff --git a/web/src/services/Api.ts b/web/src/services/Api.ts
index 03bb4e1ce..0e301d628 100644
--- a/web/src/services/Api.ts
+++ b/web/src/services/Api.ts
@@ -11,11 +11,11 @@ export const FirstFactorPath = basePath + "/api/firstfactor";
export const InitiateTOTPRegistrationPath = basePath + "/api/secondfactor/totp/identity/start";
export const CompleteTOTPRegistrationPath = basePath + "/api/secondfactor/totp/identity/finish";
-export const WebauthnIdentityStartPath = basePath + "/api/secondfactor/webauthn/identity/start";
-export const WebauthnIdentityFinishPath = basePath + "/api/secondfactor/webauthn/identity/finish";
-export const WebauthnAttestationPath = basePath + "/api/secondfactor/webauthn/attestation";
+export const WebAuthnIdentityStartPath = basePath + "/api/secondfactor/webauthn/identity/start";
+export const WebAuthnIdentityFinishPath = basePath + "/api/secondfactor/webauthn/identity/finish";
+export const WebAuthnAttestationPath = basePath + "/api/secondfactor/webauthn/attestation";
-export const WebauthnAssertionPath = basePath + "/api/secondfactor/webauthn/assertion";
+export const WebAuthnAssertionPath = basePath + "/api/secondfactor/webauthn/assertion";
export const InitiateDuoDeviceSelectionPath = basePath + "/api/secondfactor/duo_devices";
export const CompleteDuoDeviceSelectionPath = basePath + "/api/secondfactor/duo_device";
diff --git a/web/src/services/RegisterDevice.ts b/web/src/services/RegisterDevice.ts
index 431b336af..3dc0eb42c 100644
--- a/web/src/services/RegisterDevice.ts
+++ b/web/src/services/RegisterDevice.ts
@@ -1,4 +1,4 @@
-import { CompleteTOTPRegistrationPath, InitiateTOTPRegistrationPath, WebauthnIdentityStartPath } from "@services/Api";
+import { CompleteTOTPRegistrationPath, InitiateTOTPRegistrationPath, WebAuthnIdentityStartPath } from "@services/Api";
import { Post, PostWithOptionalResponse } from "@services/Client";
export async function initiateTOTPRegistrationProcess() {
@@ -14,6 +14,6 @@ export async function completeTOTPRegistrationProcess(processToken: string) {
return Post<CompleteTOTPRegistrationResponse>(CompleteTOTPRegistrationPath, { token: processToken });
}
-export async function initiateWebauthnRegistrationProcess() {
- return PostWithOptionalResponse(WebauthnIdentityStartPath);
+export async function initiateWebAuthnRegistrationProcess() {
+ return PostWithOptionalResponse(WebAuthnIdentityStartPath);
}
diff --git a/web/src/services/Webauthn.ts b/web/src/services/Webauthn.ts
index 7dc2de6ce..ecd2dbfe8 100644
--- a/web/src/services/Webauthn.ts
+++ b/web/src/services/Webauthn.ts
@@ -20,14 +20,14 @@ import {
import {
OptionalDataServiceResponse,
ServiceResponse,
- WebauthnAssertionPath,
- WebauthnAttestationPath,
- WebauthnIdentityFinishPath,
+ WebAuthnAssertionPath,
+ WebAuthnAttestationPath,
+ WebAuthnIdentityFinishPath,
} from "@services/Api";
import { SignInResponse } from "@services/SignIn";
import { getBase64WebEncodingFromBytes, getBytesFromBase64 } from "@utils/Base64";
-export function isWebauthnSecure(): boolean {
+export function isWebAuthnSecure(): boolean {
if (window.isSecureContext) {
return true;
}
@@ -35,12 +35,12 @@ export function isWebauthnSecure(): boolean {
return window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1";
}
-export function isWebauthnSupported(): boolean {
+export function isWebAuthnSupported(): boolean {
return window?.PublicKeyCredential !== undefined && typeof window.PublicKeyCredential === "function";
}
-export async function isWebauthnPlatformAuthenticatorAvailable(): Promise<boolean> {
- if (!isWebauthnSupported()) {
+export async function isWebAuthnPlatformAuthenticatorAvailable(): Promise<boolean> {
+ if (!isWebAuthnSupported()) {
return false;
}
@@ -215,7 +215,7 @@ function getAssertionResultFromDOMException(
async function getAttestationCreationOptions(token: string): Promise<PublicKeyCredentialCreationOptionsStatus> {
let response: AxiosResponse<ServiceResponse<CredentialCreation>>;
- response = await axios.post<ServiceResponse<CredentialCreation>>(WebauthnIdentityFinishPath, {
+ response = await axios.post<ServiceResponse<CredentialCreation>>(WebAuthnIdentityFinishPath, {
token: token,
});
@@ -234,7 +234,7 @@ async function getAttestationCreationOptions(token: string): Promise<PublicKeyCr
export async function getAssertionRequestOptions(): Promise<PublicKeyCredentialRequestOptionsStatus> {
let response: AxiosResponse<ServiceResponse<CredentialRequest>>;
- response = await axios.get<ServiceResponse<CredentialRequest>>(WebauthnAssertionPath);
+ response = await axios.get<ServiceResponse<CredentialRequest>>(WebAuthnAssertionPath);
if (response.data.status !== "OK" || response.data.data == null) {
return {
@@ -317,7 +317,7 @@ async function postAttestationPublicKeyCredentialResult(
): Promise<AxiosResponse<OptionalDataServiceResponse<any>>> {
const credentialJSON = encodeAttestationPublicKeyCredential(credential);
- return axios.post<OptionalDataServiceResponse<any>>(WebauthnAttestationPath, credentialJSON);
+ return axios.post<OptionalDataServiceResponse<any>>(WebAuthnAttestationPath, credentialJSON);
}
export async function postAssertionPublicKeyCredentialResult(
@@ -328,7 +328,7 @@ export async function postAssertionPublicKeyCredentialResult(
): Promise<AxiosResponse<ServiceResponse<SignInResponse>>> {
const credentialJSON = encodeAssertionPublicKeyCredential(credential, targetURL, workflow, workflowID);
- return axios.post<ServiceResponse<SignInResponse>>(WebauthnAssertionPath, credentialJSON);
+ return axios.post<ServiceResponse<SignInResponse>>(WebAuthnAssertionPath, credentialJSON);
}
export async function performAttestationCeremony(token: string): Promise<AttestationResult> {
diff --git a/web/src/views/DeviceRegistration/RegisterWebauthn.tsx b/web/src/views/DeviceRegistration/RegisterWebAuthn.tsx
index 055479047..33a93ef6a 100644
--- a/web/src/views/DeviceRegistration/RegisterWebauthn.tsx
+++ b/web/src/views/DeviceRegistration/RegisterWebAuthn.tsx
@@ -13,7 +13,7 @@ import { AttestationResult } from "@models/Webauthn";
import { FirstFactorPath } from "@services/Api";
import { performAttestationCeremony } from "@services/Webauthn";
-const RegisterWebauthn = function () {
+const RegisterWebAuthn = function () {
const styles = useStyles();
const navigate = useNavigate();
const { createErrorNotification } = useNotifications();
@@ -99,7 +99,7 @@ const RegisterWebauthn = function () {
);
};
-export default RegisterWebauthn;
+export default RegisterWebAuthn;
const useStyles = makeStyles((theme: Theme) => ({
icon: {
diff --git a/web/src/views/LoginPortal/LoginPortal.tsx b/web/src/views/LoginPortal/LoginPortal.tsx
index c31d0f7c9..9a3b9accc 100644
--- a/web/src/views/LoginPortal/LoginPortal.tsx
+++ b/web/src/views/LoginPortal/LoginPortal.tsx
@@ -8,7 +8,7 @@ import {
SecondFactorPushSubRoute,
SecondFactorRoute,
SecondFactorTOTPSubRoute,
- SecondFactorWebauthnSubRoute,
+ SecondFactorWebAuthnSubRoute,
} from "@constants/Routes";
import { RedirectionURL } from "@constants/SearchParams";
import { useConfiguration } from "@hooks/Configuration";
@@ -144,7 +144,7 @@ const LoginPortal = function (props: Props) {
redirect(AuthenticatedRoute, false);
} else {
if (userInfo.method === SecondFactorMethod.Webauthn) {
- redirect(`${SecondFactorRoute}${SecondFactorWebauthnSubRoute}`);
+ redirect(`${SecondFactorRoute}${SecondFactorWebAuthnSubRoute}`);
} else if (userInfo.method === SecondFactorMethod.MobilePush) {
redirect(`${SecondFactorRoute}${SecondFactorPushSubRoute}`);
} else {
diff --git a/web/src/views/LoginPortal/SecondFactor/SecondFactorForm.tsx b/web/src/views/LoginPortal/SecondFactor/SecondFactorForm.tsx
index dde55deac..e86b1afd0 100644
--- a/web/src/views/LoginPortal/SecondFactor/SecondFactorForm.tsx
+++ b/web/src/views/LoginPortal/SecondFactor/SecondFactorForm.tsx
@@ -8,7 +8,7 @@ import { Route, Routes, useNavigate } from "react-router-dom";
import {
SecondFactorPushSubRoute,
SecondFactorTOTPSubRoute,
- SecondFactorWebauthnSubRoute,
+ SecondFactorWebAuthnSubRoute,
LogoutRoute as SignOutRoute,
} from "@constants/Routes";
import { useNotifications } from "@hooks/NotificationsContext";
@@ -16,10 +16,10 @@ import LoginLayout from "@layouts/LoginLayout";
import { Configuration } from "@models/Configuration";
import { SecondFactorMethod } from "@models/Methods";
import { UserInfo } from "@models/UserInfo";
-import { initiateTOTPRegistrationProcess, initiateWebauthnRegistrationProcess } from "@services/RegisterDevice";
+import { initiateTOTPRegistrationProcess, initiateWebAuthnRegistrationProcess } from "@services/RegisterDevice";
import { AuthenticationLevel } from "@services/State";
import { setPreferred2FAMethod } from "@services/UserInfo";
-import { isWebauthnSupported } from "@services/Webauthn";
+import { isWebAuthnSupported } from "@services/Webauthn";
import MethodSelectionDialog from "@views/LoginPortal/SecondFactor/MethodSelectionDialog";
import OneTimePasswordMethod from "@views/LoginPortal/SecondFactor/OneTimePasswordMethod";
import PushNotificationMethod from "@views/LoginPortal/SecondFactor/PushNotificationMethod";
@@ -45,7 +45,7 @@ const SecondFactorForm = function (props: Props) {
const { t: translate } = useTranslation();
useEffect(() => {
- setWebauthnSupported(isWebauthnSupported());
+ setWebauthnSupported(isWebAuthnSupported());
}, [setWebauthnSupported]);
const initiateRegistration = (initiateRegistrationFunc: () => Promise<void>) => {
@@ -124,14 +124,14 @@ const SecondFactorForm = function (props: Props) {
}
/>
<Route
- path={SecondFactorWebauthnSubRoute}
+ path={SecondFactorWebAuthnSubRoute}
element={
<WebauthnMethod
id="webauthn-method"
authenticationLevel={props.authenticationLevel}
// Whether the user has a Webauthn device registered already
registered={props.userInfo.has_webauthn}
- onRegisterClick={initiateRegistration(initiateWebauthnRegistrationProcess)}
+ onRegisterClick={initiateRegistration(initiateWebAuthnRegistrationProcess)}
onSignInError={(err) => createErrorNotification(err.message)}
onSignInSuccess={props.onAuthenticationSuccess}
/>