[
https://issues.apache.org/jira/browse/KNOX-2625?focusedWorklogId=643027&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-643027
]
ASF GitHub Bot logged work on KNOX-2625:
----------------------------------------
Author: ASF GitHub Bot
Created on: 27/Aug/21 22:04
Start Date: 27/Aug/21 22:04
Worklog Time Spent: 10m
Work Description: lmccay commented on a change in pull request #476:
URL: https://github.com/apache/knox/pull/476#discussion_r697741864
##########
File path:
gateway-applications/src/main/resources/applications/knoxauth/app/js/knoxauth.js
##########
@@ -19,70 +19,74 @@ var loginPageSuffix = "/knoxauth/login.html";
var webssoURL = "/api/v1/websso?originalUrl=";
var userAgent = navigator.userAgent.toLowerCase();
-function get(name){
- //KNOX-820 changing the regex so that multiple query params get included
with the 'originalUrl'
- if(name=(new
RegExp('[?&]'+encodeURIComponent(name)+'=([^]*)')).exec(location.search))
- return decodeURIComponent(name[1]);
+function get(name) {
+ //KNOX-820 changing the regex so that multiple query params get
included with the 'originalUrl'
+ if ((name = (new RegExp('[?&]' + encodeURIComponent(name) +
'=([^]*)')).exec(location.search))) {
+ return decodeURIComponent(name[1]);
+ }
}
function testSameOrigin(url) {
- var loc = window.location,
- a = document.createElement('a');
- a.href = url;
- return a.hostname == loc.hostname &&
- a.port == loc.port &&
- a.protocol == loc.protocol;
+ var loc = window.location,
+ a = document.createElement('a');
+ a.href = url;
+ return a.hostname == loc.hostname &&
+ a.port == loc.port &&
+ a.protocol == loc.protocol;
}
function redirect(redirectUrl) {
- try { window.location.replace(redirectUrl); }
- catch(e) { window.location = redirectUrl; }
+ try {
+ window.location.replace(redirectUrl);
+ } catch (e) {
+ window.location = redirectUrl;
+ }
}
var keypressed = function(event) {
- if (event.keyCode == 13) {
- login();
- }
-}
+ if (event.keyCode == 13) {
+ login();
+ }
+};
var login = function() {
- var pathname = window.location.pathname;
- var topologyContext = pathname.replace(loginPageSuffix, "");;
- var loginURL = topologyContext + webssoURL;
- var form = document.forms[0];
- var username = form.username.value;
- var password = form.password.value;
- var _login = function() {
- var originalUrl = get("originalUrl");
- var idpUrl = loginURL + originalUrl;
- var redirectUrl = originalUrl;
- //Instantiate HTTP Request
- var request = ((window.XMLHttpRequest) ? new XMLHttpRequest() : new
ActiveXObject("Microsoft.XMLHTTP"));
- request.open("POST", idpUrl, true);
- request.setRequestHeader("Authorization", "Basic " + btoa(username +
":" + password))
- request.send(null);
+ var pathname = window.location.pathname;
+ var topologyContext = pathname.replace(loginPageSuffix, "");
+ var loginURL = topologyContext + webssoURL;
+ var form = document.forms[0];
+ var username = form.username.value;
+ var password = form.password.value;
+ var _login = function() {
+ var originalUrl = get("originalUrl");
+ var idpUrl = loginURL + originalUrl;
+ var redirectUrl = originalUrl;
+ //Instantiate HTTP Request
+ var request = ((window.XMLHttpRequest) ? new XMLHttpRequest() :
new ActiveXObject("Microsoft.XMLHTTP"));
+ request.open("POST", idpUrl, true);
+ request.setRequestHeader("Authorization", "Basic " +
btoa(username + ":" + password));
+ request.send(null);
- //Process Response
- request.onreadystatechange = function(){
- if (request.readyState == 4) {
- if (request.status==0 || request.status==200 ||
request.status==204 || request.status==307 || request.status==303) {
- if (testSameOrigin(originalUrl) == false) {
- redirectUrl = "redirecting.html?originalUrl=" +
originalUrl;
- }
- redirect(redirectUrl);
- } else {
- $('#errorBox').show();
- $('#signInLoading').hide();
- $('#signIn').removeAttr('disabled');
- if (request.status==401) {
- $('#errorBox .errorMsg').text("The username or password
you entered is incorrect.");
- } else {
- $('#errorBox .errorMsg').text("Response from " +
request.responseURL + " - " + request.status + ": " + request.statusText);
- }
- }
- }
- }
- }
+ //Process Response
+ request.onreadystatechange = function() {
+ if (request.readyState == 4) {
+ if (request.status == 0 || request.status ==
200 || request.status == 204 || request.status == 307 || request.status == 303)
{
+ if (testSameOrigin(originalUrl) ==
false) {
+ redirectUrl =
"redirecting.html?originalUrl=" + originalUrl;
+ }
+ redirect(redirectUrl);
+ } else {
+ $('#errorBox').show();
+ $('#signInLoading').hide();
+ $('#signIn').removeAttr('disabled');
+ if (request.status == 401) {
+ $('#errorBox
.errorMsg').text("The username or password you entered is incorrect.");
+ } else {
+ $('#errorBox
.errorMsg').text("Response from " + request.responseURL + " - " +
request.status + ": " + request.statusText);
+ }
+ }
+ }
+ };
+ };
- _login();
-}
+ _login();
+};
Review comment:
Yeah? Okay.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 643027)
Time Spent: 50m (was: 40m)
> Enhance KnoxSSO to Support Session Timeout and Logout
> -----------------------------------------------------
>
> Key: KNOX-2625
> URL: https://issues.apache.org/jira/browse/KNOX-2625
> Project: Apache Knox
> Issue Type: Improvement
> Components: KnoxSSO
> Reporter: Larry McCay
> Assignee: Larry McCay
> Priority: Major
> Fix For: 1.6.0
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> By extending the WebSSOResource in KnoxSSO to accept redirects with a
> session-state query param, we can provide hooks for handling session
> expiry/timeout and logout.
> This will assume that a participating application redirects to a given
> session timeout or logout page which can be rewritten to or be configured to
> be the knoxsso endpoint with a session-state change query param.
> We will then be able to determine how to handle each and to give the user a
> choice when appropriate.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)