String id = responseAttributes.get("id");
String accountName = id + "@facebook.com";
Account found = OAuthRealm._.getAccount(accountName);
if (found == null) {
Map<SchemaType, String> metadata = new HashMap<SchemaType, String>();
metadata.put(FBSchemaType.ID, responseAttributes.get("id"));
metadata.put(AXSchemaType.FIRSTNAME, responseAttributes.get("first_name"));
metadata.put(AXSchemaType.LASTNAME, responseAttributes.get("last_name"));
metadata.put(AXSchemaType.FULLNAME, responseAttributes.get("name"));
metadata.put(AXSchemaType.TIMEZONE, responseAttributes.get("timezone"));
found = OAuthRealm._.createAccountInDatabase(accountName, metadata);
}
Account principal = new SubjectAccreditedImpl((AbstractAccount) found, accessToken);
HttpSession session = request.getSession(true);
Subject subject = new Subject();