This is an automated email from the ASF dual-hosted git repository.
taybou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/unomi.git
The following commit(s) were added to refs/heads/master by this push:
new 3a46314 DMF-3490: simplify authenticateThirdPartyServer algorithm
3a46314 is described below
commit 3a46314054e53ba9134bbc602915f0126221a1bd
Author: Kevan <[email protected]>
AuthorDate: Thu Apr 18 14:47:48 2019 +0200
DMF-3490: simplify authenticateThirdPartyServer algorithm
---
.../apache/unomi/services/services/EventServiceImpl.java | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git
a/services/src/main/java/org/apache/unomi/services/services/EventServiceImpl.java
b/services/src/main/java/org/apache/unomi/services/services/EventServiceImpl.java
index e547022..1334135 100644
---
a/services/src/main/java/org/apache/unomi/services/services/EventServiceImpl.java
+++
b/services/src/main/java/org/apache/unomi/services/services/EventServiceImpl.java
@@ -123,17 +123,14 @@ public class EventServiceImpl implements EventService {
if (key != null) {
for (Map.Entry<String, ThirdPartyServer> entry :
thirdPartyServers.entrySet()) {
ThirdPartyServer server = entry.getValue();
- IPAddress ipAddress = new IPAddressString(ip).getAddress();
- boolean matched = false;
- for (IPAddress serverIpAddress : server.getIpAddresses()) {
- if (serverIpAddress.contains(ipAddress)) {
- matched = true;
- break;
+ if (server.getKey().equals(key)) {
+ IPAddress ipAddress = new IPAddressString(ip).getAddress();
+ for (IPAddress serverIpAddress : server.getIpAddresses()) {
+ if (serverIpAddress.contains(ipAddress)) {
+ return server.getId();
+ }
}
}
- if (server.getKey().equals(key) && matched) {
- return server.getId();
- }
}
logger.debug("Could not authenticate any third party servers");
}