diff options
author | Gunther6070 <haydenhartman10@yahoo.com> | 2025-03-25 08:21:01 -0400 |
---|---|---|
committer | Gunther6070 <haydenhartman10@yahoo.com> | 2025-03-25 08:21:01 -0400 |
commit | ffbe2870d320c4127d32307f2646f39e2e284eec (patch) | |
tree | f9f46447c689c1667f04f17bfbf2e8d07ff0fcd0 /ufund-api/src/main/java/com/ufund/api/ufundapi/service/AuthService.java | |
parent | d31c1aec7f615646553a227c8e235d4ae2679c68 (diff) | |
parent | c15aa3daab0cf9a640945d4e634d1327fb55d2db (diff) | |
download | JellySolutions-ffbe2870d320c4127d32307f2646f39e2e284eec.tar.gz JellySolutions-ffbe2870d320c4127d32307f2646f39e2e284eec.tar.bz2 JellySolutions-ffbe2870d320c4127d32307f2646f39e2e284eec.zip |
Merge branch 'api-cleanup' of https://github.com/RIT-SWEN-261-02/team-project-2245-swen-261-02-2b into api-cleanup
Diffstat (limited to 'ufund-api/src/main/java/com/ufund/api/ufundapi/service/AuthService.java')
-rw-r--r-- | ufund-api/src/main/java/com/ufund/api/ufundapi/service/AuthService.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/service/AuthService.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/service/AuthService.java index 71b8f41..4e5ebce 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/service/AuthService.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/service/AuthService.java @@ -29,20 +29,20 @@ public class AuthService { public void authenticate(String targetUsername, String key) throws IllegalAccessException, IOException { var userAuth = userAuthDAO.getUserAuth(key); if (userAuth == null) { - throw new IllegalAccessException("Unauthenticated"); + throw new IllegalAccessException("Invalid authentication key"); } var username = userAuth.getUsername(); var userType = userService.getUser(username).getType(); if (!username.equals(targetUsername) && userType != User.UserType.MANAGER) { - throw new IllegalAccessException("Unauthorized"); + throw new IllegalAccessException("Provided key does not grant access to perform the requested operation"); } } public void authenticate(String key) throws IOException, IllegalAccessException { var userAuth = userAuthDAO.getUserAuth(key); if (userAuth == null) { - throw new IllegalAccessException("Unauthenticated"); + throw new IllegalAccessException("Invalid authentication key"); } } @@ -58,7 +58,7 @@ public class AuthService { public String login(String username, String password) throws IllegalAccessException, IOException { var usr = userService.getUser(username); if (usr == null || !usr.verifyPassword(password)) { - throw new IllegalAccessException("Unauthorized"); + throw new IllegalAccessException("Incorrect username or password"); } var userAuth = UserAuth.generate(username); userAuthDAO.addUserAuth(userAuth); |