-1

I find the example online, they usually use curl or the link such like http://localhost:8080/demo4ssh-security-oauth2/oauth/token?client_id=mobile_1&client_secret=secret_1&grant_type=password&username=wangwu&password=234567 to test the oauth.
it wil get the access token.
And then use http://localhost:8080/demo4ssh-security-oauth2/json?access_token=5aa5e5f9-43eb-49e3-8149-69406884cbd9 to get the resource
But how can I do this two actions in my spring mvc code??
I have no concept where to start?
I see the spring security oauth2 example (sparklr and tonr).
But I still can't figure out where it write this actions in tonr.
Please give me an simple example or explain how to do this, thank you

user2492364
  • 6,543
  • 22
  • 77
  • 147

1 Answers1

2

It's already provided by Spring. Check out SpringOauth2RestTemplate and EnableOAuth2Client annotations.

It's suggested that you first have some idea about the OAuth2 dance to have better understanding. Suggested blog.

Related SOF question that illustrate how to configure and user Oauth2 protected resource.

Community
  • 1
  • 1
Kumar Sambhav
  • 7,503
  • 15
  • 63
  • 86