Giter VIP home page Giter VIP logo

spring-security-oauth2-resource-server's Introduction

Spring Security OAuth2 Resource Server

Here is a pretty rough draft for what could be Spring 5.1's Resource Server. To run, you can do one of a few things:

Run the Application

For the moment, running is a two step process:

  1. Build the project
$ ./gradlew build
  1. Run the sample:
$ ./gradlew :spring-security-oauth2-resource-server-auth0:bootRun

Which will stand up the same messaging service as before, now with JWT-based token security on the endpoints.

Calls like this should work:

curl -H \
  "Authorization: Bearer eyJraWQiOiIxMjMiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzY29wZSI6Im1lc3NhZ2UucmVhZCIsImlzcyI6InJvYiIsImV4cCI6MjE0NzQwNzIwMCwiaWF0IjoxNTE2MjU1MjAwfQ.XJ8d6fQpo53eH_8nduS7rZOB9szHkVTYkZgzfpF3s6dq0DH-ovgFWBE1evfIXHTQwpAil1X856lp_mvJH0pWVXjM2jM5g_qMGen25210-9R9A94ShiM3iSeMAozHl2L6nmdifJR9Na0fWPo4rogB6_N0GoBG2haaB9yU2r925hw" \
  localhost:8080/messages/1
curl -H "Content-Type: application/json" \
  -H "Authorization: Bearer eyJraWQiOiIxMjMiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzY29wZSI6Im1lc3NhZ2Uud3JpdGUiLCJpc3MiOiJyb2IiLCJleHAiOjIxNDc0MDcyMDAsImlhdCI6MTUxNjI1NTIwMH0.gehhZAkelPIijBDq0Ds-Pf69h958CzGClyRAYExI-xoXgjAGYllP3E-m6Zjces0tSRDKmSOUZlYW7Kb3zjI85G3xLwVRbKa0VJQyMUPy3ZenhAfPKg6DIAhTms8Qyw3vMS9IlrNMZpLf64sFJFWZXOnTrYblvo3dPwB7J8jy2hg" \
  localhost:8080/messages \
  -d '{ "text" : "Ora Viva!" }'

You can take the JWTs from message-both, message-read, and message-write.

Or you can generate your own JWTs, which I did by pasting the contents of id_rsa_pkcs8.pub and id_rsa_pkcs8 in the respective slots on https://jwt.io on their RS256 screen.

id_rsa_pkcs8.pub and id_rsa_pkcs8 are simply the pkcs8 versions of the two provided keys, id_rsa.pub and id_rsa respectively. I am able to get either to work with the app, but jwt.io needed them in pkcs8 format for some reason.

Run the Tests

You can do:

./gradlew check

spring-security-oauth2-resource-server's People

Contributors

jzheaux avatar vpavic avatar jgrandja avatar

Watchers

James Cloos avatar

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.