微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java – 在Spring Boot中配置0-legged OAuth 1.0

我想设置一个带有0-legged(因此没有请求或访问令牌)OAuth 1.0的spring boot应用程序.我一直在寻找一个例子,我一直在努力寻找如何使用新风格(没有xml)配置东西.

现在我只想得到一个简单的用例,其中只有1个路径(/ oauth)受OAuth保护(其他一切都只是大开),并且它使用自定义ConsumerDetailsS​​ervice(请参阅下面的代码的简单版本).

这是我的WebSecurityConfigurerAdapter(我的Application.java旁边的SecurityConfiguration.java,我认为这是在spring启动应用程序中配置这种东西的正确方法).我很确定我错过了提供程序配置(如:http://projects.spring.io/spring-security-oauth/docs/oauth1.html中所述),但我的试错法并没有产生结果.

@Configuration
@EnableWebMvcSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        // 0-Legged OAuth on the /oauth and /lti paths only
        http.requestMatchers().antMatchers("/oauth"); // .and().... what?
        // ??? something must be missing here - provider?
    }

}

我在maven pom.xml中也有这个:


                
                                

原文地址:https://www.jb51.cc/spring/431748.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