Skip to content

Commit

Permalink
Merge pull request #714 from catenax-ng/feature/259-temporary-keys
Browse files Browse the repository at this point in the history
feat(impl):[#259] fix bug
  • Loading branch information
ds-ext-kmassalski authored Jan 12, 2024
2 parents cafba6c + 08666d1 commit 14af40a
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 14af40a

Please sign in to comment.