We are doing something similar to # 4 on one of our webapps. Basically, the process:
1) Create (or override for FacebookApiAdapter) the setConnectionVales method.
2) Take the email (or everything that you use for internal usernames) from your Facebook profile.
3) Create a new Auth token:
UsernamePasswordAuthenticationToken newAuth = new UsernamePasswordAuthenticationToken(user, "yourrealm",authorities);
where the user matches your internal user type and the credentials are Set (hint: just add lines with the new SimpleGrantedAuthority function)
4) Set a new authentication token in SpringSecurityContext:
SecurityContextHolder.getContext().setAuthentication(newAuth);
You can then use the usual Spring security setting to protect things with ROLE if the new token has this role in its set of permissions.
source share