ENGLISH

OAuth 2.0 Cookbook: Protect your web applications using Spring Security

Book information

Publisher
Packt Publishing
Year
2017
ISBN
178829596X, 9781788295963
Language
english
Format
PDF
Filesize
5 MB (5218973 bytes)
Pages
420\572
Time added
2022-07-26 09:04:31

Description

Key FeaturesInteract 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 providerLearn how to implement OAuth 2.0 native mobile clients for Android applicationsBook Description 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. What you will learnUse Redis and relational databases to store issued access tokens and refresh tokensAccess resources protected by the OAuth2 Provider using Spring SecurityImplement a web application that dynamically registers itself to the Authorization ServerImprove the safety of your mobile client using dynamic client registrationProtect your Android client with Proof Key for Code ExchangeProtect the Authorization Server from invalid redirectionAbout the Author Adolfo Eloy Nascimento is a software engineer at Elo7, he has a Bachelors degree in Computer Science, and has been working with software development since 1999. In around 2003, he started working with web development implementing applications using ASP, PHP4/5, JavaScript, and Java (sometimes he still does some maintenance for a Ruby on Rails application). He started using OAuth 2.0 two years ago, when designing applications using microservice architectures, as well as modeling and interacting with public APIs. As a tech enthusiast, Adolfo also likes to read and learn about programming languages and new technologies. He also believes that besides creating new applications, it is also important to share the knowledge he has acquired, which is what he does by writing for his personal blog, writing articles for Java Magazine in Brazil, and also writing tech books. Table of ContentsOAuth 2.0 foundationsImplementing Your Own OAuth 2.0 ProviderUsing an API protected with OAuth 2.0Working with OAuth 2.0 profilesSelf contained tokens with JWTOpenID Connect for authenticationImplementing Mobile ClientsAvoiding common vulnerabilities Preface What this book covers What you need for this book Who this book is for Sections Getting ready How to do it… How it works… There's more… See also Conventions Reader feedback Customer support Downloading the example code Downloading the color images of this book Errata Piracy Questions OAuth 2.0 Foundations Introduction Preparing the environment Getting ready How to do it... See also How it works... There's more... See also Reading the user's contacts from Facebook on the client side Getting ready How to do it... How it works... There's more... See also Reading the user's contacts from Facebook on the server side Getting ready How to do it... How it works... There's more... See also Accessing OAuth 2.0 LinkedIn protected resources Getting ready How to do it... How it works... There's more... See also Accessing OAuth 2.0 Google protected resources bound to the user's session Getting ready How to do it... How it works... There's more... See also Implementing Your Own OAuth 2.0 Provider Introduction Protecting resources using the Authorization Code grant type Getting ready How to do it... How it works... There's more... Supporting the Implicit grant type Getting ready How to do it... How it works... There's more... See also Using the Resource Owner Password Credentials grant type as an approach for OAuth 2.0 migration Getting ready How to do it... How it works... There's more... See also Configuring the Client Credentials grant type Getting ready How to do it... How it works... There's more... See also Adding support for refresh tokens Getting ready How to do it... How it works... There's more... See also Using a relational database to store tokens and client details Getting ready How to do it... How it works... There's more... See also Using Redis as a token store Getting ready How to do it... How it works... See also Implementing client registration Getting ready How to do it... How it works... See also Breaking the OAuth 2.0 Provider in the middle Getting ready How to do it... How it works... See also Using Gatling to load test the token validation process using shared databases Getting ready How to do it... How it works... See also Using OAuth 2.0 Protected APIs Introduction Creating an OAuth 2.0 client using the Authorization Code grant type Getting ready How to do it... How it works... Creating an OAuth 2.0 client using the Implicit grant type Getting ready How to do it... How it works... There's more... See also Creating an OAuth 2.0 client using the Resource Owner Password Credentials grant type Getting ready How to do it... How it works... There's more... See also Creating an OAuth 2.0 client using the Client Credentials grant type Getting ready How to do it... How it works... See also Managing refresh tokens on the client side Getting ready How to do it... How it works... See also Accessing an OAuth 2.0 protected API with RestTemplate Getting ready How to do it... How it works... See also OAuth 2.0 Profiles Introduction Revoking issued tokens Getting ready How to do it... How it works... Remote validation using token introspection Getting ready How to do it... How it works... There's more... Improving performance using cache for remote validation Getting ready How to do it... How it works... See also Using Gatling to load test remote token validation Getting ready How to do it... There's more... See also Dynamic client registration Getting ready How to do it... How it works... There's more... See also Self Contained Tokens with JWT Introduction Generating access tokens as JWT Getting ready How to do it... How it works... See also Validating JWT tokens at the Resource Server side Getting ready How to do it... How it works... There's more... See also Adding custom claims on JWT Getting ready How to do it... How it works... See also Asymmetric signing of a JWT token Getting ready How to do it... How it works... See also Validating asymmetric signed JWT token Getting ready How to do it... How it works... See also Using JWE to cryptographically protect JWT tokens Getting ready How to do it... How it works... See also Using JWE at the Resource Server side Getting ready How to do it... How it works... See also Using proof-of-possession key semantics on OAuth 2.0 Provider Getting ready How to do it... How it works... There's more... See also Using proof-of-possession key on the client side Getting ready How to do it... How it works... See also OpenID Connect for Authentication Introduction Authenticating Google's users through Google OpenID Connect Getting ready How to do it... How it works... See also Obtaining user information from Identity Provider Getting ready How to do it... How it works... There's more... See also Using Facebook to authenticate users Getting ready How to do it... How it works... See also Using Google OpenID Connect with Spring Security 5 Getting ready How to do it... How it works... See also Using Microsoft and Google OpenID providers together with Spring Security 5 Getting ready How to do it... How it works... See also Implementing Mobile Clients Introduction Preparing an Android development environment Getting ready How to do it... How it works... Creating an Android OAuth 2.0 client using an Authorization Code with the system browser Getting ready How to do it... How it works... There's more... See also Creating an Android OAuth 2.0 client using the Implicit grant type with the system browser Getting ready How to do it... How it works... See also Creating an Android OAuth 2.0 client using the embedded browser Getting ready How to do it... How it works... See also Using the Password grant type for client apps provided by the OAuth 2 server Getting ready How to do it... How it works... There's more... See also Protecting an Android client with PKCE Getting ready How to do it... How it works... See also Using dynamic client registration with mobile applications Getting ready How to do it... How it works... See also Avoiding Common Vulnerabilities Introduction Validating the Resource Server audience Getting ready How to do it... How it works... Protecting Resource Server with scope validation Getting ready How to do it... How it works... Binding scopes with user roles to protect user's resources Getting ready How to do it... How it works... See also Protecting the client against Authorization Code injection Getting ready How to do it... How it works... Protecting the Authorization Server from invalid redirection Getting ready How to do it... How it works...

