Skip to content

Commit

Permalink
add useReplaceToNavigate for signinRedirect IdentityModel#896
Browse files Browse the repository at this point in the history
  • Loading branch information
brockallen committed Jul 20, 2019
1 parent 75b6014 commit 9bcf820
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion samples/VanillaJS/public/code-identityserver-sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function removeUser() {

function startSigninMainWindow() {
var someState = {message:'some data'};
mgr.signinRedirect({state:someState}).then(function() {
mgr.signinRedirect({state:someState, useReplaceToNavigate:true}).then(function() {
log("signinRedirect done");
}).catch(function(err) {
log(err);
Expand Down
7 changes: 6 additions & 1 deletion src/RedirectNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ export class RedirectNavigator {
return Promise.reject(new Error("No url provided"));
}

window.location = params.url;
if (params.useReplaceToNavigate) {
window.location.replace(params.url);
}
else {
window.location = params.url;
}

return Promise.resolve();
}
Expand Down
5 changes: 4 additions & 1 deletion src/UserManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ export class UserManager extends OidcClient {

signinRedirect(args = {}) {
args.request_type = "si:r";
return this._signinStart(args, this._redirectNavigator).then(()=>{
let navParams = {
useReplaceToNavigate : args.useReplaceToNavigate
};
return this._signinStart(args, this._redirectNavigator, navParams).then(()=>{
Log.info("UserManager.signinRedirect: successful");
});
}
Expand Down

0 comments on commit 9bcf820

Please sign in to comment.