mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Fixing issues encountered in dynamic client authentication implementation
This commit is contained in:
parent
e21c92a1ce
commit
68cefe21a5
@ -18,8 +18,6 @@
|
||||
*/
|
||||
package org.wso2.carbon.identity.oauth.extension;
|
||||
|
||||
import javax.ws.rs.core.Request;
|
||||
|
||||
public class RegistrationProfile {
|
||||
|
||||
private String applicationType;
|
||||
@ -34,6 +32,7 @@ public class RegistrationProfile {
|
||||
private String userInfoEncryptedResponseEnc;
|
||||
private String[] contacts;
|
||||
private String[] requestUris;
|
||||
private String owner;
|
||||
|
||||
public String getApplicationType() {
|
||||
return applicationType;
|
||||
@ -131,4 +130,12 @@ public class RegistrationProfile {
|
||||
this.requestUris = requestUris;
|
||||
}
|
||||
|
||||
public String getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public void setOwner(String owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -30,7 +30,6 @@ import javax.ws.rs.core.Response;
|
||||
public interface RegistrationService {
|
||||
|
||||
@POST
|
||||
@Path("/register")
|
||||
Response register(RegistrationProfile profile);
|
||||
|
||||
}
|
||||
@ -20,12 +20,11 @@ package org.wso2.carbon.identity.oauth.extension.impl;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.wso2.carbon.apimgt.api.APIManagementException;
|
||||
import org.wso2.carbon.apimgt.impl.utils.APIUtil;
|
||||
import org.wso2.carbon.apimgt.keymgt.client.SubscriberKeyMgtClient;
|
||||
import org.wso2.carbon.context.CarbonContext;
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException;
|
||||
@ -37,7 +36,10 @@ import org.wso2.carbon.identity.application.mgt.ApplicationManagementService;
|
||||
import org.wso2.carbon.identity.base.IdentityException;
|
||||
import org.wso2.carbon.identity.oauth.OAuthAdminService;
|
||||
import org.wso2.carbon.identity.oauth.dto.OAuthConsumerAppDTO;
|
||||
import org.wso2.carbon.identity.oauth.extension.*;
|
||||
import org.wso2.carbon.identity.oauth.extension.ApplicationConstants;
|
||||
import org.wso2.carbon.identity.oauth.extension.OAuthApplicationInfo;
|
||||
import org.wso2.carbon.identity.oauth.extension.RegistrationProfile;
|
||||
import org.wso2.carbon.identity.oauth.extension.RegistrationService;
|
||||
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
|
||||
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
|
||||
|
||||
@ -68,19 +70,17 @@ public class ClientRegistrationServiceImpl implements RegistrationService {
|
||||
|
||||
|
||||
private OAuthApplicationInfo registerApplication(RegistrationProfile profile) throws APIManagementException {
|
||||
//OAuthApplications are created by calling to APIKeyMgtSubscriber Service
|
||||
SubscriberKeyMgtClient keyMgtClient = APIUtil.getKeyManagementClient();
|
||||
OAuthApplicationInfo oAuthApplicationInfo = new OAuthApplicationInfo();
|
||||
|
||||
//Subscriber's name should be passed as a parameter, since it's under the subscriber the OAuth App is created.
|
||||
String userId = (String) oAuthApplicationInfo.getParameter(ApplicationConstants.OAUTH_CLIENT_USERNAME);
|
||||
String userId = profile.getOwner();
|
||||
String applicationName = profile.getClientName();
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Trying to create OAuth application :" + applicationName);
|
||||
log.debug("Trying to create OAuth application: '" + applicationName + "'");
|
||||
}
|
||||
|
||||
String callBackURL = "";
|
||||
String callBackURL = null;
|
||||
if (oAuthApplicationInfo.getParameter("callback_url") != null) {
|
||||
JSONArray jsonArray = (JSONArray) oAuthApplicationInfo.getParameter("callback_url");
|
||||
for (Object callbackUrlObject : jsonArray) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user