You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by my...@apache.org on 2018/01/22 15:52:39 UTC

[fineract-cn-identity] branch develop updated (404dcde -> 2b8d427)

This is an automated email from the ASF dual-hosted git repository.

myrle pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-identity.git.


    from 404dcde  Improving synchronization.  This is still insufficient though.
     new c4ec8b4  Merge pull request #24 from myrle-krantz/develop
     new f6b84f2  group allowed operations by path
     new 1ae6fe6  retrofitted the creation of internal token permissions (self)
     new f908884  added out to ignore
     new 2b8d427  Merge pull request #26 from mgeiss/develop

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitignore                                         |  1 +
 .../src/main/java/TestAuthentication.java          | 12 ++++----
 .../handler/AuthenticationCommandHandler.java      | 34 ++++++++++++++++------
 .../io/mifos/identity/rest/RoleRestController.java |  2 +-
 4 files changed, 34 insertions(+), 15 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
myrle@apache.org.

[fineract-cn-identity] 01/05: Merge pull request #24 from myrle-krantz/develop

Posted by my...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-identity.git

commit c4ec8b4bdb43ea2e96997e88769585dd07728497
Merge: 0272e03 404dcde
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Wed Jul 19 17:33:16 2017 +0200

    Merge pull request #24 from myrle-krantz/develop
    
    Improving synchronization.  This is still insufficient though.

 .../internal/command/handler/Provisioner.java      | 33 +++++++++++++++++++---
 .../identity/internal/repository/Tenants.java      | 10 -------
 .../identity/rest/InitializeRestController.java    | 21 ++------------
 3 files changed, 32 insertions(+), 32 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
myrle@apache.org.

[fineract-cn-identity] 04/05: added out to ignore

Posted by my...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-identity.git

commit f90888480072fbd724f4e73e1cdea133e53f0e29
Author: mgeiss <mg...@mifos.org>
AuthorDate: Wed Aug 9 11:22:24 2017 +0200

    added out to ignore
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 2d01356..e5d45bc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
 .idea
 build/
 target/
+out/
 
 # Ignore Gradle GUI config
 gradle-app.setting

-- 
To stop receiving notification emails like this one, please contact
myrle@apache.org.

[fineract-cn-identity] 02/05: group allowed operations by path

Posted by my...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-identity.git

commit f6b84f2e7560331d8c8e8680f7a44e8f5db88869
Author: mgeiss <mg...@mifos.org>
AuthorDate: Tue Aug 8 11:29:24 2017 +0200

    group allowed operations by path
---
 .../src/main/java/TestAuthentication.java          |  7 +++---
 .../handler/AuthenticationCommandHandler.java      | 25 +++++++++++++++++-----
 .../io/mifos/identity/rest/RoleRestController.java |  2 +-
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/component-test/src/main/java/TestAuthentication.java b/component-test/src/main/java/TestAuthentication.java
index fdab6e5..8e98443 100644
--- a/component-test/src/main/java/TestAuthentication.java
+++ b/component-test/src/main/java/TestAuthentication.java
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+import com.google.common.collect.Sets;
 import io.mifos.anubis.api.v1.client.Anubis;
 import io.mifos.anubis.api.v1.domain.*;
 import io.mifos.anubis.test.v1.SystemSecurityEnvironment;
