Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add the mfa recipe and basic support #758

Merged
merged 24 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
26d1e48
chore: update to mfa branch of web-js
porcellus Oct 12, 2023
db3be18
feat: mfa recipe setup
porcellus Oct 13, 2023
8b339a4
feat: add support for firstFactor
porcellus Oct 13, 2023
02429f8
fix: fix chooseComponentBasedOnFirstFactors to properly get the max c…
porcellus Oct 15, 2023
f3c955e
feat: navigation based on claim validation failures
porcellus Oct 16, 2023
8932a0e
feat: implement factor chooser screen
porcellus Oct 16, 2023
ad99b5f
feat: factor chooser fixes and updates
porcellus Oct 19, 2023
e61dd45
feat: add back button to factor chooser and filter the options
porcellus Oct 30, 2023
85b1c4d
test: update how back button is selected in tests
porcellus Oct 30, 2023
a9ce3b5
feat: self-review fixes & updates
porcellus Oct 31, 2023
3deb3cd
fix: firstFactors + test helpers
porcellus Nov 6, 2023
7355f50
feat: clean up first factor handling
porcellus Nov 7, 2023
792316b
feat: self-review fixes
porcellus Nov 9, 2023
f45271c
chore: add mfa ui to size limits
porcellus Nov 9, 2023
1990358
refactor: remove updates that will be added in other PRs + simplifica…
porcellus Nov 9, 2023
46ae327
chore: increase size limits
porcellus Nov 9, 2023
150c9ad
test: add reset method to mfa recipe
porcellus Nov 9, 2023
f84d9b8
feat: update design and fix font-weight issues
porcellus Nov 15, 2023
ea768d1
chore: update web-js dep
porcellus Nov 15, 2023
00ee185
refactor: use redirectToFactor instead of re-implementing
porcellus Nov 16, 2023
7891b73
fix: override and routing fixes
porcellus Nov 21, 2023
9d8fae1
feat: allow showing matching sub-recipe components if not on websiteb…
porcellus Dec 6, 2023
2a6ab14
Merge branch 'feat/mfa/base' into feat/mfa/recipe-setup
porcellus Dec 9, 2023
aee9942
chore: add missing notes to changelog
porcellus Dec 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,39 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)

## [0.36.0] - 2023-11-XX

### Overview

#### Introducing MFA

With this release, we are introducing MultiFactorAuth and TOTP, this will let you:

- require (2FA or MFA) during sign in
- make use of our TOTP

