usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [13/50] usergrid git commit: Rename a static property variable and make a coulple methods protected access so exensions of the class can access the methods.
Date Mon, 22 Aug 2016 15:00:17 GMT
Rename a static property variable and make a coulple methods protected access so exensions
of the class can access the methods.


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/10e89576
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/10e89576
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/10e89576

Branch: refs/heads/asf-site
Commit: 10e895767c9cc661ad6c6e728eb1b780e0efe7e9
Parents: e8f68a0
Author: Michael Russo <mrusso@apigee.com>
Authored: Mon Aug 1 13:00:05 2016 -0700
Committer: Michael Russo <mrusso@apigee.com>
Committed: Mon Aug 1 13:00:05 2016 -0700

----------------------------------------------------------------------
 .../rest/management/ManagementResource.java       |  6 +++---
 .../rest/management/users/UserResource.java       | 18 +++++++++---------
 .../rest/management/users/UsersResource.java      |  4 ++--
 .../rest/management/ExternalSSOEnabledIT.java     |  2 +-
 .../rest/management/ManagementResourceIT.java     | 12 ++++++------
 .../cassandra/ManagementServiceImpl.java          |  4 ++--
 .../usergrid/security/sso/SSOProviderFactory.java |  2 +-
 .../tokens/cassandra/TokenServiceImpl.java        |  9 +++++----
 8 files changed, 29 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/10e89576/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
b/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
index 285a22e..737d187 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
@@ -60,7 +60,7 @@ import java.util.Map;
 import static javax.servlet.http.HttpServletResponse.*;
 import static javax.ws.rs.core.MediaType.*;
 import static org.apache.commons.lang.StringUtils.isNotBlank;
-import static org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl.USERGRID_EXTERNAL_PROVIDER_URL;
+import static org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl.USERGRID_EXTERNAL_SSO_PROVIDER_URL;
 import static org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl.USERGRID_EXTERNAL_SSO_ENABLED;
 import static org.apache.usergrid.utils.JsonUtils.mapToJsonString;
 import static org.apache.usergrid.utils.StringUtils.stringOrSubstringAfterFirst;
@@ -385,7 +385,7 @@ public class ManagementResource extends AbstractContextResource {
                 OAuthResponse response =
                     OAuthResponse.errorResponse( SC_BAD_REQUEST ).setError( OAuthError.TokenResponse.INVALID_GRANT
)
                         .setErrorDescription( "SSO Integration is enabled, Admin users must
login via provider: "+
-                            properties.getProperty(TokenServiceImpl.USERGRID_EXTERNAL_PROVIDER)
).buildJSONMessage();
+                            properties.getProperty(TokenServiceImpl.USERGRID_EXTERNAL_SSO_PROVIDER)
).buildJSONMessage();
                 return Response.status( response.getResponseStatus() ).type( jsonMediaType(
callback ) )
                     .entity( wrapWithCallback( response.getBody(), callback ) ).build();
 
