Return-Path: X-Original-To: apmail-usergrid-commits-archive@minotaur.apache.org Delivered-To: apmail-usergrid-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 72F721767B for ; Wed, 21 Oct 2015 20:36:19 +0000 (UTC) Received: (qmail 96264 invoked by uid 500); 21 Oct 2015 20:36:19 -0000 Delivered-To: apmail-usergrid-commits-archive@usergrid.apache.org Received: (qmail 96211 invoked by uid 500); 21 Oct 2015 20:36:19 -0000 Mailing-List: contact commits-help@usergrid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@usergrid.apache.org Delivered-To: mailing list commits@usergrid.apache.org Received: (qmail 95863 invoked by uid 99); 21 Oct 2015 20:36:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Oct 2015 20:36:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9431BE38FA; Wed, 21 Oct 2015 20:36:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: snoopdave@apache.org To: commits@usergrid.apache.org Date: Wed, 21 Oct 2015 20:36:31 -0000 Message-Id: <1f40c31bb22f455e948987572a387170@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [14/24] usergrid git commit: Add support for ApplicationGuestPrincipal; all tests now passing with Shiro Cache. Add support for ApplicationGuestPrincipal; all tests now passing with Shiro Cache. Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/0f979e9c Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/0f979e9c Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/0f979e9c Branch: refs/heads/master Commit: 0f979e9c433ea9753fa580d6ae000bfa97669ae7 Parents: b9a7ab1 Author: Dave Johnson Authored: Tue Sep 29 12:19:32 2015 -0400 Committer: Dave Johnson Committed: Tue Sep 29 12:19:32 2015 -0400 ---------------------------------------------------------------------- .../apache/usergrid/persistence/cache/ScopedCacheTest.java | 2 +- .../org/apache/usergrid/rest/security/shiro/ShiroCache.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/0f979e9c/stack/corepersistence/cache/src/test/java/org/apache/usergrid/persistence/cache/ScopedCacheTest.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/cache/src/test/java/org/apache/usergrid/persistence/cache/ScopedCacheTest.java b/stack/corepersistence/cache/src/test/java/org/apache/usergrid/persistence/cache/ScopedCacheTest.java index c497141..73cffe1 100644 --- a/stack/corepersistence/cache/src/test/java/org/apache/usergrid/persistence/cache/ScopedCacheTest.java +++ b/stack/corepersistence/cache/src/test/java/org/apache/usergrid/persistence/cache/ScopedCacheTest.java @@ -47,7 +47,7 @@ public class ScopedCacheTest { @Inject protected CacheFactory> cf; - TypeReference typeRef = new TypeReference>() {}; + TypeReference typeRef = new TypeReference>() {}; @Test http://git-wip-us.apache.org/repos/asf/usergrid/blob/0f979e9c/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/ShiroCache.java ---------------------------------------------------------------------- diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/ShiroCache.java b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/ShiroCache.java index 1781885..db9fe1c 100644 --- a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/ShiroCache.java +++ b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/ShiroCache.java @@ -27,6 +27,7 @@ import org.apache.usergrid.persistence.cache.ScopedCache; import org.apache.usergrid.persistence.model.entity.SimpleId; import org.apache.usergrid.security.shiro.UsergridAuthenticationInfo; import org.apache.usergrid.security.shiro.UsergridAuthorizationInfo; +import org.apache.usergrid.security.shiro.principals.ApplicationGuestPrincipal; import org.apache.usergrid.security.shiro.principals.ApplicationPrincipal; import org.apache.usergrid.security.shiro.principals.OrganizationPrincipal; import org.apache.usergrid.security.shiro.principals.UserPrincipal; @@ -151,6 +152,10 @@ public class ShiroCache implements Cache { } else if ( spc.getPrimaryPrincipal() instanceof OrganizationPrincipal ) { applicationId = CpNamingUtils.MANAGEMENT_APPLICATION_ID; + } else if ( spc.getPrimaryPrincipal() instanceof ApplicationGuestPrincipal) { + ApplicationGuestPrincipal p = (ApplicationGuestPrincipal)spc.getPrimaryPrincipal(); + applicationId = p.getApplicationId(); + } else { logger.error("Unknown principal type: " + spc.getPrimaryPrincipal().getClass().getSimpleName()); throw new RuntimeException("Unknown principal type: " @@ -168,6 +173,10 @@ public class ShiroCache implements Cache { } else if ( key instanceof OrganizationPrincipal ) { applicationId = CpNamingUtils.MANAGEMENT_APPLICATION_ID; + } else if ( key instanceof ApplicationGuestPrincipal) { + ApplicationGuestPrincipal p = (ApplicationGuestPrincipal)key; + applicationId = p.getApplicationId(); + } else { logger.error("Unknown key type: " + key.getClass().getSimpleName()); throw new RuntimeException("Unknown key type: " + key.getClass().getSimpleName());