You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by gr...@apache.org on 2016/01/25 22:18:03 UTC
[11/35] usergrid git commit: Only create new client secrets during
app creation if the application UUID is not provided (otherwise you overwrite
existing app credentials).
Only create new client secrets during app creation if the application UUID is not provided (otherwise you overwrite existing app credentials).
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/38b6b88a
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/38b6b88a
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/38b6b88a
Branch: refs/heads/USERGRID-1047
Commit: 38b6b88a63e4f2ad1f5bcc505b47cdf4263ccc7d
Parents: e38ee3e
Author: Michael Russo <mi...@gmail.com>
Authored: Thu Jan 14 17:42:47 2016 -0800
Committer: Michael Russo <mi...@gmail.com>
Committed: Thu Jan 14 17:42:47 2016 -0800
----------------------------------------------------------------------
.../cassandra/ManagementServiceImpl.java | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/38b6b88a/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 dfd0cb1..f252705 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
@@ -1622,7 +1622,7 @@ public class ManagementServiceImpl implements ManagementService {
return createApplication(organizationId, applicationName, null, properties);
}
- @Override
+ @Override
public ApplicationInfo createApplication( UUID organizationId, String applicationName, UUID applicationId,
Map<String, Object> properties ) throws Exception {
@@ -1638,11 +1638,16 @@ public class ManagementServiceImpl implements ManagementService {
Entity appInfo = emf.createApplicationV2(
organizationInfo.getName(), applicationName, applicationId ,properties);
- writeUserToken( smf.getManagementAppId(), appInfo,
- encryptionService.plainTextCredentials(
- generateOAuthSecretKey( AuthPrincipalType.APPLICATION ),
- null,
- smf.getManagementAppId() ) );
+ // only generate a client secret on app creation when you're creating an app that doesn't already exist
+ if( applicationId == null ){
+
+ writeUserToken( smf.getManagementAppId(), appInfo,
+ encryptionService.plainTextCredentials(
+ generateOAuthSecretKey( AuthPrincipalType.APPLICATION ),
+ null,
+ smf.getManagementAppId() ) );
+ }
+
applicationId = addApplicationToOrganization( organizationId, appInfo );