Revision 4ea3c87b src/gr/grnet/pithos/web/client/Pithos.java
b/src/gr/grnet/pithos/web/client/Pithos.java | ||
---|---|---|
526 | 526 |
* Parse and store the user credentials to the appropriate fields. |
527 | 527 |
*/ |
528 | 528 |
private boolean parseUserCredentials() { |
529 |
username = Window.Location.getParameter("user"); |
|
530 |
token = Window.Location.getParameter("token"); |
|
531 | 529 |
Configuration conf = (Configuration) GWT.create(Configuration.class); |
532 | 530 |
Dictionary otherProperties = Dictionary.getDictionary("otherProperties"); |
533 |
if (username == null || username.length() == 0 || token == null || token.length() == 0) { |
|
534 |
String cookie = otherProperties.get("authCookie"); |
|
535 |
String auth = Cookies.getCookie(cookie); |
|
536 |
if (auth == null) { |
|
537 |
authenticateUser(); |
|
538 |
return false; |
|
539 |
} |
|
540 |
if (auth.startsWith("\"")) |
|
541 |
auth = auth.substring(1); |
|
542 |
if (auth.endsWith("\"")) |
|
543 |
auth = auth.substring(0, auth.length() - 1); |
|
544 |
String[] authSplit = auth.split("\\" + conf.cookieSeparator(), 2); |
|
545 |
if (authSplit.length != 2) { |
|
546 |
authenticateUser(); |
|
547 |
return false; |
|
548 |
} |
|
549 |
username = authSplit[0]; |
|
550 |
token = authSplit[1]; |
|
531 |
String cookie = otherProperties.get("authCookie"); |
|
532 |
String auth = Cookies.getCookie(cookie); |
|
533 |
if (auth == null) { |
|
534 |
authenticateUser(); |
|
535 |
return false; |
|
551 | 536 |
} |
552 |
else |
|
553 |
Cookies.setCookie(otherProperties.get("authCookie"), username + conf.cookieSeparator() + token, null, "", "/", false); |
|
537 |
if (auth.startsWith("\"")) |
|
538 |
auth = auth.substring(1); |
|
539 |
if (auth.endsWith("\"")) |
|
540 |
auth = auth.substring(0, auth.length() - 1); |
|
541 |
String[] authSplit = auth.split("\\" + conf.cookieSeparator(), 2); |
|
542 |
if (authSplit.length != 2) { |
|
543 |
authenticateUser(); |
|
544 |
return false; |
|
545 |
} |
|
546 |
username = authSplit[0]; |
|
547 |
token = authSplit[1]; |
|
554 | 548 |
|
555 | 549 |
String gotoUrl = Window.Location.getParameter("goto"); |
556 | 550 |
if (gotoUrl != null && gotoUrl.length() > 0) { |
Also available in: Unified diff