mirror of
https://github.com/keycloak/keycloak.git
synced 2025-12-16 20:15:46 -06:00
PAR endpoind does not return an appropriate error regarding a request objec
closes #41181 Signed-off-by: Takashi Norimatsu <takashi.norimatsu.ws@hitachi.com>
This commit is contained in:
committed by
Marek Posolda
parent
ae553b10f6
commit
71f510d115
@@ -27,6 +27,7 @@ import org.keycloak.events.EventType;
|
||||
import org.keycloak.headers.SecurityHeadersProvider;
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.models.SingleUseObjectProvider;
|
||||
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
||||
import org.keycloak.protocol.oidc.OIDCLoginProtocolService;
|
||||
import org.keycloak.protocol.oidc.endpoints.AuthorizationEndpointChecker;
|
||||
import org.keycloak.protocol.oidc.endpoints.request.AuthorizationEndpointRequest;
|
||||
@@ -108,6 +109,9 @@ public class ParEndpoint extends AbstractParEndpoint {
|
||||
try {
|
||||
authorizationRequest = ParEndpointRequestParserProcessor.parseRequest(event, session, client, decodedFormParameters);
|
||||
} catch (Exception e) {
|
||||
if (!decodedFormParameters.containsKey(OIDCLoginProtocol.REQUEST_PARAM)) {
|
||||
throw throwErrorResponseException(OAuthErrorException.INVALID_REQUEST, e.getMessage(), Response.Status.BAD_REQUEST);
|
||||
}
|
||||
throw throwErrorResponseException(OAuthErrorException.INVALID_REQUEST_OBJECT, e.getMessage(), Response.Status.BAD_REQUEST);
|
||||
}
|
||||
|
||||
|
||||
@@ -444,7 +444,7 @@ public class FAPI2DPoPTest extends AbstractFAPI2Test {
|
||||
.signedJwt(signedJwt)
|
||||
.send();
|
||||
assertEquals(400, pResp.getStatusCode());
|
||||
assertEquals(OAuthErrorException.INVALID_REQUEST_OBJECT, pResp.getError());
|
||||
assertEquals(OAuthErrorException.INVALID_REQUEST, pResp.getError());
|
||||
|
||||
// Set request object and correct responseType
|
||||
requestObject = createValidRequestObjectForSecureRequestObjectExecutor(clientId);
|
||||
|
||||
@@ -335,7 +335,7 @@ public class FAPI2Test extends AbstractFAPITest {
|
||||
String signedJwt = createSignedRequestToken(clientId, Algorithm.PS256);
|
||||
ParResponse pResp = oauth.pushedAuthorizationRequest().nonce("123456").signedJwt(signedJwt).send();
|
||||
assertEquals(400, pResp.getStatusCode());
|
||||
assertEquals(OAuthErrorException.INVALID_REQUEST_OBJECT, pResp.getError());
|
||||
assertEquals(OAuthErrorException.INVALID_REQUEST, pResp.getError());
|
||||
|
||||
// Set request object and correct responseType
|
||||
requestObject = createValidRequestObjectForSecureRequestObjectExecutor(clientId);
|
||||
|
||||
@@ -1010,7 +1010,7 @@ public class ParTest extends AbstractClientPoliciesTest {
|
||||
oauth.redirectUri(CLIENT_REDIRECT_URI);
|
||||
ParResponse pResp = oauth.doPushedAuthorizationRequest();
|
||||
assertEquals(400, pResp.getStatusCode());
|
||||
assertEquals(OAuthErrorException.INVALID_REQUEST_OBJECT, pResp.getError());
|
||||
assertEquals(OAuthErrorException.INVALID_REQUEST, pResp.getError());
|
||||
}
|
||||
|
||||
// PAR including invalid redirect_uri
|
||||
|
||||
Reference in New Issue
Block a user