Check our [guide](https://supertokens.com/docs/thirdpartyemailpassword/common-customizations/multi-factor-auth/overview) for more information.

To use this you'll need compatible versions:

- Core>=8.0.0
- supertokens-node>=17.0.0 (support is pending in other backend SDKs)
- supertokens-website>=17.0.3
- supertokens-web-js>=0.9.0
- supertokens-auth-react>=0.36.0

### Changes

- Added support for FDI 1.19 (Node SDK>= 17.0.0), but keeping support FDI version 1.17 and 1.18 (node >= 15.0.0, golang>=0.13, python>=0.15.0)
- Added `firstFactors` into the return type of `getLoginMethods`
- Added the `MultiFactorAuth` recipe
- Updated how we select which login UI to show to take the `firstFactors` config value into account (defined in the `MultiFactorAuth` recipe or in the tenant information)
- Refactored/renamed some styling options (`resetPasswordHeaderTitle` -> `headerTitle withBackButton`)
- Added a `useShadowDom` prop to the `AccessDeniedScreen`
- Added an `error` prop to the `AccessDeniedScreen` that can be used to describe the reason access is denied.
- Fixed a font loading issue, that caused apps using the default (Rubik) font to appear with the incorrect font weights
- Some default styling has changed related to how fonts/font-weights are applied

## [0.35.9] - 2023-12-06

- Fixes ThirdPartyEmailPassword rendering sign in/up switcher even with disabled email password. Instead it'll now render `SignInAndUpHeader_Override` in this case (overrideable as `ThirdPartySignInAndUpHeader`). Overriding `ThirdPartyEmailPasswordHeader_Override` should still cover all cases.
Expand Down
4 changes: 4 additions & 0 deletions examples/for-tests-react-16/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ const formFields = [
const testContext = getTestContext();

let recipeList = [
MultiFactorAuth.init({
firstFactors: testContext.firstFactors,
}),
Multitenancy.init({
override: {
functions: (oI) => ({
Expand Down Expand Up @@ -491,6 +494,7 @@ export function DashboardHelper({ redirectOnLogout, ...props } = {}) {
</div>
<div className="session-context-userId">session context userID: {sessionContext.userId}</div>
<pre className="invalidClaims">{JSON.stringify(sessionContext.invalidClaims, undefined, 2)}</pre>
<a onClick={() => MultiFactorAuth.redirectToFactorChooser(true, props.history)}>MFA chooser</a>
</div>
);
}
Expand Down
3 changes: 2 additions & 1 deletion examples/for-tests-react-16/src/AppWithReactDomRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ import { EmailVerificationPreBuiltUI } from "supertokens-auth-react/recipe/email
import { EmailPasswordPreBuiltUI } from "supertokens-auth-react/recipe/emailpassword/prebuiltui";
import { PasswordlessPreBuiltUI } from "supertokens-auth-react/recipe/passwordless/prebuiltui";
import { ThirdPartyPreBuiltUI } from "supertokens-auth-react/recipe/thirdparty/prebuiltui";
import { MultiFactorAuthPreBuiltUI } from "supertokens-auth-react/recipe/multifactorauth/prebuiltui";
import { AccessDeniedScreen } from "supertokens-auth-react/recipe/session/prebuiltui";
import { getEnabledRecipes } from "./testContext";

function AppWithReactDomRouter(props) {
const enabledRecipes = getEnabledRecipes();
const emailVerificationMode = window.localStorage.getItem("mode") || "OFF";

let recipePreBuiltUIList = [];
let recipePreBuiltUIList = [MultiFactorAuthPreBuiltUI];
if (enabledRecipes.includes("emailpassword")) {
recipePreBuiltUIList.push(EmailPasswordPreBuiltUI);
}
Expand Down
1 change: 1 addition & 0 deletions examples/for-tests-react-16/src/testContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export function getTestContext() {
staticProviderList: localStorage.getItem("staticProviderList"),
mockTenantId: localStorage.getItem("mockTenantId"),
clientType: localStorage.getItem("clientType") || undefined,
firstFactors: localStorage.getItem("firstFactors")?.split(", "),
};
return ret;
}
Expand Down
5 changes: 5 additions & 0 deletions examples/for-tests/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Multitenancy from "supertokens-auth-react/recipe/multitenancy";
import ThirdPartyEmailPassword from "supertokens-auth-react/recipe/thirdpartyemailpassword";
import ThirdPartyPasswordless from "supertokens-auth-react/recipe/thirdpartypasswordless";
import UserRoles from "supertokens-auth-react/recipe/userroles";
import MultiFactorAuth from "supertokens-auth-react/recipe/multifactorauth";

import axios from "axios";
import { useSessionContext } from "supertokens-auth-react/recipe/session";
Expand Down Expand Up @@ -332,6 +333,9 @@ const customFields = [
const testContext = getTestContext();

let recipeList = [
MultiFactorAuth.init({
firstFactors: testContext.firstFactors,
}),
Multitenancy.init({
override: {
functions: (oI) => ({
Expand Down Expand Up @@ -641,6 +645,7 @@ export function DashboardHelper({ redirectOnLogout, ...props } = {}) {
</div>
<div className="session-context-userId">session context userID: {sessionContext.userId}</div>
<pre className="invalidClaims">{JSON.stringify(sessionContext.invalidClaims, undefined, 2)}</pre>
<a onClick={() => MultiFactorAuth.redirectToFactorChooser(true, props.history)}>MFA chooser</a>
</div>
);
}
Expand Down
3 changes: 2 additions & 1 deletion examples/for-tests/src/AppWithReactDomRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { PasswordlessPreBuiltUI } from "supertokens-auth-react/recipe/passwordle
import { EmailVerificationPreBuiltUI } from "supertokens-auth-react/recipe/emailverification/prebuiltui";
import { ThirdPartyPreBuiltUI } from "supertokens-auth-react/recipe/thirdparty/prebuiltui";
import { AccessDeniedScreen } from "supertokens-auth-react/recipe/session/prebuiltui";
import { MultiFactorAuthPreBuiltUI } from "supertokens-auth-react/recipe/multifactorauth/prebuiltui";
import { BaseComponent, Home, Contact, Dashboard, DashboardNoAuthRequired } from "./App";
import { getEnabledRecipes } from "./testContext";

Expand All @@ -34,7 +35,7 @@ function AppWithReactDomRouter(props) {
const emailVerificationMode = window.localStorage.getItem("mode") || "OFF";
const websiteBasePath = window.localStorage.getItem("websiteBasePath") || undefined;

let recipePreBuiltUIList = [];
let recipePreBuiltUIList = [MultiFactorAuthPreBuiltUI];
if (enabledRecipes.includes("emailpassword")) {
recipePreBuiltUIList.push(EmailPasswordPreBuiltUI);
}
Expand Down
1 change: 1 addition & 0 deletions examples/for-tests/src/testContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export function getTestContext() {
staticProviderList: localStorage.getItem("staticProviderList"),
mockTenantId: localStorage.getItem("mockTenantId"),
clientType: localStorage.getItem("clientType") || undefined,
firstFactors: localStorage.getItem("firstFactors")?.split(", "),
formFieldType: {
signIn: localStorage.getItem("SIGNIN_SETTING_TYPE"),
signUp: localStorage.getItem("SIGNUP_SETTING_TYPE"),
Expand Down
2 changes: 1 addition & 1 deletion frontendDriverInterfaceSupported.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_comment": "contains a list of frontend-backend interface versions that this package supports",
"versions": ["1.17", "1.18"]
"versions": ["1.17", "1.18", "1.19"]
}
67 changes: 0 additions & 67 deletions lib/build/SuperTokensBranding.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 72 additions & 0 deletions lib/build/authRecipe-shared2.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading