Skip to content

Commit

Permalink
remove clients config prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
JiahuiWho committed May 9, 2024
1 parent dab99af commit 524120e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ String getClientName(String account) throws BadRequestException {
throw new BadRequestException("Client not found");
}

if (client != null) {
if (client != null && client.getDomains() != null) {
boolean hasDomainIntersection =
new HashSet<>(sep10Config.getAllowedClientDomains()).containsAll(client.getDomains());
if (!hasDomainIntersection) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@Configuration
public class ClientsBeans {
@Bean
@ConfigurationProperties(prefix = "clients")
@ConfigurationProperties(prefix = "")
PropertyClientsConfig clientsConfig() {
return new PropertyClientsConfig();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ private void validateClient(ClientConfig clientConfig, Errors errors) {
}

public void validateCustodialClient(ClientConfig clientConfig, Errors errors) {
if (clientConfig.getSigningKeys() == null || clientConfig.getSigningKeys().isEmpty()) {
if (isEmpty(clientConfig.getSigningKey())
&& (clientConfig.getSigningKeys() == null || clientConfig.getSigningKeys().isEmpty())) {
errors.reject(
"empty-client-signing-keys",
"The client.signingKeys cannot be empty and must be defined");
Expand All @@ -119,7 +120,8 @@ public void validateCustodialClient(ClientConfig clientConfig, Errors errors) {
}

public void validateNonCustodialClient(ClientConfig clientConfig, Errors errors) {
if (clientConfig.getDomains() == null || clientConfig.getDomains().isEmpty()) {
if (isEmpty(clientConfig.getDomain())
&& (clientConfig.getDomains() == null || clientConfig.getDomains().isEmpty())) {
errors.reject(
"empty-client-domains", "The client.domains cannot be empty and must be defined");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ void validateClientAttribution(Errors errors) {
if (clientAttributionRequired) {
List<String> nonCustodialClientNames =
clientsConfig.clients.stream()
.filter(cfg -> cfg.getType() == NONCUSTODIAL && !cfg.getDomains().isEmpty())
.flatMap(cfg -> cfg.getDomains().stream())
.filter(cfg -> cfg.getType() == NONCUSTODIAL)
.map(ClientConfig::getName)
.collect(Collectors.toList());

if (nonCustodialClientNames.isEmpty()) {
Expand Down

0 comments on commit 524120e

Please sign in to comment.