Authenticating with a third-party OAuth2 scheme

This recipe uses the Spring social project in order to use the OAuth2 protocol from a client perspective.

Getting ready

We won't create an OAuth2 Authentication Server (AS) here. We will establish connections to third-party Authentication servers (Yahoo!) to authenticate on our application. Our application will be acting as a Service Provider (SP).

We will use Spring social whose first role is to manage social connections transparently and to provide a facade to invoke the provider APIs (Yahoo! Finance) using Java objects.

How to do it...

  1. Two Maven dependencies have been added for Spring social:
     <!– Spring Social Core –> <dependency> <groupId>org.springframework.social</groupId> <artifactId>spring-social-core</artifactId> ...

Get Spring MVC: Designing Real-World Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.