【问题标题】:Progmatically configuring Spring Security OAUTH以编程方式配置 Spring Security OAUTH
【发布时间】:2015-02-04 20:57:30
【问题描述】:

为了保持一致性,更喜欢以编程方式配置 spring security oauth。该文档涵盖了 xml,但似乎没有提及程序配置。

xml(从示例项目中提取)配置的 Java 等效项是什么?

<oauth:consumer resource-details-service-ref="resourceDetails" oauth-failure-page="/oauth_error.jsp">
    <oauth:url pattern="/google/**" resources="google"/>
    <oauth:url pattern="/login/**" resources="none"/>
  </oauth:consumer>

  <oauth:resource-details-service id="resourceDetails">
    <oauth:resource id="google" key="anonymous" secret="anonymous"
                    request-token-url="https://www.google.com/accounts/OAuthGetRequestToken"
                    user-authorization-url="https://www.google.com/accounts/OAuthAuthorizeToken"
                    access-token-url="https://www.google.com/accounts/OAuthGetAccessToken"
                    request-token-method="GET"
                    access-token-method="GET">
      <oauth:addtionalParameter name="scope" value="https://picasaweb.google.com/data/"/>
      <oauth:addtionalParameter name="xoauth_displayname" value="Tonr Example Application"/>
    </oauth:resource>
  </oauth:resource-details-service>

【问题讨论】:

    标签: spring spring-mvc oauth spring-security spring-security-oauth2


    【解决方案1】:

    没有用于配置 OAuth1.0a 的 Java DSL。您可以手动创建 bean 定义,或使用 XML。请注意,对于 Google API,您可以使用 OAuth2(它确实具有 Java DSL)。如果有人对贡献 Java DSL 感兴趣,那么已经有一个对 OAuth1.0a 部分进行大重构的拉取请求,所以从那里开始可能会很好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-21
      • 2012-06-04
      • 1970-01-01
      • 2011-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多