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

Fix 500 code for authentication issue #103

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.5.1 (2023-11-15)
Bugfixes:
- Fixed an issue Invalid authorisation returns 500 status code

## 1.5.0 (2023-07-28)
- Added `/issues/assign` endpoint, which allows to check previously created Test Runs and Test Results and assign Issues to them if there's a RegEx match

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>unifi_reporting_api</groupId>
<artifactId>api</artifactId>
<packaging>war</packaging>
<version>1.5.0</version>
<version>1.5.1</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -214,7 +214,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<version>1.18.30</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mysql.cj.conf.ConnectionUrlParser;
import main.controllers.BaseController;
import main.exceptions.AqualityAuthenticationException;
import main.exceptions.AqualityException;
import main.exceptions.AqualityPermissionsException;
import main.model.db.dao.project.PasswordDao;
Expand Down Expand Up @@ -147,7 +148,7 @@ private UserDto checkUser(String user_name, String password) throws AqualityExce
}
}

throw new AqualityException("Credentials you've provided are not valid. Reenter please.");
throw new AqualityAuthenticationException("Credentials you've provided are not valid. Reenter please.");
}

private UserDto handleLDAPAuthorization(String userName, String password) throws AqualityException {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package main.exceptions;

public class AqualityAuthenticationException extends AqualityException {
public AqualityAuthenticationException(String error) {
super(error);
this.responseCode = 401;
}
}
1 change: 1 addition & 0 deletions src/main/java/main/view/BaseServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ protected void handleException(HttpServletResponse resp, @NotNull Exception e) {
case "InvalidFormatException":
case "AqualityQueryParameterException":
case "AqualitySQLException":
case "AqualityAuthenticationException":
AqualityException exception = (AqualityException) e;
resp.setStatus(exception.getResponseCode());
setResponseBody(resp, new ErrorDto(exception.getMessage()));
Expand Down