- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试将 Spring Social 引入到现有的 Spring Security 网络应用程序中。现有的网络应用程序使用 XML 配置,即:
<security:http
disable-url-rewriting="true"
use-expressions="true"
xmlns="http://www.springframework.org/schema/security">
...
<intercept-url
pattern="/w/configuration/**"
access="hasRole ('ROLE_ADMIN')"/>
...
<form-login
login-page="/w/welcome"
authentication-success-handler-ref="authSuccessHandler"
authentication-failure-handler-ref="authFailureHandler"/>
<logout logout-success-url="/w/welcome"/>
</security:http>
如何将 SpringSocialConfigurer() 添加到配置中? Spring Social 上的所有文档都使用我想避免的基于 Java 的配置,例如:
@Override
protected void configure(HttpSecurity http) throws Exception
{
http
.formLogin()
.loginPage("/signin")
.loginProcessingUrl("/signin/authenticate")
.failureUrl("/signin?param.error=bad_credentials")
.and()
.logout()
.logoutUrl("/signout")
.deleteCookies("JSESSIONID")
.and()
.apply(new SpringSocialConfigurer());
}
apply() 方法的 XML 等价物是什么?
最佳答案
在花一些时间查看 SpringSocialConfigurer 的代码后,这里是有些等效的 XML 配置的作用:
<security:http
disable-url-rewriting="true"
use-expressions="true"
xmlns="http://www.springframework.org/schema/security">
...
<intercept-url
pattern="/w/configuration/**"
access="hasRole ('ROLE_ADMIN')"/>
...
<form-login
login-page="/w/welcome"
authentication-success-handler-ref="authSuccessHandler"
authentication-failure-handler-ref="authFailureHandler"/>
<logout logout-success-url="/w/welcome"/>
<!-- Add a custom filter to handle Social media logins -->
<custom-filter before="PRE_AUTH_FILTER" ref="socialAuthFilter"/>
</security:http>
<security:authentication-manager
id="authenticationManager"
xmlns="http://www.springframework.org/schema/security">
<!-- Social Media sites as authentication provider -->
<authentication-provider ref="socialAuthProvider"/>
</security:authentication-manager>
<!--
Define the framework required for using Social Media sites
as Authentication Providers.
-->
<bean id="connectionFactoryLocator"
class="org.springframework.social.security.SocialAuthenticationServiceRegistry">
<property name="connectionFactories">
<list>
<bean class="org.springframework.social.facebook.connect.FacebookConnectionFactory">
<constructor-arg value="${social.facebook.appId}" />
<constructor-arg value="${social.facebook.appSecret}" />
</bean>
</list>
</property>
</bean>
<bean id="socialUsersConxRepo"
class="org.springframework.social.connect.mem.InMemoryUsersConnectionRepository">
<constructor-arg ref="connectionFactoryLocator"/>
</bean>
<bean id="socialUserIdSource"
class="org.springframework.social.security.AuthenticationNameUserIdSource"/>
<bean id="socialAuthFilter"
class="org.springframework.social.security.SocialAuthenticationFilter">
<constructor-arg ref="authenticationManager"/>
<constructor-arg ref="socialUserIdSource"/>
<constructor-arg ref="socialUsersConxRepo"/>
<constructor-arg ref="connectionFactoryLocator"/>
</bean>
<bean id="socialAuthProvider"
class="org.springframework.social.security.SocialAuthenticationProvider">
<constructor-arg ref="socialUsersConxRepo"/>
<!-- application defined @Service -->
<constructor-arg ref="socialGamerManager"/>
</bean>
应用程序程序员应该编写自己的“socialGamerManager”bean,该 bean 必须实现 org.springframework.social.security.SocialUserDetailsService
。 “socialUsersConxRepo”bean 可能会更改为使用 JDBC 实现。
关于java - 使用 XML 配置的 Spring Social 和 Spring Security,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29872674/
我们正在使用 spring-social 将我们的应用程序集成到 Facebook。 在 OAuth2AuthenticationService 中,范围为空。 我们将范围设置为表单上的输入。但它不起
Python(3.6.7) 和 Django(2.1),尝试集成social-auth-app-django。 与this post不同,我已声明SOCIAL_AUTH_URL_NAMESPACE,但
ConnectController 和 ProviderSignInController 都可以创建与 Service Provider 的连接,所以我想知道 ConnectController 和
当应用程序在模拟器上运行时,我有以下执行问题: dyld: Library not loaded: /System/Library/Frameworks/Social.framework/Social
我正在尝试使用 python-social-auth 添加电子邮件身份验证。 Documentation说: 表单提交应该转到/complete/email,或者如果它转到您的 View ,那么您的
我已经阅读了很多关于 SO 的问题,但没有找到答案,所以决定发布此内容。我删除了 Twitter.framework,因为它是红色的,而且我已经有了 Social.framwork,所以我收到了错误
我正在将一个项目从使用 django-social-auth 移植到 python-social-auth。我关注了instructions在文档中,但是当我尝试运行项目的测试 (./manage.p
我想创建一个使用 django admin 的应用程序,但允许通过 google(我公司的 google 帐户)代替 django 默认 ModelAdmin 登录。 目前,它看起来像social-a
在django社交注册中,通常会重定向到 /social/setup . 所以我写了一个指向那个 url 的 View 。但是,为什么有时它会重定向到 /accounts/profi
我是 Spring 框架的初学者,想尝试使用 Spring Social 来制作一个从 Facebook 检索数据的简单 Web 应用程序。为此,我遵循了 Spring Socials 官方“入门指南
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎与 help center 中定义的范围内的编程无关。 . 关闭 7 年前。 Improve
这个问题已经有答案了: java.net.MalformedURLException: unknown protocol: classpath (2 个回答) 已关闭 7 年前。 我是 Spring
我的网站需要 spring social,但我的专家在查找它时遇到问题。我添加了 spring social core 和 spring social Facebook 依赖项,但我在 eclipse
关闭。这个问题需要更多 focused .它目前不接受答案。 想改进这个问题?更新问题,使其仅关注一个问题 editing this post . 6年前关闭。 Improve this questi
我计划实现一个基本的推荐系统,该系统使用 Facebook Connect 或类似的社交网站 API 来连接用户的个人资料,根据标签进行分析并使用结果在我的电子商务网站上生成项目推荐(工作方式类似于亚
乔尔·斯波尔斯基今天一遍又一遍地重复说,了解一点人类学对程序员来说非常有用,因为正在创建的大部分内容都是社交软件。 已经了解计算机科学的人如何学习了解人类如何运作所需的人类学?有什么书吗?有录课吗?
我怎样才能让 Spring Social 使用 facebook 和 twitter 登录有一个记住我的功能,这类似于在 Spring Security 中使用基于表单的登录的记住我登录? 我正在使用
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve thi
我经营一个社交网络/博客网站 ( http://www.obsidianportal.com ),目前,用户在任何地方都通过其唯一(且不可更改)的用户名来识别。许多人都要求能够拥有一个他们可以选择的显
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我是一名优秀的程序员,十分优秀!