fix: OIDC Redirect erases query parameters (#1773)
* fix: OIDC Redirect erases query parameters * prevent issues Co-authored-by: James Petts <jamesapetts@gmail.com>
This commit is contained in:
parent
ab25be3520
commit
6123741765
@ -52,10 +52,13 @@ class OHIFStandaloneViewer extends Component {
|
|||||||
const { appConfig = {} } = this.context;
|
const { appConfig = {} } = this.context;
|
||||||
const userNotLoggedIn = userManager && (!user || user.expired);
|
const userNotLoggedIn = userManager && (!user || user.expired);
|
||||||
if (userNotLoggedIn) {
|
if (userNotLoggedIn) {
|
||||||
const pathname = this.props.location.pathname;
|
const { pathname, search } = this.props.location;
|
||||||
|
|
||||||
if (pathname !== '/callback') {
|
if (pathname !== '/callback') {
|
||||||
sessionStorage.setItem('ohif-redirect-to', pathname);
|
sessionStorage.setItem(
|
||||||
|
'ohif-redirect-to',
|
||||||
|
JSON.stringify({ pathname, search })
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -103,12 +106,21 @@ class OHIFStandaloneViewer extends Component {
|
|||||||
|
|
||||||
userManager.removeUser().then(() => {
|
userManager.removeUser().then(() => {
|
||||||
if (targetLinkUri !== null) {
|
if (targetLinkUri !== null) {
|
||||||
|
const ohifRedirectTo = {
|
||||||
|
pathname: new URL(targetLinkUri).pathname,
|
||||||
|
};
|
||||||
sessionStorage.setItem(
|
sessionStorage.setItem(
|
||||||
'ohif-redirect-to',
|
'ohif-redirect-to',
|
||||||
new URL(targetLinkUri).pathname
|
JSON.stringify(ohifRedirectTo)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
sessionStorage.setItem('ohif-redirect-to', '/');
|
const ohifRedirectTo = {
|
||||||
|
pathname: '/',
|
||||||
|
};
|
||||||
|
sessionStorage.setItem(
|
||||||
|
'ohif-redirect-to',
|
||||||
|
JSON.stringify(ohifRedirectTo)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loginHint !== null) {
|
if (loginHint !== null) {
|
||||||
@ -191,10 +203,10 @@ class OHIFStandaloneViewer extends Component {
|
|||||||
{match === null ? (
|
{match === null ? (
|
||||||
<></>
|
<></>
|
||||||
) : (
|
) : (
|
||||||
<ErrorBoundary context={match.url}>
|
<ErrorBoundary context={match.url}>
|
||||||
<Component match={match} location={this.props.location} />
|
<Component match={match} location={this.props.location} />
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
)}
|
)}
|
||||||
</CSSTransition>
|
</CSSTransition>
|
||||||
)}
|
)}
|
||||||
</Route>
|
</Route>
|
||||||
|
|||||||
@ -14,9 +14,11 @@ class CallbackPage extends Component {
|
|||||||
<CallbackComponent
|
<CallbackComponent
|
||||||
userManager={this.props.userManager}
|
userManager={this.props.userManager}
|
||||||
successCallback={() => {
|
successCallback={() => {
|
||||||
const pathname = sessionStorage.getItem('ohif-redirect-to');
|
const { pathname, search = '' } = JSON.parse(
|
||||||
|
sessionStorage.getItem('ohif-redirect-to')
|
||||||
|
);
|
||||||
|
|
||||||
this.props.history.push(pathname);
|
this.props.history.push({ pathname, search });
|
||||||
}}
|
}}
|
||||||
errorCallback={error => {
|
errorCallback={error => {
|
||||||
//this.props.history.push("/");
|
//this.props.history.push("/");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user