-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)
Description
When trying to access any protected endpoint without including an access token in the header, the response code is 401 (which is expected), but there's no response body, unlike older OAuth2 resource server.
The older versions of OAuth2 using @EnableResourceServer
used to return 401 with the following body:
{
"error": "unauthorized",
"error_description": "Full authentication is required to access this resource"
}
Now it just returns an empty string.
This is easily testable when adding the following test to OAuth2ResourceServerApplicationITests.java
@Test
public void performWithoutTokenThenUnauthorized()
throws Exception {
this.mvc.perform(get("/"))
.andExpect(status().isUnauthorized())
.andExpect(content().string(containsString("")));
}
Using version 5.1.1.RELEASE like so:
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-resource-server</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>
sepanniemi and Grandolf49
Metadata
Metadata
Assignees
Labels
in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)