mirror of
https://github.com/ysoftdevs/oauth-playground-server.git
synced 2026-01-18 01:27:43 +01:00
error handling split among:
1. user visible exception (directly shown to users as html) 2. redirect exception (pass back to redirect uri) 3. api exception (json)
This commit is contained in:
@@ -2,6 +2,7 @@ package com.ysoft.geecon;
|
||||
|
||||
import com.ysoft.geecon.dto.OAuthClient;
|
||||
import com.ysoft.geecon.dto.User;
|
||||
import com.ysoft.geecon.error.ErrorResponse;
|
||||
import com.ysoft.geecon.helpers.AuthorizationCodeFlow;
|
||||
import com.ysoft.geecon.helpers.ConsentScreen;
|
||||
import com.ysoft.geecon.helpers.LoginScreen;
|
||||
@@ -10,6 +11,7 @@ import com.ysoft.geecon.repo.UsersRepo;
|
||||
import io.quarkus.test.common.http.TestHTTPResource;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import jakarta.inject.Inject;
|
||||
import org.jsoup.Connection;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -56,6 +58,14 @@ public class AuthCodeGrantTest {
|
||||
assertThat(flow.getAccessToken(), is(notNullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void authCodeGrant_invalidResponseType() throws IOException {
|
||||
AuthorizationCodeFlow flow = new AuthorizationCodeFlow(authUrl, CLIENT);
|
||||
Connection.Response response = flow.startExpectError(Map.of("response_type", ""));
|
||||
Map<String, String> query = flow.parseAndValidateRedirectError(response);
|
||||
assertThat(query.get("error"), is(ErrorResponse.Error.unsupported_response_type.name()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void implicitGrant() throws IOException {
|
||||
AuthorizationCodeFlow flow = new AuthorizationCodeFlow(authUrl, CLIENT);
|
||||
|
||||
Reference in New Issue
Block a user