Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: hydra integration for auth, token and few more endpoints #1032

Merged
merged 40 commits into from
Sep 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
8438685
fix: auth and token api
sattvikc Aug 20, 2024
48cfb7a
fix: cookie and code transformations
sattvikc Aug 21, 2024
fa44c0c
fix: token re-signing
sattvikc Aug 23, 2024
cb79064
fix: token endpoint
sattvikc Aug 26, 2024
393146b
fix: license check and jwks caching
sattvikc Aug 26, 2024
824cbbd
fix: exceptions
sattvikc Aug 27, 2024
cf408d4
fix: refactor
sattvikc Aug 27, 2024
802bbd3
fix: refactor
sattvikc Aug 28, 2024
7839b69
fix: refactor and client crud APIs
sattvikc Aug 29, 2024
8eb8dc2
fix: token type enum
sattvikc Sep 3, 2024
b9b2d68
fix: process ext only on access token
sattvikc Sep 3, 2024
04e7c76
fix: refactor
sattvikc Sep 4, 2024
874ac8c
fix: bugs and refactor
sattvikc Sep 5, 2024
2721620
fix: oauth clients list api
sattvikc Sep 5, 2024
6f03959
fix: consent get accept and reject
sattvikc Sep 5, 2024
41836b3
fix: login request
sattvikc Sep 6, 2024
3a10264
fix: query param transformation
sattvikc Sep 6, 2024
1eddb69
fix: logout request
sattvikc Sep 9, 2024
84fda3f
fix: refactor
sattvikc Sep 9, 2024
7f413c6
fix: remove error debug and hint
sattvikc Sep 9, 2024
c620cdf
fix: introspect api
sattvikc Sep 10, 2024
3e94443
fix: pr comments
sattvikc Sep 11, 2024
b79ddfa
fix: pr comments
sattvikc Sep 11, 2024
ca95c13
fix: pr comment
sattvikc Sep 11, 2024
621befb
fix: pr comment
sattvikc Sep 11, 2024
12c09a0
fix: pr comments and refactor
sattvikc Sep 12, 2024
b6ab81b
fix: pr comments
sattvikc Sep 12, 2024
d87769a
fix: pr comments
sattvikc Sep 12, 2024
085e5c1
fix: revert original http request
sattvikc Sep 12, 2024
bdcdc29
fix: pr comment refactor
sattvikc Sep 12, 2024
d8a1b87
fix: pr comment
sattvikc Sep 16, 2024
360b266
fix: pr comment
sattvikc Sep 16, 2024
f3c022f
fix: pr comment
sattvikc Sep 18, 2024
095a27f
fix: pr comments
sattvikc Sep 18, 2024
da96bc4
fix: owner and pagination
sattvikc Sep 18, 2024
160dce5
fix: pr comment
sattvikc Sep 18, 2024
bd0a918
fix: client id check
sattvikc Sep 18, 2024
b791bf4
fix: ext related
sattvikc Sep 18, 2024
c568f5c
fix: pr comment
sattvikc Sep 19, 2024
bd86375
fix: revoke APIs (#1041)
sattvikc Sep 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: token endpoint
sattvikc committed Aug 26, 2024
commit cb790642572b9dbbd6097c17effcf552bee284fd
88 changes: 41 additions & 47 deletions src/main/java/io/supertokens/oauth/OAuth.java
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
package io.supertokens.oauth;

import com.auth0.jwt.exceptions.JWTCreationException;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@@ -64,9 +65,10 @@ public class OAuth {
private static final String HYDRA_AUTH_ENDPOINT = "/oauth2/auth";
private static final String HYDRA_TOKEN_ENDPOINT = "/oauth2/token";
private static final String HYDRA_CLIENTS_ENDPOINT = "/admin/clients";
private static final String HYDRA_JWKS_PATH = "/.well-known/jwks.json"; // New constant for JWKS path

public static OAuthAuthResponse getAuthorizationUrl(Main main, AppIdentifier appIdentifier, Storage storage, JsonObject paramsFromSdk)
throws InvalidConfigException, HttpResponseException, IOException, OAuthAuthException, StorageQueryException,
public static OAuthAuthResponse getAuthorizationUrl(Main main, AppIdentifier appIdentifier, Storage storage, JsonObject paramsFromSdk, String inputCookies)
throws InvalidConfigException, HttpResponseException, IOException, OAuthAPIException, StorageQueryException,
TenantOrAppNotFoundException {

OAuthStorage oauthStorage = StorageUtils.getOAuthStorage(storage);
@@ -79,24 +81,21 @@ public static OAuthAuthResponse getAuthorizationUrl(Main main, AppIdentifier app
String hydraBaseUrlForConsentAndLogin = Config.getConfig(appIdentifier.getAsPublicTenantIdentifier(), main).getOauthProviderConsentLoginBaseUrl();

String clientId = paramsFromSdk.get("client_id").getAsString();
String cookie = null;

if (paramsFromSdk.has("cookie")) {
cookie = paramsFromSdk.get("cookie").getAsString();
cookie = cookie.replaceAll("st_oauth_", "ory_hydra_");
paramsFromSdk.remove("cookie");
if (inputCookies != null) {
inputCookies = inputCookies.replaceAll("st_oauth_", "ory_hydra_");
}

if (!oauthStorage.doesClientIdExistForThisApp(appIdentifier, clientId)) {
throw new OAuthAuthException("invalid_client", "Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method). The requested OAuth 2.0 Client does not exist.");
throw new OAuthAPIException("invalid_client", "Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method). The requested OAuth 2.0 Client does not exist.", 400);
} else {
// we query hydra
Map<String, String> queryParamsForHydra = constructHydraRequestParamsForAuthorizationGETAPICall(paramsFromSdk);
Map<String, String> headers = new HashMap<>();
Map<String, List<String>> responseHeaders = new HashMap<>();

if (cookie != null) {
headers.put("Cookie", cookie);
if (inputCookies != null) {
headers.put("Cookie", inputCookies);
}

HttpRequest.sendGETRequestWithResponseHeaders(main, "", publicOAuthProviderServiceUrl + HYDRA_AUTH_ENDPOINT, queryParamsForHydra, headers, 10000, 10000, null, responseHeaders, false);
@@ -106,7 +105,7 @@ public static OAuthAuthResponse getAuthorizationUrl(Main main, AppIdentifier app
if(Utils.containsUrl(locationHeaderValue, hydraInternalAddress, true)){
String error = getValueOfQueryParam(locationHeaderValue, ERROR_LITERAL);
String errorDescription = getValueOfQueryParam(locationHeaderValue, ERROR_DESCRIPTION_LITERAL);
throw new OAuthAuthException(error, errorDescription);
throw new OAuthAPIException(error, errorDescription, 400);
}

if(Utils.containsUrl(locationHeaderValue, hydraBaseUrlForConsentAndLogin, true)){
@@ -135,65 +134,59 @@ public static OAuthAuthResponse getAuthorizationUrl(Main main, AppIdentifier app
return new OAuthAuthResponse(redirectTo, cookies);
}

public static JsonObject getToken(Main main, AppIdentifier appIdentifier, Storage storage, JsonObject bodyFromSdk, boolean useDynamicKey) throws InvalidConfigException, TenantOrAppNotFoundException, OAuthAuthException, StorageQueryException {
public static JsonObject getToken(Main main, AppIdentifier appIdentifier, Storage storage, JsonObject bodyFromSdk, String iss, boolean useDynamicKey) throws InvalidConfigException, TenantOrAppNotFoundException, OAuthAPIException, StorageQueryException, IOException, InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, JWTCreationException, JWTException, StorageTransactionLogicException, UnsupportedJWTSigningAlgorithmException {
OAuthStorage oauthStorage = StorageUtils.getOAuthStorage(storage);
String clientId = bodyFromSdk.get("client_id").getAsString();

if (!oauthStorage.doesClientIdExistForThisApp(appIdentifier, clientId)) {
throw new OAuthAuthException("invalid_client", "Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method). The requested OAuth 2.0 Client does not exist.");
throw new OAuthAPIException("invalid_client", "Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method). The requested OAuth 2.0 Client does not exist.", 400);
}

String publicOAuthProviderServiceUrl = Config.getConfig(appIdentifier.getAsPublicTenantIdentifier(), main).getOAuthProviderPublicServiceUrl();
try {
Map<String, String> bodyParams = constructHydraRequestParamsForAuthorizationGETAPICall(bodyFromSdk);
bodyParams.put("code", bodyParams.get("code").replace("st_ac_", "ory_ac_"));
if (bodyParams.containsKey("code")) {
bodyParams.put("code", bodyParams.get("code").replace("st_ac_", "ory_ac_"));
}
if (bodyParams.containsKey("refresh_token")) {
bodyParams.put("refresh_token", bodyParams.get("refresh_token").replace("st_rt_", "ory_rt_"));
}
JsonObject response = HttpRequest.sendFormPOSTRequest(main, "", publicOAuthProviderServiceUrl + HYDRA_TOKEN_ENDPOINT, bodyParams, 10000, 10000, null);

// token transformations
if (response.has("access_token")) {
String accessToken = response.get("access_token").getAsString();
accessToken = resignToken(appIdentifier, main, accessToken, 1, useDynamicKey);
accessToken = resignToken(appIdentifier, main, accessToken, iss, 1, useDynamicKey);
response.addProperty("access_token", accessToken);
}

if (response.has("id_token")) {
String idToken = response.get("id_token").getAsString();
idToken = resignToken(appIdentifier, main, idToken, 2, useDynamicKey);
idToken = resignToken(appIdentifier, main, idToken, iss, 2, useDynamicKey);
response.addProperty("id_token", idToken);
}
// TODO: token transformations
// TODO: error handling

if (response.has("refresh_token")) {
String refreshToken = response.get("refresh_token").getAsString();
refreshToken = refreshToken.replace("ory_rt_", "st_rt_");
response.addProperty("refresh_token", refreshToken);
}
return response;
} catch (HttpResponseException | IOException e) {
// TODO Auto-generated catch block
throw new RuntimeException(e);
} catch (InvalidKeyException e) {
// TODO Auto-generated catch block
throw new RuntimeException(e);
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
throw new RuntimeException(e);
} catch (JWTException e) {
// TODO Auto-generated catch block
throw new RuntimeException(e);
} catch (InvalidKeySpecException e) {
// TODO Auto-generated catch block
throw new RuntimeException(e);
} catch (JWTCreationException e) {
// TODO Auto-generated catch block
throw new RuntimeException(e);
} catch (StorageTransactionLogicException e) {
// TODO Auto-generated catch block
throw new RuntimeException(e);
} catch (UnsupportedJWTSigningAlgorithmException e) {
// TODO Auto-generated catch block
throw new RuntimeException(e);

} catch (HttpResponseException e) {
JsonObject errorResponse = new Gson().fromJson(e.rawMessage, JsonObject.class);
throw new OAuthAPIException(
errorResponse.get("error").getAsString(),
errorResponse.get("error_description").getAsString(),
e.statusCode
);
}
}

private static String resignToken(AppIdentifier appIdentifier, Main main, String token, int stt, boolean useDynamicSigningKey) throws IOException, HttpResponseException, JWTException, InvalidKeyException, NoSuchAlgorithmException, StorageQueryException, StorageTransactionLogicException, UnsupportedJWTSigningAlgorithmException, TenantOrAppNotFoundException, InvalidKeySpecException, JWTCreationException {
private static String resignToken(AppIdentifier appIdentifier, Main main, String token, String iss, int stt, boolean useDynamicSigningKey) throws IOException, HttpResponseException, JWTException, InvalidKeyException, NoSuchAlgorithmException, StorageQueryException, StorageTransactionLogicException, UnsupportedJWTSigningAlgorithmException, TenantOrAppNotFoundException, InvalidKeySpecException, JWTCreationException, InvalidConfigException {
// Load the JWKS from the specified URL
String jwksUrl = "http://localhost:4444/.well-known/jwks.json";
String publicOAuthProviderServiceUrl = Config.getConfig(appIdentifier.getAsPublicTenantIdentifier(), main).getOAuthProviderPublicServiceUrl();
String jwksUrl = publicOAuthProviderServiceUrl + HYDRA_JWKS_PATH; // Use the new constant
JsonObject jwksResponse = HttpRequest.sendGETRequest(main, "", jwksUrl, null, 10000, 10000, null);
JsonArray keys = jwksResponse.get("keys").getAsJsonArray();

@@ -220,6 +213,7 @@ private static String resignToken(AppIdentifier appIdentifier, Main main, String
}
payload.remove("ext");
}
payload.addProperty("iss", iss);
payload.addProperty("stt", stt);

JWTSigningKeyInfo keyToUse;
@@ -287,7 +281,7 @@ public static JsonObject loadOAuthClient(Main main, AppIdentifier appIdentifier,
String adminOAuthProviderServiceUrl = Config.getConfig(appIdentifier.getAsPublicTenantIdentifier(), main).getOAuthProviderAdminServiceUrl();

if (!oauthStorage.doesClientIdExistForThisApp(appIdentifier, clientId)) {
throw new OAuthClientNotFoundException("Unable to locate the resource", "");
throw new OAuthClientNotFoundException("Unable to locate the resource", "", 400);
} else {
try {
JsonObject hydraResponse = HttpRequest.sendGETRequest(main, "", adminOAuthProviderServiceUrl + HYDRA_CLIENTS_ENDPOINT + "/" + clientId, null, 10000, 10000, null);
@@ -311,7 +305,7 @@ public static void deleteOAuthClient(Main main, AppIdentifier appIdentifier, Sto
String adminOAuthProviderServiceUrl = Config.getConfig(appIdentifier.getAsPublicTenantIdentifier(), main).getOAuthProviderAdminServiceUrl();

if (!oauthStorage.doesClientIdExistForThisApp(appIdentifier, clientId)) {
throw new OAuthClientNotFoundException("Unable to locate the resource", "");
throw new OAuthClientNotFoundException("Unable to locate the resource", "", 400);
} else {
try {
oauthStorage.removeAppClientAssociation(appIdentifier, clientId);
@@ -339,7 +333,7 @@ public static JsonObject updateOauthClient(Main main, AppIdentifier appIdentifie
String clientId = paramsFromSdk.get("clientId").getAsString();

if (!oauthStorage.doesClientIdExistForThisApp(appIdentifier, clientId)) {
throw new OAuthClientNotFoundException("Unable to locate the resource", "");
throw new OAuthClientNotFoundException("Unable to locate the resource", "", 400);
} else {
JsonArray hydraInput = translateIncomingDataToHydraUpdateFormat(paramsFromSdk);
try {
Original file line number Diff line number Diff line change
@@ -16,10 +16,10 @@

package io.supertokens.oauth.exceptions;

public class OAuthAuthException extends OAuthException{
public class OAuthAPIException extends OAuthException{
private static final long serialVersionUID = 1836718299845759897L;

public OAuthAuthException(String error, String errorDescription) {
super(error, errorDescription);
public OAuthAPIException(String error, String errorDescription, int statusCode) {
super(error, errorDescription, statusCode);
}
}
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ public class OAuthAPIInvalidInputException extends OAuthException{
@Serial
private static final long serialVersionUID = 665027786586190611L;

public OAuthAPIInvalidInputException(String error, String errorDescription) {
super(error, errorDescription);
public OAuthAPIInvalidInputException(String error, String errorDescription, int statusCode) {
super(error, errorDescription, statusCode);
}
}
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ public class OAuthClientNotFoundException extends OAuthException{
@Serial
private static final long serialVersionUID = 1412853176388698991L;

public OAuthClientNotFoundException(String error, String errorDescription) {
super(error, errorDescription);
public OAuthClientNotFoundException(String error, String errorDescription, int statusCode) {
super(error, errorDescription, statusCode);
}
}
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ public class OAuthClientUpdateException extends OAuthException{
@Serial
private static final long serialVersionUID = -5191044905397936167L;

public OAuthClientUpdateException(String error, String errorDescription) {
super(error, errorDescription);
public OAuthClientUpdateException(String error, String errorDescription, int statusCode) {
super(error, errorDescription, statusCode);
}
}
Original file line number Diff line number Diff line change
@@ -24,10 +24,12 @@ public class OAuthException extends Exception{

public final String error;
public final String errorDescription;
public final int statusCode;

public OAuthException(String error, String errorDescription){
public OAuthException(String error, String errorDescription, int statusCode){
super(error);
this.error = error;
this.errorDescription = errorDescription;
this.statusCode = statusCode;
}
}
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
import io.supertokens.httpRequest.HttpResponseException;
import io.supertokens.multitenancy.exception.BadPermissionException;
import io.supertokens.oauth.OAuth;
import io.supertokens.oauth.exceptions.OAuthAuthException;
import io.supertokens.oauth.exceptions.OAuthAPIException;
import io.supertokens.pluginInterface.RECIPE_ID;
import io.supertokens.pluginInterface.Storage;
import io.supertokens.pluginInterface.exceptions.InvalidConfigException;
@@ -59,14 +59,16 @@ public String getPath() {
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {

JsonObject input = InputParser.parseJsonObjectOrThrowError(req);
InputParser.throwErrorOnMissingRequiredField(input, REQUIRED_FIELDS_FOR_POST);
JsonObject params = InputParser.parseJsonObjectOrThrowError(input, "params", false);
String cookies = InputParser.parseStringOrThrowError(input, "cookies", true);

InputParser.throwErrorOnMissingRequiredField(params, REQUIRED_FIELDS_FOR_POST);

try {
AppIdentifier appIdentifier = getAppIdentifier(req);
Storage storage = enforcePublicTenantAndGetPublicTenantStorage(req);

OAuthAuthResponse authResponse = OAuth.getAuthorizationUrl(super.main, appIdentifier, storage,
input);
OAuthAuthResponse authResponse = OAuth.getAuthorizationUrl(super.main, appIdentifier, storage, params, cookies);
JsonObject response = new JsonObject();
response.addProperty("redirectTo", authResponse.redirectTo);

@@ -80,7 +82,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws I
response.addProperty("status", "OK");
super.sendJsonResponse(200, response, resp);

} catch (OAuthAuthException authException) {
} catch (OAuthAPIException authException) {

JsonObject errorResponse = new JsonObject();
errorResponse.addProperty("error", authException.error);
Original file line number Diff line number Diff line change
@@ -16,17 +16,21 @@

package io.supertokens.webserver.api.oauth;

import com.auth0.jwt.exceptions.JWTCreationException;
import com.google.gson.*;
import io.supertokens.Main;
import io.supertokens.jwt.exceptions.UnsupportedJWTSigningAlgorithmException;
import io.supertokens.multitenancy.exception.BadPermissionException;
import io.supertokens.oauth.OAuth;
import io.supertokens.oauth.exceptions.OAuthAuthException;
import io.supertokens.oauth.exceptions.OAuthAPIException;
import io.supertokens.pluginInterface.RECIPE_ID;
import io.supertokens.pluginInterface.Storage;
import io.supertokens.pluginInterface.exceptions.InvalidConfigException;
import io.supertokens.pluginInterface.exceptions.StorageQueryException;
import io.supertokens.pluginInterface.exceptions.StorageTransactionLogicException;
import io.supertokens.pluginInterface.multitenancy.AppIdentifier;
import io.supertokens.pluginInterface.multitenancy.exceptions.TenantOrAppNotFoundException;
import io.supertokens.session.jwt.JWT.JWTException;
import io.supertokens.webserver.InputParser;
import io.supertokens.webserver.WebserverAPI;
import jakarta.servlet.ServletException;
@@ -35,6 +39,9 @@

import java.io.IOException;
import java.io.Serial;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;

public class OAuthTokenAPI extends WebserverAPI {
@Serial
@@ -53,6 +60,7 @@ public String getPath() {
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {

JsonObject input = InputParser.parseJsonObjectOrThrowError(req);
String iss = InputParser.parseStringOrThrowError(input, "iss", false);

boolean useDynamicKey = false;
Boolean useStaticKeyInput = InputParser.parseBooleanOrThrowError(input, "useStaticSigningKey", true);
@@ -61,28 +69,26 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws I

JsonObject bodyFromSDK = InputParser.parseJsonObjectOrThrowError(input, "body", false);
porcellus marked this conversation as resolved.
Show resolved Hide resolved


try {
AppIdentifier appIdentifier = getAppIdentifier(req);
Storage storage = enforcePublicTenantAndGetPublicTenantStorage(req);

JsonObject response = OAuth.getToken(super.main, appIdentifier, storage,
bodyFromSDK, useDynamicKey);
bodyFromSDK, iss, useDynamicKey);

response.addProperty("status", "OK");
super.sendJsonResponse(200, response, resp);

} catch (OAuthAuthException authException) {
} catch (OAuthAPIException authException) {

JsonObject errorResponse = new JsonObject();
errorResponse.addProperty("error", authException.error);
errorResponse.addProperty("errorDescription", authException.errorDescription);
errorResponse.addProperty("status", "OAUTH2_AUTH_ERROR");
errorResponse.addProperty("error_description", authException.errorDescription);
errorResponse.addProperty("status_code", authException.statusCode);
errorResponse.addProperty("status", "OAUTH2_TOKEN_ERROR");
super.sendJsonResponse(200, errorResponse, resp);

} catch (TenantOrAppNotFoundException | InvalidConfigException | BadPermissionException e) {
throw new ServletException(e);
} catch (StorageQueryException e) {
} catch (TenantOrAppNotFoundException | InvalidConfigException | BadPermissionException | StorageQueryException | InvalidKeyException | NoSuchAlgorithmException | InvalidKeySpecException | JWTCreationException | JWTException | StorageTransactionLogicException | UnsupportedJWTSigningAlgorithmException e) {
throw new ServletException(e);
}
}
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
import io.supertokens.ProcessState;
import io.supertokens.httpRequest.HttpResponseException;
import io.supertokens.oauth.OAuth;
import io.supertokens.oauth.exceptions.OAuthAuthException;
import io.supertokens.oauth.exceptions.OAuthAPIException;
import io.supertokens.pluginInterface.RECIPE_ID;
import io.supertokens.pluginInterface.exceptions.InvalidConfigException;
import io.supertokens.pluginInterface.exceptions.StorageQueryException;
@@ -59,7 +59,7 @@ public void beforeEach() throws InterruptedException {

@Test
public void testLocalhostChangedToApiDomain()
throws StorageQueryException, OAuthAuthException, HttpResponseException, TenantOrAppNotFoundException,
throws StorageQueryException, OAuthAPIException, HttpResponseException, TenantOrAppNotFoundException,
InvalidConfigException, IOException, OAuth2ClientAlreadyExistsForAppException,
io.supertokens.test.httpRequest.HttpResponseException, InterruptedException {

@@ -144,7 +144,7 @@ public void testCalledWithWrongClientIdNotInST_exceptionThrown()
AppIdentifier testApp = new AppIdentifier("", "");
oAuthStorage.addClientForApp(testApp, clientId);

OAuthAuthException thrown = assertThrows(OAuthAuthException.class, () -> {
OAuthAPIException thrown = assertThrows(OAuthAPIException.class, () -> {

OAuthAuthResponse response = OAuth.getAuthorizationUrl(process.getProcess(), new AppIdentifier("", ""),
oAuthStorage, requestBody);
@@ -201,7 +201,7 @@ public void testCalledWithWrongClientIdNotInHydraButInST_exceptionThrown()
AppIdentifier testApp = new AppIdentifier("", "");
oAuthStorage.addClientForApp(testApp, clientId);

OAuthAuthException thrown = assertThrows(OAuthAuthException.class, () -> {
OAuthAPIException thrown = assertThrows(OAuthAPIException.class, () -> {

OAuthAuthResponse response = OAuth.getAuthorizationUrl(process.getProcess(), new AppIdentifier("", ""),
oAuthStorage, requestBody);
@@ -259,7 +259,7 @@ public void testCalledWithWrongRedirectUrl_exceptionThrown()
AppIdentifier testApp = new AppIdentifier("", "");
oAuthStorage.addClientForApp(testApp, clientId);

OAuthAuthException thrown = assertThrows(OAuthAuthException.class, () -> {
OAuthAPIException thrown = assertThrows(OAuthAPIException.class, () -> {

OAuthAuthResponse response = OAuth.getAuthorizationUrl(process.getProcess(), new AppIdentifier("", ""),
oAuthStorage, requestBody);