Merge pull request #19 from mgeiss/develop

fixed compilation error caused by different behaviour when using Orac…
diff --git a/service/src/main/java/io/mifos/identity/internal/command/handler/AuthenticationCommandHandler.java b/service/src/main/java/io/mifos/identity/internal/command/handler/AuthenticationCommandHandler.java
index 0e958f6..7b55d7e 100644
--- a/service/src/main/java/io/mifos/identity/internal/command/handler/AuthenticationCommandHandler.java
+++ b/service/src/main/java/io/mifos/identity/internal/command/handler/AuthenticationCommandHandler.java
@@ -364,11 +364,18 @@
           final UserEntity user,
           final String sourceApplicationName,
           @SuppressWarnings("OptionalUsedAsFieldOrParameterType") final Optional<String> callEndpointSet) {
+
     //If the call endpoint set was given, but does not correspond to a stored call endpoint set, throw an exception.
     //If it wasn't given then return all of the permissions for the application.
-    final Optional<ApplicationCallEndpointSetEntity> applicationCallEndpointSet
-            = callEndpointSet.map(x -> applicationCallEndpointSets.get(sourceApplicationName, x)
-            .orElseThrow(AmitAuthenticationException::invalidToken));
+    final Optional<ApplicationCallEndpointSetEntity> applicationCallEndpointSet = callEndpointSet.map(x -> {
+      final Optional<ApplicationCallEndpointSetEntity> optionalEndpointSetEntity =
+          applicationCallEndpointSets.get(sourceApplicationName, x);
+      if (optionalEndpointSetEntity.isPresent()) {
+        return optionalEndpointSetEntity.get();
+      } else {
+        throw AmitAuthenticationException.invalidToken();
+      }
+    });
 
     final RoleEntity userRole = roles.get(user.getRole())
             .orElseThrow(AmitAuthenticationException::userPasswordCombinationNotFound);