From 81a2dd8bace28a684d080413476317768590f1e6 Mon Sep 17 00:00:00 2001 From: Andrei Pavar Date: Sat, 28 Oct 2023 18:56:08 +0300 Subject: [PATCH 1/4] Add case for AqualityAuthenticationException --- .../main/controllers/Administration/UserController.java | 3 ++- .../main/exceptions/AqualityAuthenticationException.java | 8 ++++++++ src/main/java/main/view/BaseServlet.java | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/main/java/main/exceptions/AqualityAuthenticationException.java diff --git a/src/main/java/main/controllers/Administration/UserController.java b/src/main/java/main/controllers/Administration/UserController.java index 5bbbf66..3fe6175 100644 --- a/src/main/java/main/controllers/Administration/UserController.java +++ b/src/main/java/main/controllers/Administration/UserController.java @@ -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; @@ -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 { diff --git a/src/main/java/main/exceptions/AqualityAuthenticationException.java b/src/main/java/main/exceptions/AqualityAuthenticationException.java new file mode 100644 index 0000000..4bce895 --- /dev/null +++ b/src/main/java/main/exceptions/AqualityAuthenticationException.java @@ -0,0 +1,8 @@ +package main.exceptions; + +public class AqualityAuthenticationException extends AqualityException { + public AqualityAuthenticationException(String error) { + super(error); + this.responseCode = 401; + } +} \ No newline at end of file diff --git a/src/main/java/main/view/BaseServlet.java b/src/main/java/main/view/BaseServlet.java index 7ce9cc1..f203076 100644 --- a/src/main/java/main/view/BaseServlet.java +++ b/src/main/java/main/view/BaseServlet.java @@ -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())); From 7069606072e5a697be96f42cb5241038fc0773c8 Mon Sep 17 00:00:00 2001 From: Andrei Pavar Date: Fri, 10 Nov 2023 11:59:11 +0300 Subject: [PATCH 2/4] change version in pom --- pom.xml | 2 +- .../java/main/exceptions/AqualityAuthenticationException.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index e232c60..3f52ae1 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ unifi_reporting_api api war - 1.5.0 + 1.5.1 UTF-8 diff --git a/src/main/java/main/exceptions/AqualityAuthenticationException.java b/src/main/java/main/exceptions/AqualityAuthenticationException.java index 4bce895..3e63755 100644 --- a/src/main/java/main/exceptions/AqualityAuthenticationException.java +++ b/src/main/java/main/exceptions/AqualityAuthenticationException.java @@ -1,8 +1,8 @@ package main.exceptions; -public class AqualityAuthenticationException extends AqualityException { +public class AqualityAuthenticationException extends AqualityException { public AqualityAuthenticationException(String error) { super(error); this.responseCode = 401; } -} \ No newline at end of file +} From 3bd42c2ea9b0920eb9173b65fc08a1fffe54563e Mon Sep 17 00:00:00 2001 From: Andrei Pavar Date: Wed, 15 Nov 2023 15:46:04 +0300 Subject: [PATCH 3/4] update changelog.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2aef5ee..cd78c98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 From 0edcef93115079dd3f318ff78d9fb498c0d947a9 Mon Sep 17 00:00:00 2001 From: Andrei Pavar Date: Wed, 15 Nov 2023 16:28:45 +0300 Subject: [PATCH 4/4] update version lombok for running tests locally --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3f52ae1..bc3dc0b 100644 --- a/pom.xml +++ b/pom.xml @@ -214,7 +214,7 @@ org.projectlombok lombok - 1.18.24 + 1.18.30 javax.ws.rs