Similar books

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

2010 · PDF

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

1858 · PDF

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

2022 · PDF

The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians

The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians

1809 · PDF

Professional Linux kernel architecture ''Wrox programmer to programmer''--Cover. - ''What you are reading right now is the result of an evolution over more than seven years: After two years of writing, the first edition was published in German by Carl Hanser Verlag in 2003. It then described kernel 2.6.0. The test was used as a basis for the low-level design documentation for the EAL4+ security evaluation of Red Hat Enterprise Linux 5, requiring to update it to kernel 2.6.18 (if the EAL acronym does not mean anything to you, then Wikipedia is once more your friend). Hewlett-Packard sponsored the translation into English and has, thankfully, granted the rights to publish the result. Updates to kernel 2.6.24 were then performed specifically for this book''--P. ix

Professional Linux kernel architecture ''Wrox programmer to programmer''--Cover. - ''What you are reading right now is the result of an evolution over more than seven years: After two years of writing, the first edition was published in German by Carl Hanser Verlag in 2003. It then described kernel 2.6.0. The test was used as a basis for the low-level design documentation for the EAL4+ security evaluation of Red Hat Enterprise Linux 5, requiring to update it to kernel 2.6.18 (if the EAL acronym does not mean anything to you, then Wikipedia is once more your friend). Hewlett-Packard sponsored the translation into English and has, thankfully, granted the rights to publish the result. Updates to kernel 2.6.24 were then performed specifically for this book''--P. ix

2008 · PDF