@@ -89,9 +90,9 @@ public class TestAuthentication extends AbstractComponentTest {
 
       final Set<TokenPermission> expectedTokenPermissions = new HashSet<>();
       Collections.addAll(expectedTokenPermissions,
-              new TokenPermission("identity-v1/permittablegroups/*", Collections.singleton(AllowedOperation.CHANGE)),
-              new TokenPermission("identity-v1/roles/*", Collections.singleton(AllowedOperation.DELETE)),
-              new TokenPermission("identity-v1/users/*", Collections.singleton(AllowedOperation.READ)));
+          new TokenPermission("identity-v1/permittablegroups/*", Sets.newHashSet(AllowedOperation.CHANGE, AllowedOperation.DELETE, AllowedOperation.READ)),
+          new TokenPermission("identity-v1/roles/*", Sets.newHashSet(AllowedOperation.CHANGE, AllowedOperation.DELETE, AllowedOperation.READ)),
+          new TokenPermission("identity-v1/users/*", Sets.newHashSet(AllowedOperation.CHANGE, AllowedOperation.DELETE, AllowedOperation.READ)));
       //This is not a complete list.  This is a spot check.
 
       Assert.assertTrue("Expected: " + expectedTokenPermissions + "\nActual: " + tokenPermissions,
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 7b55d7e..d6a6589 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
@@ -267,16 +267,31 @@ public class AuthenticationCommandHandler {
       tokenPermissions = getApplicationTokenPermissions(user, sourceApplicationName, callEndpointSet);
     }
 
+    final HashSet<TokenPermission> minifiedTokenPermissions = new HashSet<>(
+        tokenPermissions
+            .stream()
+            .collect(Collectors.toMap(TokenPermission::getPath,
+                tokenPermission -> tokenPermission,
+                (currentTokenPermission, newTokenPermission) -> {
+                  newTokenPermission.getAllowedOperations()
+                      .forEach(allowedOperation -> currentTokenPermission.getAllowedOperations().add(allowedOperation));
+                  return currentTokenPermission;
+                })
+            )
+            .values()
+    );
+
+
     logger.info("Access token for tenant '{}', user '{}', application '{}', and callEndpointSet '{}' being returned containing the permissions '{}'.",
             TenantContextHolder.identifier().orElse("null"),
             user.getIdentifier(),
             sourceApplicationName,
             callEndpointSet.orElse("null"),
-            tokenPermissions.toString());
+            minifiedTokenPermissions.toString());
 
     final TokenSerializationResult accessToken = getAuthenticationResponse(
             user.getIdentifier(),
-            tokenPermissions,
+            minifiedTokenPermissions,
             privateSignature,
             sourceApplicationName);
 
