Securing a REST API with OAuth 2.0

Beginner
27 Lessons
5h 13m

In this course, you'll learn how to secure a Spring Boot REST API with Spring Security and OAuth 2.0. From leveraging Spring Security defaults, JWT-based authentication and authorization, to using Authorization Servers, you'll learn the best practices for securing your APIs, and implement these best practices in our hands-on labs.

Share:
What you'll learn

Spring Security has your back

From security-first defaults to unlimited customization, Spring Security is the most powerful package for securing your Spring Boot API with OAuth 2.0. But how do you actually use Spring Security, and how do you know when not to configure anything at all and just let Spring Security do it for you?

In this course you'll learn:

  • The security risks of an unsecured Spring Boot API
  • How to leverage Spring Security's default settings
  • How to add OAuth 2.0 to your app
  • How to integration with an Authorization Server
  • And, of course, how to write automated tests for everything!

Before you begin

Course Prerequisites

This course is designed for developers who are new to Spring Security. We recommend having the following knowledge or experience before getting started:


Course Outline
  • Module 1: Secure Defaults
  • Module 2: Authentication
  • Module 3: Authorizaton

Course Outline

Introduction

Introduction

Learn what you will learn.

Article
5m
Lab: The Unsecured API
Locked

Lab: The Unsecured API

Learn how dangerous an unsecured REST API can be for your application.

Lab
5m
Secure Defaults
Locked

Secure Defaults

Learn how simply adding Spring Security to your project puts you on the path to a more secure application.

Article
10m
Lab: Spring Security's Defaults
Locked

Lab: Spring Security's Defaults

Secure our application with a couple of lines of configuration.

Lab
20m
Adding Authentication
Locked

Adding Authentication

Get started with Spring Security authentication.

Article
5m
Limits of HTTP Basic
Locked

Limits of HTTP Basic

This lesson covers the limits of HTTP Basic authentication, showing why it is not suitable for many production REST APIs.

Article
5m
OAuth 2.0 and JWT
Locked

OAuth 2.0 and JWT

You down with JWT? Yeah, you know me!

Article
10m
Lab: Adding OAuth 2.0 Bearer JWT Authentication
Locked

Lab: Adding OAuth 2.0 Bearer JWT Authentication

Implement JWTs in our Cash Card application.

Lab
5m
Accessing Authentication in Spring MVC
Locked

Accessing Authentication in Spring MVC

Implement secure and personalized features based on the user's authentication details in your Spring MVC application.

Article
10m
Lab: Accessing Authentication in Spring MVC
Locked

Lab: Accessing Authentication in Spring MVC

Learn the many ways you can access Spring Security authorization information in a Spring Boot app.

Lab
30m
The Big Picture
Locked

The Big Picture

The heart of Spring Security is still beatin': the Spring Security Filter Chain

Article
10m
Accessing Authentication Anywhere
Locked

Accessing Authentication Anywhere

Authentication everything everywhere all at once.

Article
10m
Accessing Authentication Anywhere
Locked

Accessing Authentication Anywhere

Understand and test how you can access the authentication context anywhere in your Spring Boot application.

Lab
20m
Validate Claims
Locked

Validate Claims

Learn more about customizing the authentication process, specifically regarding validating JWT claims.

Article
10m
Lab - Validate Claims
Locked

Lab - Validate Claims

Learn how to validate JWT claims programmatically as well as with Spring Boot properties.

Lab
25m
Processing Failures
Locked

Processing Failures

Learn how Spring Security handles authentication failures.

Article
10m
Lab - Processing Failures
Locked

Lab - Processing Failures

You'll update our Cash Card application to processes authentication failures, and create a custom authentication entry point.

Lab
20m
Authorization Models Overview - Request vs. Method
Locked

Authorization Models Overview - Request vs. Method

Learn the difference between request and method authorization, where they overlap, and when one outshines the other.

Article
10m
OAuth 2.0 Scopes
Locked

OAuth 2.0 Scopes

Learn how authorization is represented in OAuth 2.0 and how that maps to Spring Security.

Article
10m
Adding Request Authorization
Locked

Adding Request Authorization

Salt and pepper aren't the only things that can be coarse-grained!

Article
10m
Lab: Adding Request Authorization
Locked

Lab: Adding Request Authorization

Salt and pepper aren't the only things that can be coarse-grained!

Lab
10m
Adding Method Authorization
Locked

Adding Method Authorization

Learn how and where method authorization wins out over request authorization.

Article
10m
Lab: Adding Method Authorization
Locked

Lab: Adding Method Authorization

Salt and pepper aren't the only things that can be coarse-grained!

Lab
10m
Adding Data Authorization
Locked

Adding Data Authorization

Learn where and when data authorization works best over request and method authorization.

Article
10m
Lab: Adding Data Authorization
Locked

Lab: Adding Data Authorization

In this lab you'll SpEL out a query for data authorization!

Lab
10m
Adding Delegated Authorization
Locked

Adding Delegated Authorization

Learn where and when to delegate authorization to an authorization server.

Article
10m
Lab: Connecting to an Authorization Server
Locked

Lab: Connecting to an Authorization Server

Run and connect to a real authorization server right inside our hands-on lab environment!

Lab
10m