mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-03-13 15:20:14 +01:00
Added more info to BasicAuth fail message
This commit is contained in:
parent
1d107ce568
commit
46e15a1196
@ -21,6 +21,11 @@ public class WebUserAuthException extends WebException {
|
||||
this.failReason = failReason;
|
||||
}
|
||||
|
||||
public WebUserAuthException(FailReason failReason, String additionalInfo) {
|
||||
super(failReason.getReason() + ": " + additionalInfo);
|
||||
this.failReason = failReason;
|
||||
}
|
||||
|
||||
public WebUserAuthException(Throwable cause) {
|
||||
super(FailReason.ERROR.getReason(), cause);
|
||||
this.failReason = FailReason.ERROR;
|
||||
|
@ -14,7 +14,7 @@ import com.djrapitops.plan.utilities.PassEncryptUtil;
|
||||
|
||||
/**
|
||||
* Authentication handling for Basic Auth.
|
||||
*
|
||||
* <p>
|
||||
* Basic access authentication (Wikipedia):
|
||||
* https://en.wikipedia.org/wiki/Basic_access_authentication
|
||||
*
|
||||
@ -44,14 +44,14 @@ public class BasicAuthentication implements Authentication {
|
||||
|
||||
Database database = Database.getActive();
|
||||
if (!database.check().doesWebUserExists(user)) {
|
||||
throw new WebUserAuthException(FailReason.USER_DOES_NOT_EXIST);
|
||||
throw new WebUserAuthException(FailReason.USER_DOES_NOT_EXIST, user);
|
||||
}
|
||||
|
||||
WebUser webUser = database.fetch().getWebUser(user);
|
||||
|
||||
boolean correctPass = PassEncryptUtil.verifyPassword(passwordRaw, webUser.getSaltedPassHash());
|
||||
if (!correctPass) {
|
||||
throw new WebUserAuthException(FailReason.USER_PASS_MISMATCH);
|
||||
throw new WebUserAuthException(FailReason.USER_PASS_MISMATCH, user);
|
||||
}
|
||||
return webUser;
|
||||
} catch (DBException | PassEncryptException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user