Git Product home page Git Product logo

spring-security-oauth-issues-1024's Introduction

Issue #1024

I am trying to secure oauth authentication and resource using spring-security

I have ResourceServerConfigurerAdapter class annotated with @Order(99) but the filter chain seems to be ignored.

These are my rules :

An anonymous user should be able to access only these endpoints

An authenticated user with ROLE_USER should be able to access only these endpoints

An authenticated user using a jwt can access these endpoints

Reproduction

  1. Clone the project

     git clone https://github.com/kopax/spring-security-oauth-issues-1024 && cd spring-security-oauth-issues-1024
    
  2. start the server

     ./gradlew build --info && java -jar build/libs/api-oauth2.jar --spring.profiles.active=default
    
  3. get a cookie

     export COOKIE=$(curl -v --silent http://localhost:8081/ 2>&1 | grep cookie -i | awk -F ' ' '{print $3}')
    
  4. authenticate the cookie

     export COOKIE=$(curl --cookie "$COOKIE" -d username=admin -d password=verysecret -v --silent http://localhost:8081/login 2>&1 | grep cookie -i | awk -F ' ' '{print $3}')
    
  5. try to get a secured oauth resource at /

     curl --cookie "$COOKIE" -v http://localhost:8081/
    

Expected

http status code 401 due to missing header Authorization

Result

http status code 200

Useful information:

Spring server:

Security account (cookie):

  • username: admin
  • password: verysecret

OAuth account (jwt):

  • client_id: myfirstapp
  • client_secret: test
  • redirect_uri: http://localhost:8081/
  • access_token_uri: http://localhost:8081/oauth/token
  • authorization_uri: http://localhost:8081/oauth/authorize
  • authorization_grant: code
  • redirect_uri: http://localhost:8081/cb/myfirstapp

spring-security-oauth-issues-1024's People

Watchers

 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.