org.springframework.social.facebook.web
Class CanvasSignInController

java.lang.Object
  extended by org.springframework.social.facebook.web.CanvasSignInController

@Controller
@RequestMapping(value="/canvas")
public class CanvasSignInController
extends Object

Sign in controller that uses the signed_request parameter that Facebook gives to Canvas applications to obtain an access token. If no access token exists in signed_request, this controller will redirect the top-level browser window to Facebook's authorization dialog. When Facebook redirects back from the authorization dialog, the signed_request parameter should contain an access token.


Constructor Summary
CanvasSignInController(org.springframework.social.connect.ConnectionFactoryLocator connectionFactoryLocator, org.springframework.social.connect.UsersConnectionRepository usersConnectionRepository, org.springframework.social.connect.web.SignInAdapter signInAdapter, String clientId, String clientSecret, String canvasPage)
           
 
Method Summary
 View error(String error, String errorDescription)
           
protected  View postDeclineView()
          View that redirects the top level window to the URL defined in postDeclineUrl property after user declines to authorize application.
 void setPostDeclineUrl(String postDeclineUrl)
          The URL or path to redirect to if a user declines authorization.
 void setPostSignInUrl(String postSignInUrl)
          The URL or path to redirect to after successful canvas authorization.
 void setScope(String scope)
          The scope to request during authorization.
 View signin(Model model, NativeWebRequest request)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CanvasSignInController

@Inject
public CanvasSignInController(org.springframework.social.connect.ConnectionFactoryLocator connectionFactoryLocator,
                                     org.springframework.social.connect.UsersConnectionRepository usersConnectionRepository,
                                     org.springframework.social.connect.web.SignInAdapter signInAdapter,
                                     String clientId,
                                     String clientSecret,
                                     String canvasPage)
Method Detail

setPostSignInUrl

public void setPostSignInUrl(String postSignInUrl)
The URL or path to redirect to after successful canvas authorization. Defaults to "/".


setPostDeclineUrl

public void setPostDeclineUrl(String postDeclineUrl)
The URL or path to redirect to if a user declines authorization. The redirect will happen in the top-level window. If you want the redirect to happen in the canvas iframe, then override the postDeclineView() method to return a different implementation of View. Defaults to "http://www.facebook.com".


setScope

public void setScope(String scope)
The scope to request during authorization. Defaults to null (no scope will be requested; Facebook will offer their default scope).


signin

@RequestMapping(method={POST,GET},
                params={"signed_request","!error"})
public View signin(Model model,
                                                     NativeWebRequest request)
            throws SignedRequestException
Throws:
SignedRequestException

error

@RequestMapping(method={POST,GET},
                params="error")
public View error(@RequestParam(value="error")
                                                    String error,
                                                    @RequestParam(value="error_description")
                                                    String errorDescription)

postDeclineView

protected View postDeclineView()
View that redirects the top level window to the URL defined in postDeclineUrl property after user declines to authorize application. May be overridden for custom views, particularly in the case where the post-decline view should be rendered in-canvas.