Skip to content

Commit

Permalink
feat(impl):[#259] fix small bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-ext-kmassalski committed Jan 12, 2024
1 parent fe277ac commit 08666d1
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.tractusx.irs.common.auth.IrsRoles;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.security.authentication.BadCredentialsException;
Expand Down Expand Up @@ -53,6 +54,10 @@ class ApiKeysConfiguration {
private String regular;

/* package */ ApiKeyAuthority authorityOf(final String apiKey) {
if (StringUtils.isBlank(apiKey)) {
throw new BadCredentialsException("Wrong ApiKey");
}

if (apiKey.equals(admin)) {
return ApiKeyAuthority.of(apiKey, AuthorityUtils.createAuthorityList(IrsRoles.ADMIN_IRS));
} else if (apiKey.equals(regular)) {
Expand Down

0 comments on commit 08666d1

Please sign in to comment.