/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { CognitoAuth } from "@aws-northstar/ui"; import React, { useContext } from "react"; import Config from "../../config.json"; import { RuntimeConfigContext } from "../RuntimeContext"; /** * Sets up the runtimeContext and Cognito auth. * * This assumes a runtime-config.json file is present at '/'. In order for Auth to be set up automatically, * the runtime-config.json must have the following properties configured: [region, userPoolId, userPoolWebClientId, identityPoolId]. */ const Auth: React.FC = ({ children }) => { const runtimeContext = useContext(RuntimeConfigContext); return runtimeContext?.userPoolId && runtimeContext?.userPoolWebClientId && runtimeContext?.region && runtimeContext?.identityPoolId ? ( {children} ) : ( <> ); }; export default Auth;