The FB integration is available from GateIn 3.6.0.Final automatically and documented here https://docs.jboss.org/author/display/GTNPORTAL36/OAuth+-+Authentication+with+social+network+accounts . If default GateIn registration screen doesn't suit your needs for some reason, maybe you can do this by:
- Convert your Richfaces application into portlet and add this portlet to some page (let's assume it's /portal/richfacesRegistration). Page should be likely visible just for members of group /platform/guests (which represents anonymous user in GateIn)
- Change attribute "registrationUrl" of OAuthAuthenticationFilter in file GATEIN_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/sso/oauth-configuration.xml to your registration page (/portal/richfacesRegistration)
- Probably you will also need to comment OAuthLifecycle in GATEIN_HOME/gatein/gatein.ear/portal.war/WEB-INF/webui-configuration.xml (or maybe override the class if you want some custom behaviour. Because this lifecycle also handles displaying of error messages in oauth integration...)
- In your Richfaces application, you may then need to obtain authenticated user from AuthenticationRegistry from attribute OAuthConstants.ATTRIBUTE_AUTHENTICATED_PORTAL_USER . Once you obtain User object, you can do whatever you want with it. For example you can use email address of this User object to be displayed as username in your registration screen.
But note that email addresses are not permitted as username in GateIn by default (Characters @ and . are not allowed) .
Look for existing GateIn classes for more reference if needed. For example:
If you want some even more custom behaviour, you can possibly override OAuthAuthenticationFilter and configure it in oauth-configuration.xml .
thank you for reply, it looks like what I needed.
Hi, I have one more question. I've modified OAuthLifecycle and OAuthAuthenticationFilter classes. Login process redirects user from facbook to JAAS login proces with right username and fake password - the login fail. I've my own portal container configuration, so probably there is some omited configuration details in my config files. What's wrong or how JAAS authenticate user with fake password?
It's solved now. I have added this configuration snippet: