【问题标题】:How to write oauth client in spring?spring如何编写oauth客户端?
【发布时间】:2015-07-25 12:42:16
【问题描述】:

我在网上找到了例子,他们通常使用curlhttp://localhost:8080/demo4ssh-security-oauth2/oauth/token?client_id=mobile_1&client_secret=secret_1&grant_type=password&username=wangwu&password=234567之类的链接来测试oauth。
它会得到access token
然后使用http://localhost:8080/demo4ssh-security-oauth2/json?access_token=5aa5e5f9-43eb-49e3-8149-69406884cbd9获取资源
但是如何在我的 spring mvc 代码中执行这两个操作呢?
我不知道从哪里开始?
我看到了 spring security oauth2 示例(sparklrtonr)。
但我仍然无法弄清楚它在tonr 中写此操作的位置。
请给我一个简单的例子或解释一下如何做到这一点,谢谢

【问题讨论】:

    标签: spring-mvc oauth


    【解决方案1】:

    它已经由 Spring 提供。查看SpringOauth2RestTemplateEnableOAuth2Client 注释。

    建议您先对 OAuth2 舞蹈有一些了解,以便更好地理解。建议blog

    Related SOF question 说明如何配置和使用 Oauth2 保护资源。

    【讨论】:

      猜你喜欢
      • 2018-11-15
      • 2020-04-13
      • 2015-06-15
      • 2012-06-01
      • 2015-10-23
      • 1970-01-01
      • 1970-01-01
      • 2020-08-04
      • 1970-01-01
      相关资源
      最近更新 更多