Skip to content

Commit 3dd5951

Browse files
committed
add popupWindowTarget setting
1 parent 707cb6d commit 3dd5951

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎src/PopupWindow.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Log from './Log';
55

66
const CheckForPopupClosedInterval = 500;
77
const DefaultPopupFeatures = 'location=no,toolbar=no,width=500,height=500,left=100,top=100';
8+
const DefaultPopupTarget = "_blank";
89

910
export default class PopupWindow {
1011

@@ -20,8 +21,9 @@ export default class PopupWindow {
2021
window.addEventListener("message", this._boundMessageEvent, false);
2122

2223
let features = params.popupWindowFeatures || DefaultPopupFeatures;
24+
let target = params.popupWindowTarget || DefaultPopupTarget;
2325

24-
this._popup = window.open('', '_blank', features);
26+
this._popup = window.open('', target, features);
2527
if (this._popup) {
2628
Log.info("popup successfully created");
2729
this._checkForPopupClosedTimer = window.setInterval(this._checkForPopupClosed.bind(this), CheckForPopupClosedInterval);

‎src/UserManagerSettings.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default class UserManagerSettings extends OidcClientSettings {
1010
constructor({
1111
popup_redirect_uri,
1212
popupWindowFeatures,
13+
popupWindowTarget,
1314
silent_redirect_uri,
1415
automaticSilentRenew = false,
1516
accessTokenExpiringNotificationTime = DefaultAccessTokenExpiringNotificationTime
@@ -18,6 +19,7 @@ export default class UserManagerSettings extends OidcClientSettings {
1819

1920
this._popup_redirect_uri = popup_redirect_uri;
2021
this._popupWindowFeatures = popupWindowFeatures;
22+
this._popupWindowTarget = popupWindowTarget;
2123
this._silent_redirect_uri = silent_redirect_uri;
2224
this._automaticSilentRenew = !!automaticSilentRenew;
2325
this._accessTokenExpiringNotificationTime = accessTokenExpiringNotificationTime;
@@ -29,6 +31,9 @@ export default class UserManagerSettings extends OidcClientSettings {
2931
get popupWindowFeatures(){
3032
return this._popupWindowFeatures;
3133
}
34+
get popupWindowTarget(){
35+
return this._popupWindowTarget;
36+
}
3237

3338
get silent_redirect_uri() {
3439
return this._silent_redirect_uri;

‎test/unit/UserManagerSettings.spec.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ describe("UserManagerSettings", function () {
4545
});
4646

4747
});
48+
49+
describe("popupWindowTarget", function () {
50+
51+
it("should return value from initial settings", function () {
52+
let subject = new UserManagerSettings({ popupWindowTarget: 'foo' });
53+
subject.popupWindowTarget.should.equal('foo');
54+
});
55+
56+
});
4857

4958
describe("silent_redirect_uri", function () {
5059

0 commit comments

Comments
 (0)