Skip to content

Instantly share code, notes, and snippets.

@orb

orb/idm.js

Created Mar 9, 2020
Embed
What would you like to do?
idm test
import React, {useState} from "react";
import {Context, CurrentUserDetails} from "@cisco-sbgidm/ui-components";
// https://security-ci.myverysecuresignon.name/.well-known/openid-configuration
/*
*/
const testToken = "eyJraWQiOiJKdGhCRkhRUEtwLUdRSTlBSDJobThlcVdPcGlIaDFyMVdmdEl5RVlPbTBVIiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiIwMHVwa3FtZjFqTnZYOVFKUzBoNyIsInZlciI6MSwiaXNzIjoiaHR0cHM6Ly9zZWN1cml0eS1jaS5teXZlcnlzZWN1cmVzaWdub24ubmFtZSIsImF1ZCI6IjBvYXBmd2lndzNmT296U2hNMGg3IiwiaWF0IjoxNTgwOTA1NDI0LCJleHAiOjE1ODA5MDkwMjQsImp0aSI6IklELjBFdzlFbDd4bjdhMnlqcDE5MGNOd2xiOEhrSFBMZjNBR2pYX1lFWFQ4a2MiLCJhbXIiOlsib3RwIiwibWZhIiwicHdkIl0sImlkcCI6IjAwb290cjM0YmQ1cXBaSFZKMGg3Iiwibm9uY2UiOiJ0YWNvc2hhY2siLCJhdXRoX3RpbWUiOjE1ODA5MDU0MDh9.etZKt2Y8EqgUmBuJyi25s5CzgQxeOpRMmPJgQKfmZ9kuyhfLREEyh1ig5V7k3z6NKVHrq7jlO-0FJKUlmVmgkrU9rscRaBTPYk1HeiNFwz2mwEMwdu4oYR44cpyS8JSo_YO-v5HcntT5_gYtq8CWgBtnpCQHhuwzGwEEIhzi8pXZAyRhEy4rHbYJTrTTYFgKRWV6YZWt-QsN74OcTeuXwUuGZXqleuKrxMjsCxf-LbajWF8e_0aLpyY-LODMMNzGnorEQJflZdhOKVsQibXPV6LxF8DqNaFX2ssgXyYVuh7epzYje_NQFWBe0bm5yGYGdVHHDHjAWmWoWL18C_gTow";
//const testToken = "eyJraWQiOiJHMXU3S2tIamI3aEdjRW5VNGh2NmhrdFJOekdBNWstN1FXYXpT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yWQTf6Y4Pd17WPedRHxkIp4grnfQvKvEJ-7tmxRLA02QxgEjRiGGsBiSPrfXMEXltGG4lCzXZ34cjGtgLC5hJ79eKw
const WrapContext = ({children}) => {
const [token, setToken] = useState(testToken);
const env = "https://7ldihtzxszcafju5fxnhjohcyi.appsync-api.us-east-1.amazonaws.com/graphql";
const startAuth = () => {
// insecure values just for testing
document.location.href = "https://security-ci.myverysecuresignon.name/oauth2/v1/authorize?response_type=id_token&scope=openid&redirect_uri=http%3A%2F%2Flocalhost%3A3003%2Foktatest&client_id=0oapfwigw3fOozShM0h7&nonce=tacoshack&state=dogfood";
};
if (false && document.location.hash != null) {
return (
<div>HASH!!!! {document.location.hash}</div>
);
} else if (!token) {
return (
<div className="col-md-3" style={{margin: "20px"}}>
<p>This integration currently needs an okta auth token.</p>
<button className="btn btn--primary"
onClick={startAuth}
>Get OKTA token</button>
</div>
);
}
return (
<>
<Context env={env}
token={token} />
<div style={{margin: "20px"}}><h2>Token</h2>
<pre>{token}</pre>
<div className="divider"/>
</div>
{children}
</>
);
};
const UserDetailsPage = () => {
return (
<WrapContext>
<CurrentUserDetails />
</WrapContext>
);
};
export default UserDetailsPage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.