2016-10-21 10 views
0

私は、スプリングソーシャルワークがどのくらい正確に機能するかを理解しようとしており、サンプルアプリケーションをコーディングすることでそれを学ぶことにしました。スプリングセキュリティ+スプリングソーシャルXML設定

アプリのコアは、基本的なスプリングセキュリティが既に設定されているappfuse quicksart archetype(マルチモジュール、Spring MVC)に基づいています。

私は、Spring SocialとSpring Securityの統合について説明しているthis tutorialを使用しています。しかし、この例では、Spring SocialのためのJavaベースの設定を使用しています。私が知る限り、公式のドキュメントはほとんどがJavaベースです。これは、XML構成は前述のチュートリアルからSocialContextと同様である必要があり、このSO questionに基づいています

<!-- Ensures that configuration properties are read from a property file --> 
    <context:property-placeholder location="classpath:*social.properties"/> 

    <!-- 
     Configures FB support. 
    --> 
    <facebook:config app-id="${facebook.app.id}" app-secret="${facebook.app.secret}" /> 

    <social:jdbc-connection-repository data-source-ref="dataSource" connection-signup-ref="accountConnectionSignup"/> 


    <bean id="userIdSource" class="org.springframework.social.security.AuthenticationNameUserIdSource" /> 

    <!-- 
     This bean is custom account connection signup bean for your registeration logic. 
     --> 
    <bean id="accountConnectionSignup" class="com.yoso.socialApp.service.impl.ConnectionSignupManagerImpl"></bean> 

    <!-- 
     This bean manages the connection flow between the account provider and 
     the example application. 
    --> 
    <bean id="connectController" class="org.springframework.social.connect.web.ConnectController" autowire="constructor"> 
     <constructor-arg index="0" ref="connectionFactoryLocator"/> 
     <constructor-arg index="1" ref="connectionRepository"/> 
    </bean> 

    <bean id="textEncryptor" class="org.springframework.security.crypto.encrypt.Encryptors" 
    factory-method="noOpText" /> 
</beans> 

私social.xmlです。

のsecurity.xmlファイルが変更されていない、私はhtmlタグにのみ、このライン

<intercept-url pattern="/auth" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER" /> 

を追加しました。

また、ログインページには、/auth/facebookにリダイレクトされ、social.xmlweb.xmlへの参照が追加されています。さて、問題は、fbボタンをクリックするたびに何も起こらないということです。ページはちょうどリフレッシュされます。サーバーコンソールにもエラーもメッセージもありません。

また、/auth*のコントローラを作成する必要があるかどうかはわかりません。documentationによれば、SocialAuthenticationFilterはそれを行う必要があります。

答えて

0

明らかに、それは実際にはいつも働いていました。私は非匿名のウィンドウでブラウザでテストしていましたが、同時にFBにログオンしました。だから、アプリはちょうど私がログインページにリダイレクトされた(これは、私がサインアップページに私をリダイレクトするはずだったので、これは少し構成の誤りだった)。

レッスンを受けました。