mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-05 22:29:11 +01:00
Remove exception from api key verification
This removes repeated exceptions from the api key service when checking requests without an api key. Despite of throwing an exception, the service now simply returns `null`, when the authentication was not successful. Pushed-by: Rene Pfeuffer<rene.pfeuffer@cloudogu.com> Co-authored-by: René Pfeuffer<rene.pfeuffer@cloudogu.com>
This commit is contained in:
@@ -85,8 +85,9 @@ public class ApiKeyRealm extends AuthenticatingRealm {
|
||||
token instanceof BearerToken || token instanceof UsernamePasswordToken,
|
||||
"%s is required", BearerToken.class);
|
||||
String password = getPassword(token);
|
||||
ApiKeyService.CheckResult check = apiKeyService.check(password);
|
||||
return buildAuthenticationInfo(token, check);
|
||||
return apiKeyService.check(password)
|
||||
.map(check -> buildAuthenticationInfo(token, check))
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
private AuthenticationInfo buildAuthenticationInfo(AuthenticationToken token, ApiKeyService.CheckResult check) {
|
||||
|
||||
Reference in New Issue
Block a user