-
1. Re: OAuth & FB - custom registration screen and username
mposolda Jul 8, 2013 6:27 AM (in response to tomashuryn)Hi,
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:
https://github.com/gatein/gatein-portal/blob/master/component/web/oauth-web/src/main/java/org/gatein/security/oauth/web/OAuthAuthenticationFilter.javaIf you want some even more custom behaviour, you can possibly override OAuthAuthenticationFilter and configure it in oauth-configuration.xml .
Marek
-
2. Re: OAuth & FB - custom registration screen and username
tomashuryn Jul 8, 2013 10:02 AM (in response to mposolda)Hi Marek,
thank you for reply, it looks like what I needed.
-
3. Re: OAuth & FB - custom registration screen and username
tomashuryn Jul 10, 2013 5:34 AM (in response to mposolda)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?
-
4. Re: OAuth & FB - custom registration screen and username
tomashuryn Jul 10, 2013 6:40 AM (in response to tomashuryn)It's solved now. I have added this configuration snippet:
<login-module code=
"org.gatein.security.oauth.jaas.OAuthLoginModule"
flag=
"required"
>
<module-option name=
"portalContainerName"
value=
"portal"
/>
<module-option name=
"realmName"
value=
"gatein-domain"
/>
</login-module>