Coder Social home page Coder Social logo

auth0audience's Introduction

Springframework Security for OAuth2 with Auth0.com authorization service.

When using Auth0.com an application needs to pass in requested audience for authorization and client credential. In other words, when a user does login and the application calls an API the Auth0 developer platform requires an "audience" parameter in the request header that Spring Security OAuth2 doesn't include by default.

This example shows how to set the audience request parameter when using SpringFramework Security OAuth2 to do Authorization Code and Client Credentials flows.

The SecurityConfiguration class includes additional code to pass in the "audience" header when login. The WebClientConfiguration class includes code to pass the header when making a call to an API with WebClient.

A simple MovieApi class gives a list of movies for the Front End to display for a given user. The user ID is retrieved from the sub of JWT token so that a user ID does not have to be passed to the API call.

Auth0.com has proprietary libraries that their tutorials cover but this is not helpful for getting experience with SpringFramework Security and OAuth0 security providers.

It's probably more common to stand up a KeyCloak authorization server in Docker and experiment against that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.