[picketlink-commits] Picketlink SVN: r1523 - social/trunk/social/src/main/java/org/picketlink/social/auth.
picketlink-commits at lists.jboss.org
picketlink-commits at lists.jboss.org
Mon Mar 19 11:57:17 EDT 2012
Author: anil.saldhana at jboss.com
Date: 2012-03-19 11:57:16 -0400 (Mon, 19 Mar 2012)
New Revision: 1523
Modified:
social/trunk/social/src/main/java/org/picketlink/social/auth/ExternalAuthenticator.java
Log:
deal with reload of page
Modified: social/trunk/social/src/main/java/org/picketlink/social/auth/ExternalAuthenticator.java
===================================================================
--- social/trunk/social/src/main/java/org/picketlink/social/auth/ExternalAuthenticator.java 2012-03-19 15:56:46 UTC (rev 1522)
+++ social/trunk/social/src/main/java/org/picketlink/social/auth/ExternalAuthenticator.java 2012-03-19 15:57:16 UTC (rev 1523)
@@ -213,7 +213,14 @@
if(trace) log.trace("state="+ state);
if( STATES.FINISH.name().equals(state))
- return true;
+ {
+ Principal principal = request.getPrincipal();
+ if(principal == null)
+ {
+ principal = facebookProcessor.getPrincipal(request, response, context.getRealm());
+ }
+ return dealWithFacebookPrincipal(request, response, principal);
+ }
if( state == null || state.isEmpty())
{
@@ -237,21 +244,7 @@
if(principal == null)
throw new RuntimeException("Principal was null. Maybe login modules need to be configured properly. Or user chose no data");
- String userName = principal.getName();
-
- request.getSessionInternal().setNote(Constants.SESS_USERNAME_NOTE, userName);
- request.getSessionInternal().setNote(Constants.SESS_PASSWORD_NOTE, "");
- request.setUserPrincipal(principal);
-
- if (saveRestoreRequest)
- {
- this.restoreRequest(request, request.getSessionInternal());
- }
- registerWithAuthenticatorBase(request,response,principal,userName);
-
- request.getSession().setAttribute("STATE", STATES.FINISH.name());
-
- return true;
+ return dealWithFacebookPrincipal(request, response, principal);
}
return false;
}
@@ -353,4 +346,23 @@
}
}
}
+
+ private boolean dealWithFacebookPrincipal(Request request, Response response, Principal principal) throws IOException
+ {
+ String userName = principal.getName();
+
+ request.getSessionInternal().setNote(Constants.SESS_USERNAME_NOTE, userName);
+ request.getSessionInternal().setNote(Constants.SESS_PASSWORD_NOTE, "");
+ request.setUserPrincipal(principal);
+
+ if (saveRestoreRequest)
+ {
+ this.restoreRequest(request, request.getSessionInternal());
+ }
+ registerWithAuthenticatorBase(request,response,principal,userName);
+
+ request.getSession().setAttribute("STATE", STATES.FINISH.name());
+
+ return true;
+ }
}
\ No newline at end of file
More information about the picketlink-commits
mailing list