org.brickred.socialauth.spring.controller
Class SocialAuthWebController
java.lang.Object
org.brickred.socialauth.spring.controller.SocialAuthWebController
@Controller
@RequestMapping(value="/socialauth")
public class SocialAuthWebController
- extends Object
Generic controller for managing socialauth-provider connection flow. This is
called when the user hits a URL of the following form
/socialauth{pattern}?id={providerId}
where pattern depends on your configuration, for example .do and the
providerId may be one of facebook,foursquare, google,
hotmail,linkedin,myspace, openid, twitter, yahoo
The connect method is called when the user hits the above URL and it
redirects to the actual provider for login. Once the user provides
credentials and the provider redirects back to your application, one of the
callback methods is called
|
Method Summary |
String |
connect(String providerId,
javax.servlet.http.HttpServletRequest request)
Initiates the connection with required provider.It redirects the browser
to an appropriate URL which will be used for authentication with the
requested provider. |
String |
hotmailCallback(javax.servlet.http.HttpServletRequest request)
|
String |
oauth2Callback(javax.servlet.http.HttpServletRequest request)
|
String |
oauthCallback(javax.servlet.http.HttpServletRequest request)
|
String |
openidCallback(javax.servlet.http.HttpServletRequest request)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SocialAuthWebController
@Inject
public SocialAuthWebController(String applicationUrl,
String successPageURL,
Properties socialAuthProperties)
- Constructs a SocialAuthWebController.
- Parameters:
applicationUrl - the base URL for this application (with context e.g
http://opensource.brickred.com/socialauthdemo, used to
construct the callback URL passed to the providerssuccessPageURL - the URL of success page or controller, where you want to
access sign in user details like profile, contacts etc.socialAuthProperties - properties containing key/secret for different providers and
information of custom provider. e.g
www.google.com.consumer_key = opensource.brickred.com
and for custom provider key/value pair will be
socialauth.myprovider =
org.brickred.socialauth.provider.MyProviderImpl
where myprovider will be {providerId} and value will be the
fully class name.
connect
@RequestMapping(params="id")
public String connect(@RequestParam(value="id")
String providerId,
javax.servlet.http.HttpServletRequest request)
throws Exception
- Initiates the connection with required provider.It redirects the browser
to an appropriate URL which will be used for authentication with the
requested provider.
- Throws:
Exception
oauthCallback
@RequestMapping(params="oauth_token")
public String oauthCallback(javax.servlet.http.HttpServletRequest request)
oauth2Callback
@RequestMapping(params="code")
public String oauth2Callback(javax.servlet.http.HttpServletRequest request)
hotmailCallback
@RequestMapping(params="wrap_verification_code")
public String hotmailCallback(javax.servlet.http.HttpServletRequest request)
openidCallback
@RequestMapping(params="openid.claimed_id")
public String openidCallback(javax.servlet.http.HttpServletRequest request)
Copyright © 2011. All Rights Reserved.