@@ -520,9 +535,9 @@ public class AuthenticationCommandHandler {
   }
 
   private TokenPermission getTokenPermission(final PermittableType permittable) {
-    return new TokenPermission(
-            permittable.getPath(),
-            Collections.singleton(RoleMapper.mapAllowedOperation(AllowedOperationType.fromHttpMethod(permittable.getMethod()))));
+    final HashSet<AllowedOperation> allowedOperations = new HashSet<>();
+    allowedOperations.add(RoleMapper.mapAllowedOperation(AllowedOperationType.fromHttpMethod(permittable.getMethod())));
+    return new TokenPermission(permittable.getPath(), allowedOperations);
   }
 
   private TokenSerializationResult getRefreshToken(final UserEntity user,
diff --git a/service/src/main/java/io/mifos/identity/rest/RoleRestController.java b/service/src/main/java/io/mifos/identity/rest/RoleRestController.java
index 1caceee..4e19fce 100644
--- a/service/src/main/java/io/mifos/identity/rest/RoleRestController.java
+++ b/service/src/main/java/io/mifos/identity/rest/RoleRestController.java
@@ -83,7 +83,7 @@ public class RoleRestController
   @RequestMapping(value= PathConstants.IDENTIFIER_RESOURCE_STRING, method = RequestMethod.GET,
       consumes = {MediaType.ALL_VALUE},
       produces = {MediaType.APPLICATION_JSON_VALUE})
-  @Permittable(AcceptedTokenType.TENANT)
+  @Permittable(value = AcceptedTokenType.TENANT, groupId = PermittableGroupIds.ROLE_MANAGEMENT)
   public @ResponseBody ResponseEntity<Role> get(@PathVariable(PathConstants.IDENTIFIER_PATH_VARIABLE) final String identifier)
   {
     return new ResponseEntity<>(checkIdentifier(identifier), HttpStatus.OK);

-- 
To stop receiving notification emails like this one, please contact
myrle@apache.org.

[fineract-cn-identity] 03/05: retrofitted the creation of internal token permissions (self)

Posted by my...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-identity.git

commit 1ae6fe6b0b4006a86098f7cd61495c4b80a5c67b
Author: mgeiss <mg...@mifos.org>
AuthorDate: Wed Aug 9 11:19:53 2017 +0200

    retrofitted the creation of internal token permissions (self)
---
 component-test/src/main/java/TestAuthentication.java             | 5 +++--
 .../internal/command/handler/AuthenticationCommandHandler.java   | 9 +++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/component-test/src/main/java/TestAuthentication.java b/component-test/src/main/java/TestAuthentication.java
index 8e98443..d134b78 100644
--- a/component-test/src/main/java/TestAuthentication.java
+++ b/component-test/src/main/java/TestAuthentication.java
@@ -142,8 +142,9 @@ public class TestAuthentication extends AbstractComponentTest {
       Collections.addAll(expectedTokenPermissions,
               new TokenPermission(horusEndpoint.getPath(), Collections.singleton(AllowedOperation.READ)),
               new TokenPermission(maatEndpoint.getPath(), Collections.singleton(AllowedOperation.READ)),
-              new TokenPermission("identity-v1/users/{useridentifier}/password", Collections.singleton(AllowedOperation.CHANGE)),
-              new TokenPermission("identity-v1/users/{useridentifier}/permissions", Collections.singleton(AllowedOperation.READ)),
+              new TokenPermission("identity-v1/users/{useridentifier}/password",
+                  Sets.newHashSet(AllowedOperation.READ, AllowedOperation.CHANGE, AllowedOperation.DELETE)),
+              new TokenPermission("identity-v1/users/{useridentifier}/permissions", Sets.newHashSet(AllowedOperation.READ)),
               new TokenPermission("identity-v1/token/_current", Collections.singleton(AllowedOperation.DELETE)));
 
       Assert.assertTrue("Expected: " + expectedTokenPermissions + "\nActual: " + tokenPermissions,
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 d6a6589..af81819 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
@@ -15,6 +15,7 @@
  */
 package io.mifos.identity.internal.command.handler;
 
+import com.google.common.collect.Sets;
 import com.google.gson.Gson;
 import io.mifos.anubis.api.v1.domain.AllowedOperation;
 import io.mifos.anubis.api.v1.domain.TokenContent;
@@ -489,10 +490,10 @@ public class AuthenticationCommandHandler {
 
     ret.add(new TokenPermission(
             applicationName + "/applications/*/permissions/*/users/{useridentifier}/enabled",
-            AllowedOperation.ALL));
+            Sets.newHashSet(AllowedOperation.READ, AllowedOperation.CHANGE, AllowedOperation.DELETE)));
     ret.add(new TokenPermission(
             applicationName + "/users/{useridentifier}/permissions",
-            Collections.singleton(AllowedOperation.READ)));
+            Sets.newHashSet(AllowedOperation.READ)));
 
     return ret;
   }
@@ -502,10 +503,10 @@ public class AuthenticationCommandHandler {
 
     ret.add(new TokenPermission(
             applicationName + "/users/{useridentifier}/password",
-            Collections.singleton(AllowedOperation.CHANGE)));
+            Sets.newHashSet(AllowedOperation.READ, AllowedOperation.CHANGE, AllowedOperation.DELETE)));
     ret.add(new TokenPermission(
             applicationName + "/token/_current",
-            Collections.singleton(AllowedOperation.DELETE)));
+            Sets.newHashSet(AllowedOperation.DELETE)));
 
     return ret;
   }

-- 
To stop receiving notification emails like this one, please contact
myrle@apache.org.

[fineract-cn-identity] 05/05: Merge pull request #26 from mgeiss/develop

Posted by my...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-identity.git

commit 2b8d42744cf451221aefbd98e30b8d0da7e8b890
Merge: c4ec8b4 f908884
Author: Markus Geiß <ma...@apache.org>
AuthorDate: Wed Aug 9 11:26:28 2017 +0200

    Merge pull request #26 from mgeiss/develop
    
    token minification

 .gitignore                                         |  1 +
 .../src/main/java/TestAuthentication.java          | 12 ++++----
 .../handler/AuthenticationCommandHandler.java      | 34 ++++++++++++++++------
 .../io/mifos/identity/rest/RoleRestController.java |  2 +-
 4 files changed, 34 insertions(+), 15 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
myrle@apache.org.