When dealing with the specifics of authentication techniques and protocols such as OAuth the devil often is in the detail. While the OAuth 2.0 protocol generally is easy to grasp and simple to use implementation details for specific authentication providers can easily have you hit a snag fairly quickly.
Documentation and examples sometimes are outdated or scattered across several – sometimes contradictory documents. Additionally, examples for the authentication provider you want to use might not have been written with your framework of choice.
A particularly interesting OAuth authentication provider is Atlassian Jira and Jira Cloud, specifically. These products not only can serve as user authentication (i.e. login) providers for your application but authenticating via Jira subsequently allows you to use the quite comprehensive Jira Cloud REST API and the resources it provides according to the scopes your application is authorized for.
With OAuth 2.0 support having been revamped and unified in Spring Security 5 I wanted to provide a simple Spring Boot example application for future reference that exemplifies how to authenticate with Jira and OAuth 2.0. For this task I drew upon a Spring Security 5 OAuth2 login tutorial by Baeldung and Atlassian’s own documentation for 3LO (three-legged OAuth) with Jira Cloud apps.
The result can be seen here: oauth2-with-jira
The project’s own documentation admittedly is rather sparse but I hope the simple, declarative code style speaks for itself. Nonetheless, if you have any questions, as usual please don’t hesitate to contact me.