mirror of
https://github.com/ysoftdevs/oauth-playground-server.git
synced 2026-01-17 09:07:12 +01:00
remove deprecated error constructor
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user