Code refactored.

revert-70aa11f8
harshanl 9 years ago
parent 81034c84f5
commit d4eab9f86e

@ -39,8 +39,8 @@ import java.util.StringTokenizer;
*/ */
public class PermissionUtils { public class PermissionUtils {
public static String ADMIN_PERMISSION_REGISTRY_PATH = "/permission/admin"; public static final String ADMIN_PERMISSION_REGISTRY_PATH = "/permission/admin";
public static String PERMISSION_PROPERTY_NAME = "name"; public static final String PERMISSION_PROPERTY_NAME = "name";
public static Registry getGovernanceRegistry() throws PermissionManagementException { public static Registry getGovernanceRegistry() throws PermissionManagementException {
try { try {
@ -78,11 +78,11 @@ public class PermissionUtils {
try { try {
StringTokenizer tokenizer = new StringTokenizer(permission.getPath(), "/"); StringTokenizer tokenizer = new StringTokenizer(permission.getPath(), "/");
String lastToken = "", currentToken, tempPath; String lastToken = "", currentToken, tempPath;
while(tokenizer.hasMoreTokens()){ while(tokenizer.hasMoreTokens()) {
currentToken = tokenizer.nextToken(); currentToken = tokenizer.nextToken();
tempPath = lastToken + "/" + currentToken; tempPath = lastToken + "/" + currentToken;
if(!checkResourceExists(tempPath)){ if(!checkResourceExists(tempPath)) {
createRegistryCollection(tempPath, currentToken.substring(0)); createRegistryCollection(tempPath, currentToken);
} }
lastToken = tempPath; lastToken = tempPath;
} }

@ -22,7 +22,7 @@ import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService; import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService;
/** /**
* Created by harshan on 9/8/15. * Holds the utility methods used by Dynamic-Client web bundle.
*/ */
public class DynamicClientUtil { public class DynamicClientUtil {

@ -38,7 +38,6 @@ import org.wso2.carbon.identity.sso.saml.admin.SAMLSSOConfigAdmin;
import org.wso2.carbon.identity.sso.saml.dto.SAMLSSOServiceProviderDTO; import org.wso2.carbon.identity.sso.saml.dto.SAMLSSOServiceProviderDTO;
import org.wso2.carbon.registry.core.Registry; import org.wso2.carbon.registry.core.Registry;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils; import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
import java.util.Arrays; import java.util.Arrays;
/** /**
@ -95,16 +94,16 @@ public class DynamicClientRegistrationImpl implements DynamicClientRegistrationS
if (jsonObject.has(ApplicationConstants.ClientMetadata.OAUTH_REDIRECT_URIS)) { if (jsonObject.has(ApplicationConstants.ClientMetadata.OAUTH_REDIRECT_URIS)) {
oAuthApplicationInfo oAuthApplicationInfo
.addParameter(ApplicationConstants.ClientMetadata.OAUTH_REDIRECT_URIS, .addParameter(ApplicationConstants.ClientMetadata.OAUTH_REDIRECT_URIS,
jsonObject jsonObject
.get(ApplicationConstants.ClientMetadata. .get(ApplicationConstants.ClientMetadata.
OAUTH_REDIRECT_URIS)); OAUTH_REDIRECT_URIS));
} }
if (jsonObject.has(ApplicationConstants.ClientMetadata.OAUTH_CLIENT_GRANT)) { if (jsonObject.has(ApplicationConstants.ClientMetadata.OAUTH_CLIENT_GRANT)) {
oAuthApplicationInfo.addParameter(ApplicationConstants.ClientMetadata. oAuthApplicationInfo.addParameter(ApplicationConstants.ClientMetadata.
OAUTH_CLIENT_GRANT, jsonObject OAUTH_CLIENT_GRANT, jsonObject
.get(ApplicationConstants.ClientMetadata. .get(ApplicationConstants.ClientMetadata.
OAUTH_CLIENT_GRANT)); OAUTH_CLIENT_GRANT));
} }
} catch (JSONException e) { } catch (JSONException e) {
throw new DynamicClientRegistrationException( throw new DynamicClientRegistrationException(

@ -24,7 +24,6 @@ import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService; import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService;
import org.wso2.carbon.dynamic.client.registration.impl.DynamicClientRegistrationImpl; import org.wso2.carbon.dynamic.client.registration.impl.DynamicClientRegistrationImpl;
import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; import org.wso2.carbon.identity.application.mgt.ApplicationManagementService;
import org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent;
/** /**
* @scr.component name="org.wso2.carbon.dynamic.client.registration" immediate="true" * @scr.component name="org.wso2.carbon.dynamic.client.registration" immediate="true"

Loading…
Cancel
Save