Author: anil.saldhana(a)jboss.com
Date: 2011-09-30 00:15:52 -0400 (Fri, 30 Sep 2011)
New Revision: 1270
Modified:
social/trunk/openid/src/main/java/org/picketlink/social/openid/auth/OpenIDProcessor.java
social/trunk/social/src/main/java/org/picketlink/social/auth/ExternalAuthenticator.java
Log:
handle case when user chooses not to share data at the openid provider
Modified:
social/trunk/openid/src/main/java/org/picketlink/social/openid/auth/OpenIDProcessor.java
===================================================================
---
social/trunk/openid/src/main/java/org/picketlink/social/openid/auth/OpenIDProcessor.java 2011-09-29
23:13:29 UTC (rev 1269)
+++
social/trunk/openid/src/main/java/org/picketlink/social/openid/auth/OpenIDProcessor.java 2011-09-30
04:15:52 UTC (rev 1270)
@@ -28,6 +28,8 @@
import java.util.List;
import java.util.Map;
+import javax.servlet.http.HttpServletResponse;
+
import org.apache.catalina.Realm;
import org.apache.catalina.Session;
import org.apache.catalina.connector.Request;
@@ -284,6 +286,10 @@
if(trace)
log.trace("Logged in as:" + principal);
}
+ else
+ {
+ response.sendError(HttpServletResponse.SC_FORBIDDEN);
+ }
return principal;
}
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 2011-09-29
23:13:29 UTC (rev 1269)
+++
social/trunk/social/src/main/java/org/picketlink/social/auth/ExternalAuthenticator.java 2011-09-30
04:15:52 UTC (rev 1270)
@@ -235,7 +235,7 @@
Principal principal = facebookProcessor.getPrincipal(request, response,
context.getRealm());
if(principal == null)
- throw new RuntimeException("Principal was null. Maybe login modules need
to be configured properly.");
+ throw new RuntimeException("Principal was null. Maybe login modules need
to be configured properly. Or user chose no data");
String userName = principal.getName();
@@ -299,6 +299,10 @@
}
Principal principal = openidProcessor.processIncomingAuthResult(request,
response, context.getRealm());
+
+ if(principal == null)
+ throw new RuntimeException("Principal was null. Maybe login modules need
to be configured properly. Or user chose no data");
+
String principalName = principal.getName();
request.getSessionInternal().setNote(Constants.SESS_USERNAME_NOTE,
principalName);
request.getSessionInternal().setNote(Constants.SESS_PASSWORD_NOTE,
"");