royclarkson / spring-rest-service-oauth

A simple OAuth protected REST service built with Spring Boot and Spring Security OAuth
Apache License 2.0
664 stars 339 forks source link

Project is broken on Spring Boot 1.5.4.RELEASE #54

Open letientai299 opened 7 years ago

letientai299 commented 7 years ago

I've tested this project with the latest Spring Boot version, and found that this is not work as expected.

1:26:09 › curl http://localhost:8080 -v
* Rebuilt URL to: http://localhost:8080/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 302
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Set-Cookie: JSESSIONID=6A692E4F63DF7520058169BEEC44E0D2; Path=/; HttpOnly
< Location: http://localhost:8080/login           <------------- This!!!
< Content-Length: 0
< Date: Thu, 22 Jun 2017 17:26:11 GMT
<
* Curl_http_done: called premature == 0
* Connection #0 to host localhost left intact

We got redirection to /login instead of the unauthorized error.

Steps to reproduce.

  1. Replace Spring Boot version in build.gradle.
    
    buildscript {
    repositories {
        mavenCentral()
        maven { url "https://repo.spring.io/plugins-release" }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.4.RELEASE")
    }
    }

// keep the rest


2. Remove `WebInitializer.java`, since this cause some issue with latest Boot version.

```bash
 rm src/main/java/hello/WebInitializer.java
  1. Run bootRun and send GET request using above curl command.
abreu-dev commented 6 years ago

@letientai299 how did you fixed this issue?

letientai299 commented 6 years ago

@andreabreu-me, Honestly, I forgot how did it went through. Right now I'm using spring boot 1.5.9.RELEASE, and I built my auth-service myself, using this project as reference only.