OIDC Initiating Login from a Third Party
https://openid.net/specs/openid-connect-core-1_0.html#ThirdPartyInitiatedLogin
This commit is contained in:
parent
b449f8eb0e
commit
0c6c5a5d51
@ -83,6 +83,44 @@ class OHIFStandaloneViewer extends Component {
|
|||||||
path="/callback"
|
path="/callback"
|
||||||
render={() => <CallbackPage userManager={userManager} />}
|
render={() => <CallbackPage userManager={userManager} />}
|
||||||
/>
|
/>
|
||||||
|
<Route
|
||||||
|
path="/login"
|
||||||
|
component={() => {
|
||||||
|
const queryParams = new URLSearchParams(
|
||||||
|
this.props.location.search
|
||||||
|
);
|
||||||
|
const iss = queryParams.get('iss');
|
||||||
|
const loginHint = queryParams.get('login_hint');
|
||||||
|
const targetLinkUri = queryParams.get('target_link_uri');
|
||||||
|
const oidcAuthority =
|
||||||
|
appConfig.oidc !== null && appConfig.oidc[0].authority;
|
||||||
|
if (iss !== oidcAuthority) {
|
||||||
|
console.error(
|
||||||
|
'iss of /login does not match the oidc authority'
|
||||||
|
);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
userManager.removeUser().then(() => {
|
||||||
|
if (targetLinkUri !== null) {
|
||||||
|
sessionStorage.setItem(
|
||||||
|
'ohif-redirect-to',
|
||||||
|
new URL(targetLinkUri).pathname
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
sessionStorage.setItem('ohif-redirect-to', '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loginHint !== null) {
|
||||||
|
userManager.signinRedirect({ login_hint: loginHint });
|
||||||
|
} else {
|
||||||
|
userManager.signinRedirect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<Route
|
<Route
|
||||||
component={() => {
|
component={() => {
|
||||||
userManager.getUser().then(user => {
|
userManager.getUser().then(user => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user