@@ -620,7 +620,7 @@ public class ManagementResource extends AbstractContextResource {
             if ( !userServiceAdmin(username)) {
                 // this guy is not the superuser
                 throw new IllegalArgumentException( "Admin Users must login via " +
-                        properties.getProperty( USERGRID_EXTERNAL_PROVIDER_URL ) );
+                        properties.getProperty(USERGRID_EXTERNAL_SSO_PROVIDER_URL) );
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/10e89576/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
index c66822c..21d4c23 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
@@ -46,7 +46,7 @@ import java.util.Map;
 import java.util.UUID;
 
 import static org.apache.usergrid.security.shiro.utils.SubjectUtils.isServiceAdmin;
-import static org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl.USERGRID_EXTERNAL_PROVIDER_URL;
+import static org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl.USERGRID_EXTERNAL_SSO_PROVIDER_URL;
 import static org.apache.usergrid.utils.ConversionUtils.string;
 
 
@@ -138,7 +138,7 @@ public class UserResource extends AbstractContextResource {
 
         if ( tokens.isExternalSSOProviderEnabled() ) {
             throw new IllegalArgumentException( "Admin Users must reset passwords via " +
-                properties.getProperty( USERGRID_EXTERNAL_PROVIDER_URL ) );
+                properties.getProperty(USERGRID_EXTERNAL_SSO_PROVIDER_URL) );
         }
 
         if ( json == null ) {
@@ -224,7 +224,7 @@ public class UserResource extends AbstractContextResource {
 
         if ( tokens.isExternalSSOProviderEnabled() ) {
             throw new IllegalArgumentException( "Admin Users must reset passwords via " +
-                    properties.getProperty( USERGRID_EXTERNAL_PROVIDER_URL ) );
+                    properties.getProperty(USERGRID_EXTERNAL_SSO_PROVIDER_URL) );
         }
 
         UUID organizationId = null;
@@ -268,7 +268,7 @@ public class UserResource extends AbstractContextResource {
 
         if ( tokens.isExternalSSOProviderEnabled() ) {
             throw new IllegalArgumentException( "Admin Users must reset passwords via " +
-                    properties.getProperty( USERGRID_EXTERNAL_PROVIDER_URL ) );
+                    properties.getProperty(USERGRID_EXTERNAL_SSO_PROVIDER_URL) );
         }
 
         UUID organizationId = null;
@@ -354,7 +354,7 @@ public class UserResource extends AbstractContextResource {
 
         if ( tokens.isExternalSSOProviderEnabled() ) {
             throw new IllegalArgumentException( "Admin Users must activate via " +
-                    properties.getProperty( USERGRID_EXTERNAL_PROVIDER_URL ) );
+                    properties.getProperty(USERGRID_EXTERNAL_SSO_PROVIDER_URL) );
         }
 
         UUID organizationId = null;
@@ -384,7 +384,7 @@ public class UserResource extends AbstractContextResource {
 
         if ( tokens.isExternalSSOProviderEnabled() ) {
             throw new IllegalArgumentException( "Admin Users must confirm via " +
-                    properties.getProperty( USERGRID_EXTERNAL_PROVIDER_URL ) );
+                    properties.getProperty(USERGRID_EXTERNAL_SSO_PROVIDER_URL) );
         }
 
         UUID organizationId = null;
@@ -420,7 +420,7 @@ public class UserResource extends AbstractContextResource {
 
         if ( tokens.isExternalSSOProviderEnabled() ) {
             throw new IllegalArgumentException( "Admin Users must reactivate via " +
-                    properties.getProperty( USERGRID_EXTERNAL_PROVIDER_URL ) );
+                    properties.getProperty(USERGRID_EXTERNAL_SSO_PROVIDER_URL) );
         }
 
         logger.info( "Send activation email for user: {}" , user.getUuid() );
@@ -444,7 +444,7 @@ public class UserResource extends AbstractContextResource {
 
         if ( tokens.isExternalSSOProviderEnabled() ) {
             throw new IllegalArgumentException( "Admin Users must tokens must be revoked
via " +
-                properties.getProperty( USERGRID_EXTERNAL_PROVIDER_URL ) );
+                properties.getProperty(USERGRID_EXTERNAL_SSO_PROVIDER_URL) );
         }
 
         UUID adminId = user.getUuid();
@@ -481,7 +481,7 @@ public class UserResource extends AbstractContextResource {
 
         if ( tokens.isExternalSSOProviderEnabled() ) {
             throw new IllegalArgumentException( "Admin Users must tokens must be revoked
via " +
-                properties.getProperty( USERGRID_EXTERNAL_PROVIDER_URL ) );
+                properties.getProperty(USERGRID_EXTERNAL_SSO_PROVIDER_URL) );
         }
 
         UUID adminId = user.getUuid();

http://git-wip-us.apache.org/repos/asf/usergrid/blob/10e89576/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
index 828b46a..ca7833b 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
@@ -44,7 +44,7 @@ import java.util.UUID;
 
 import static org.apache.commons.lang.StringUtils.isBlank;
 import static org.apache.usergrid.rest.exceptions.SecurityException.mappableSecurityException;
-import static org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl.USERGRID_EXTERNAL_PROVIDER_URL;
+import static org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl.USERGRID_EXTERNAL_SSO_PROVIDER_URL;
 
 
 @Component( "org.apache.usergrid.rest.management.users.UsersResource" )
@@ -116,7 +116,7 @@ public class UsersResource extends AbstractContextResource {
 
         if ( tokens.isExternalSSOProviderEnabled() ) {
             throw new IllegalArgumentException( "Admin Users must signup via " +
-                    properties.getProperty( USERGRID_EXTERNAL_PROVIDER_URL ) );
+                    properties.getProperty(USERGRID_EXTERNAL_SSO_PROVIDER_URL) );
         }
 
         // email is only required parameter

http://git-wip-us.apache.org/repos/asf/usergrid/blob/10e89576/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExternalSSOEnabledIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExternalSSOEnabledIT.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExternalSSOEnabledIT.java
index 75fa0b5..972ed05 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExternalSSOEnabledIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExternalSSOEnabledIT.java
@@ -166,7 +166,7 @@ public class ExternalSSOEnabledIT extends AbstractRestIT {
 
         // /managment/token -> adminusername and password --> should fail.
         ApiResponse postResponse1 = pathResource("management/token").post(false, ApiResponse.class,loginInfo1);
-//        fail( "SSO Integration is enabled, Admin users must login via provider: "+ USERGRID_EXTERNAL_PROVIDER_URL);
+//        fail( "SSO Integration is enabled, Admin users must login via provider: "+ USERGRID_EXTERNAL_SSO_PROVIDER_URL);
 
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/10e89576/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
index 21c62ba..b689527 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
@@ -37,7 +37,7 @@ import javax.ws.rs.core.Response;
 import java.io.IOException;
 import java.util.*;
 
-import static org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl.USERGRID_EXTERNAL_PROVIDER_URL;
+import static org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl.USERGRID_EXTERNAL_SSO_PROVIDER_URL;
 import static org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl.USERGRID_EXTERNAL_SSO_ENABLED;
 import static org.apache.usergrid.utils.MapUtils.hashMap;
 import static org.junit.Assert.*;
@@ -633,7 +633,7 @@ public class ManagementResourceIT extends AbstractRestIT {
 
         String suToken = clientSetup.getSuperuserToken().getAccessToken();
         Map<String, String> props = new HashMap<String, String>();
-        props.put( USERGRID_EXTERNAL_PROVIDER_URL, getBaseURI().toURL().toExternalForm()
);
+        props.put(USERGRID_EXTERNAL_SSO_PROVIDER_URL, getBaseURI().toURL().toExternalForm()
);
         pathResource( "testproperties" ).post( props );
 
 
@@ -653,7 +653,7 @@ public class ManagementResourceIT extends AbstractRestIT {
 
         // unset the Usergrid Central SSO URL so it does not interfere with other tests
 
-        props.put( USERGRID_EXTERNAL_PROVIDER_URL, "" );
+        props.put(USERGRID_EXTERNAL_SSO_PROVIDER_URL, "" );
         pathResource( "testproperties" ).post( props );
     }
 
@@ -673,7 +673,7 @@ public class ManagementResourceIT extends AbstractRestIT {
         String suToken = clientSetup.getSuperuserToken().getAccessToken();
         Map<String, String> props = new HashMap<String, String>();
         props.put(USERGRID_EXTERNAL_SSO_ENABLED, "true");
-        props.put( USERGRID_EXTERNAL_PROVIDER_URL, getBaseURI().toURL().toExternalForm()
);
+        props.put(USERGRID_EXTERNAL_SSO_PROVIDER_URL, getBaseURI().toURL().toExternalForm()
);
         pathResource( "testproperties" ).post( props );
 
         try {
@@ -687,7 +687,7 @@ public class ManagementResourceIT extends AbstractRestIT {
                     put( "grant_type", "password" );
                 }};
                 ApiResponse postResponse = pathResource( "management/token" ).post( false,
ApiResponse.class, loginInfo );
-                fail( "SSO Integration is enabled, Admin users must login via provider: "+
USERGRID_EXTERNAL_PROVIDER_URL);
+                fail( "SSO Integration is enabled, Admin users must login via provider: "+
USERGRID_EXTERNAL_SSO_PROVIDER_URL);
 
             } catch (ClientErrorException actual) {
                 assertEquals( 400, actual.getResponse().getStatus() );
@@ -734,7 +734,7 @@ public class ManagementResourceIT extends AbstractRestIT {
 
             // turn off validate external tokens by un-setting the usergrid.central.url
 
-            props.put( USERGRID_EXTERNAL_PROVIDER_URL, "" );
+            props.put(USERGRID_EXTERNAL_SSO_PROVIDER_URL, "" );
             props.put(USERGRID_EXTERNAL_SSO_ENABLED, "");
             pathResource( "testproperties" ).post( props );
         }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/10e89576/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
index 97febdf..746d9dd 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
@@ -967,7 +967,7 @@ public class ManagementServiceImpl implements ManagementService {
     }
 
 
-    private boolean validateAdminInfo( String username, String name, String email, String
password ) throws Exception {
+    protected boolean validateAdminInfo( String username, String name, String email, String
password ) throws Exception {
         if ( email == null ) {
             return false;
         }
@@ -988,7 +988,7 @@ public class ManagementServiceImpl implements ManagementService {
     }
 
 
-    private UserInfo createAdminUserInternal( UUID organizationId, String username, String
name, String email, String password,
+    protected UserInfo createAdminUserInternal( UUID organizationId, String username, String
name, String email, String password,
                                               boolean activated, boolean disabled, Map<String,
Object> userProperties )
             throws Exception {
         logger.info( "createAdminUserInternal: {}", username );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/10e89576/stack/services/src/main/java/org/apache/usergrid/security/sso/SSOProviderFactory.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/security/sso/SSOProviderFactory.java
b/stack/services/src/main/java/org/apache/usergrid/security/sso/SSOProviderFactory.java
index 2b9755e..31e085e 100644
--- a/stack/services/src/main/java/org/apache/usergrid/security/sso/SSOProviderFactory.java
+++ b/stack/services/src/main/java/org/apache/usergrid/security/sso/SSOProviderFactory.java
@@ -41,7 +41,7 @@ public class SSOProviderFactory {
 
     public ExternalSSOProvider getProvider(){
 
-        return getSpecificProvider(properties.getProperty(TokenServiceImpl.USERGRID_EXTERNAL_PROVIDER));
+        return getSpecificProvider(properties.getProperty(TokenServiceImpl.USERGRID_EXTERNAL_SSO_PROVIDER));
 
     }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/10e89576/stack/services/src/main/java/org/apache/usergrid/security/tokens/cassandra/TokenServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/security/tokens/cassandra/TokenServiceImpl.java
b/stack/services/src/main/java/org/apache/usergrid/security/tokens/cassandra/TokenServiceImpl.java
index 46ea7fe..4815f9d 100644
--- a/stack/services/src/main/java/org/apache/usergrid/security/tokens/cassandra/TokenServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/security/tokens/cassandra/TokenServiceImpl.java
@@ -776,9 +776,10 @@ public class TokenServiceImpl implements TokenService {
 
     //SSO2 implementation
     public static final String USERGRID_EXTERNAL_SSO_ENABLED = "usergrid.external.sso.enabled";
-    public static final String USERGRID_EXTERNAL_PROVIDER =    "usergrid.external.sso.provider";
-    public static final String USERGRID_EXTERNAL_PROVIDER_URL = "usergrid.external.sso.url";
-
+    public static final String USERGRID_EXTERNAL_SSO_PROVIDER =    "usergrid.external.sso.provider";
+    public static final String USERGRID_EXTERNAL_SSO_PROVIDER_URL = "usergrid.external.sso.url";
+    public static final String USERGRID_EXTERNAL_SSO_PROVIDER_USER_PROVISION_URL
+        = "usergrid.external.sso.userprovision.url";
 
 
     private static Client jerseyClient = null;
@@ -802,7 +803,7 @@ public class TokenServiceImpl implements TokenService {
     }
 
     private String getExternalSSOProvider(){
-            return properties.getProperty(USERGRID_EXTERNAL_PROVIDER);
+            return properties.getProperty(USERGRID_EXTERNAL_SSO_PROVIDER);
     }
 
     /**


Mime
View raw message