remove deprecated error constructor

This commit is contained in:
Dusan Jakub
2023-09-19 10:35:22 +02:00
parent d6bd44e799
commit 4b9c991439
3 changed files with 5 additions and 14 deletions

View File

@@ -25,14 +25,12 @@ public class OAuthResource {
@POST
@Produces(MediaType.TEXT_HTML)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Object post(AuthParams params,
@FormParam("sessionId") String sessionId,
public Object post(@FormParam("sessionId") String sessionId,
@FormParam("username") String username,
@FormParam("password") String password,
@FormParam("scope") List<String> scopes) {
@FormParam("password") String password) {
sessionsRepo.getSession(sessionId).orElseThrow(() -> new OAuthException("Invalid session"));
sessionsRepo.getSession(sessionId).orElseThrow(() -> new OAuthException(ErrorResponse.Error.access_denied, "Invalid session"));
var user = validateUser(username, password);
if (user == null) {
return Templates.login(username, sessionId, "invalid_credentials");
@@ -67,7 +65,7 @@ public class OAuthResource {
@FormParam("sessionId") String sessionId,
@FormParam("scope") List<String> scopes) {
sessionsRepo.getSession(sessionId).orElseThrow(() -> new OAuthException("Invalid session"));
sessionsRepo.getSession(sessionId).orElseThrow(() -> new OAuthException(ErrorResponse.Error.access_denied, "Invalid session"));
var session = sessionsRepo.authorizeSession(sessionId, scopes);
String redirectUri = session.params().getRedirectUri();

View File

@@ -12,11 +12,6 @@ public class OAuthException extends RuntimeException {
this(new ErrorResponse(error, description));
}
@Deprecated
public OAuthException(String message) {
this(ErrorResponse.Error.server_error, message);
}
public ErrorResponse getResponse() {
return response;
}

View File

@@ -5,8 +5,6 @@ import com.ysoft.geecon.dto.DeviceResponse;
import com.ysoft.geecon.dto.OAuthClient;
import com.ysoft.geecon.error.ErrorResponse;
import java.io.IOException;
import static io.restassured.RestAssured.given;
import static io.restassured.http.ContentType.JSON;
import static org.hamcrest.CoreMatchers.is;
@@ -22,7 +20,7 @@ public class DeviceAuthorizationGrantFlow {
this.client = client;
}
public DeviceResponse start() throws IOException {
public DeviceResponse start() {
deviceResponse = given().
formParam("client_id", client.clientId()).
when().post(deviceUrl)