Allow serial login flows to co-exist

parent 518e296c
......@@ -3513,7 +3513,14 @@ angular.module('openshiftCommonServices')
var makeState = function(then) {
var nonce = String(new Date().getTime()) + "-" + getRandomInts(8).join("");
try {
window.localStorage[nonceKey] = nonce;
if (window.localStorage[nonceKey] && window.localStorage[nonceKey].length > 10) {
// Reuse an existing nonce if we have one, so that when multiple tabs get kicked to a login screen,
// any of them can succeed, not just the last login flow that was started. The nonce gets cleared when the login flow completes.
nonce = window.localStorage[nonceKey];
} else {
// Otherwise store the new nonce for comparison in parseState()
window.localStorage[nonceKey] = nonce;
}
} catch(e) {
authLogger.log("RedirectLoginService.makeState, localStorage error: ", e);
}
......
......@@ -5564,7 +5564,14 @@ angular.module('openshiftCommonServices')
var makeState = function(then) {
var nonce = String(new Date().getTime()) + "-" + getRandomInts(8).join("");
try {
window.localStorage[nonceKey] = nonce;
if (window.localStorage[nonceKey] && window.localStorage[nonceKey].length > 10) {
// Reuse an existing nonce if we have one, so that when multiple tabs get kicked to a login screen,
// any of them can succeed, not just the last login flow that was started. The nonce gets cleared when the login flow completes.
nonce = window.localStorage[nonceKey];
} else {
// Otherwise store the new nonce for comparison in parseState()
window.localStorage[nonceKey] = nonce;
}
} catch(e) {
authLogger.log("RedirectLoginService.makeState, localStorage error: ", e);
}
......
......@@ -2493,7 +2493,7 @@ return randomValues;
}, nonceKey = "RedirectLoginService.nonce", makeState = function(then) {
var nonce = String(new Date().getTime()) + "-" + getRandomInts(8).join("");
try {
window.localStorage[nonceKey] = nonce;
window.localStorage[nonceKey] && window.localStorage[nonceKey].length > 10 ? nonce = window.localStorage[nonceKey] :window.localStorage[nonceKey] = nonce;
} catch (e) {
authLogger.log("RedirectLoginService.makeState, localStorage error: ", e);
}
......
......@@ -74,7 +74,14 @@ angular.module('openshiftCommonServices')
var makeState = function(then) {
var nonce = String(new Date().getTime()) + "-" + getRandomInts(8).join("");
try {
window.localStorage[nonceKey] = nonce;
if (window.localStorage[nonceKey] && window.localStorage[nonceKey].length > 10) {
// Reuse an existing nonce if we have one, so that when multiple tabs get kicked to a login screen,
// any of them can succeed, not just the last login flow that was started. The nonce gets cleared when the login flow completes.
nonce = window.localStorage[nonceKey];
} else {
// Otherwise store the new nonce for comparison in parseState()
window.localStorage[nonceKey] = nonce;
}
} catch(e) {
authLogger.log("RedirectLoginService.makeState, localStorage error: ", e);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment