Spring social:Provider Signin Controller

时间:2014-03-12 14:41:20

标签: spring spring-mvc spring-social

我对Spring Social有疑问。 ProviderSigninController的文档说:

通过OAuth 2提供程序进行身份验证时,ProviderSignInController支持以下流程:

**1 -** POST /signin/{providerId} - Initiates the sign in flow by redirecting to 
        the provider's authentication endpoint.

**2 -** GET /signin/{providerId}?code={verifier} - Receives the authentication 
        callback from the provider, accepting a code. Exchanges this code for an 
        access token. Using this access token, it retrieves the user's provider 
        user ID and uses that to lookup a connected account and then 
        authenticates to the application through the sign in service.

    **2-a** If the provider user ID doesn't match any existing connection, 
        ProviderSignInController will redirect to a sign up URL. The default sign
        up URL is "/signup" (relative to the application root), but can be
        customized by setting the signUpUrl property.

    **2-b** If the provider user ID matches more than one existing connection, 
        ProviderSignInController will redirect to the application's sign 
        in URL to offer the user a chance to sign in through another provider 
        or with their username and password. The request to the sign in URL will 
        have an "error" query parameter set to "multiple_users" to indicate 
        the problem so that the page can communicate it to the user. The default
        sign in URL is "/signin" (relative to the application root), 
        but can be customized by setting the signInUrl property.

    **2-c** If any error occurs while fetching the access token or while fetching
        the user's profile data, ProviderSignInController will redirect to the 
        application's sign in URL. The request to the sign in URL will have an 
        "error" query parameter set to "provider" to indicate an error occurred 
        while communicating with the provider. The default sign in URL is 
        "/signin" (relative to the application root), but can be customized by 
        setting the signInUrl property.

这意味着我必须映射/登录到视图?

参考:http://docs.spring.io/spring-social/docs/1.1.0.M4/reference/html/signin.html

更新:我修改了我的配置。所以我在配置注册网址和signinurl中指定。现在我面临一个我不明白的错误问题。 我的oAuth舞会来到第2-c步,但我重定向到signinurl,错误=提供者。关于提供商,这是一个错误。当我查阅日志时,我有以下消息:

[org.springframework.social.connect.web.ProviderSignInController] [] http-bio-8080-exec-10 Exception while handling OAuth2 callback (No Session found for current thread). Redirecting to /login

哪个会话是关于什么的?我不明白。 这是完整的日志文件http://pastebin.com/wzL4ZQFk

1 个答案:

答案 0 :(得分:0)

不,当发布到/ signin / {providerId}时,您将被重定向到facebook,twitter,google或' providerId'中指定的提供商的身份验证屏幕。