Book description
Efficiently integrate OAuth 2.0 to protect your mobile, desktop, Cloud applications and APIs using Spring Security technologies.
About This Book
- Interact with public OAuth 2.0 protected APIs such as Facebook, LinkedIn and Google.
- Use Spring Security and Spring Security OAuth2 to implement your own OAuth 2.0 provider
- Learn how to implement OAuth 2.0 native mobile clients for Android applications
Who This Book Is For
This book targets software engineers and security experts who are looking to develop their skills in API security and OAuth 2.0. Prior programming knowledge and a basic understanding of developing web applications are necessary. As this book's recipes mostly use Spring Security and Spring Security OAuth2, some prior experience with Spring Framework will be helpful.
What You Will Learn
- Use Redis and relational databases to store issued access tokens and refresh tokens
- Access resources protected by the OAuth2 Provider using Spring Security
- Implement a web application that dynamically registers itself to the Authorization Server
- Improve the safety of your mobile client using dynamic client registration
- Protect your Android client with Proof Key for Code Exchange
- Protect the Authorization Server from invalid redirection
In Detail
OAuth 2.0 is a standard protocol for authorization and focuses on client development simplicity while providing specific authorization flows for web applications, desktop applications, mobile phones, and so on. This book also provides useful recipes for solving real-life problems using Spring Security and creating Android applications.
The book starts by presenting you how to interact with some public OAuth 2.0 protected APIs such as Facebook, LinkedIn and Google. You will also be able to implement your own OAuth 2.0 provider with Spring Security OAuth2. Next, the book will cover practical scenarios regarding some important OAuth 2.0 profiles such as Dynamic Client Registration, Token Introspection and how to revoke issued access tokens. You will then be introduced to the usage of JWT, OpenID Connect, and how to safely implement native mobile OAuth 2.0 Clients.
By the end of this book, you will be able to ensure that both the server and client are protected against common vulnerabilities.
Style and approach
With the help of real-world examples, this book provides step by step recipes for troubleshooting and extending your API security. The book also helps you with accessing and securing data on mobile, desktop, and cloud apps with OAuth 2.0.
Table of contents
- Title Page
- Copyright
- Credits
- About the Author
- About the Reviewer
- www.PacktPub.com
- Customer Feedback
- Preface
- OAuth 2.0 Foundations
-
Implementing Your Own OAuth 2.0 Provider
- Introduction
- Protecting resources using the Authorization Code grant type
- Supporting the Implicit grant type
- Using the Resource Owner Password Credentials grant type as an approach for OAuth 2.0 migration
- Configuring the Client Credentials grant type
- Adding support for refresh tokens
- Using a relational database to store tokens and client details
- Using Redis as a token store
- Implementing client registration
- Breaking the OAuth 2.0 Provider in the middle
- Using Gatling to load test the token validation process using shared databases
-
Using OAuth 2.0 Protected APIs
- Introduction
- Creating an OAuth 2.0 client using the Authorization Code grant type
- Creating an OAuth 2.0 client using the Implicit grant type
- Creating an OAuth 2.0 client using the Resource Owner Password Credentials grant type
- Creating an OAuth 2.0 client using the Client Credentials grant type
- Managing refresh tokens on the client side
- Accessing an OAuth 2.0 protected API with RestTemplate
- OAuth 2.0 Profiles
-
Self Contained Tokens with JWT
- Introduction
- Generating access tokens as JWT
- Validating JWT tokens at the Resource Server side
- Adding custom claims on JWT
- Asymmetric signing of a JWT token
- Validating asymmetric signed JWT token
- Using JWE to cryptographically protect JWT tokens
- Using JWE at the Resource Server side
- Using proof-of-possession key semantics on OAuth 2.0 Provider
- Using proof-of-possession key on the client side
- OpenID Connect for Authentication
-
Implementing Mobile Clients
- Introduction
- Preparing an Android development environment
- Creating an Android OAuth 2.0 client using an Authorization Code with the system browser
- Creating an Android OAuth 2.0 client using the Implicit grant type with the system browser
- Creating an Android OAuth 2.0 client using the embedded browser
- Using the Password grant type for client apps provided by the OAuth 2 server
- Protecting an Android client with PKCE
- Using dynamic client registration with mobile applications
- Avoiding Common Vulnerabilities
Product information
- Title: OAuth 2.0 Cookbook
- Author(s):
- Release date: October 2017
- Publisher(s): Packt Publishing
- ISBN: 9781788295963
You might also like
book
Mastering OAuth 2.0
Create powerful applications to interact with popular service providers such as Facebook, Google, Twitter, and more …
book
OAuth 2 in Action
OAuth 2 in Action teaches you the practical use and deployment of this HTTP-based protocol from …
book
Getting Started with OAuth 2.0
Whether you develop web applications or mobile apps, the OAuth 2.0 protocol will save a lot …
book
RESTful Web API Patterns and Practices Cookbook
Many organizations today orchestrate and maintain apps that rely on other people's services. Software designers, developers, …