private Application buildResponse(OAuthConsumerAppDTO createdApp) { Application application = new Application(); application.setClient_name(createdApp.getApplicationName()); application.setClient_id(createdApp.getOauthConsumerKey()); application.setClient_secret(createdApp.getOauthConsumerSecret()); List<String> redirectUrisList = new ArrayList<>(); redirectUrisList.add(createdApp.getCallbackUrl()); application.setRedirect_uris(redirectUrisList); return application; }
if (createdApp.getOauthConsumerSecret() != null && !createdApp. getOauthConsumerSecret().isEmpty()) { Property property = new Property(); property.setName("oauthConsumerSecret"); property.setValue(createdApp.getOauthConsumerSecret()); Property[] properties = {property}; inboundAuthenticationRequestConfig.setProperties(properties); oAuthApplicationInfo.setClientId(createdApp.getOauthConsumerKey()); oAuthApplicationInfo.setCallBackURL(createdApp.getCallbackUrl()); oAuthApplicationInfo.setClientSecret(createdApp.getOauthConsumerSecret()); oAuthApplicationInfo.setIsSaasApplication(serviceProviderCreated.isSaasApp());
.getOauthConsumerSecret())) { errorMessage = "OauthConsumerKey or OauthConsumerSecret is not provided for " + "updating the OAuth application."; if (!StringUtils.equals(consumerAppDTO.getOauthConsumerSecret(), oauthappdo.getOauthConsumerSecret())) { if (log.isDebugEnabled()) { log.debug("Invalid oauthConsumerSecret is provided for updating the OAuth" + oauthappdo.setOauthConsumerSecret(consumerAppDTO.getOauthConsumerSecret()); oauthappdo.setCallbackUrl(consumerAppDTO.getCallbackUrl()); oauthappdo.setApplicationName(consumerAppDTO.getApplicationName());
/** * Convert {@link org.wso2.carbon.identity.oauth.dto.OAuthConsumerAppDTO} to an * {@link org.wso2.carbon.apimgt.api.model.OAuthApplicationInfo} * * @param createdApp Response from OAuthAdminService * @return Converted {@link org.wso2.carbon.apimgt.api.model.OAuthApplicationInfo} */ private OAuthApplicationInfo createOAuthAppInfoFromDTO(OAuthConsumerAppDTO createdApp) { OAuthApplicationInfo oAuthApplicationInfo = new OAuthApplicationInfo(); oAuthApplicationInfo.setClientId(createdApp.getOauthConsumerKey()); oAuthApplicationInfo.setCallBackURL(createdApp.getCallbackUrl()); oAuthApplicationInfo.setClientSecret(createdApp.getOauthConsumerSecret()); oAuthApplicationInfo.addParameter(ApplicationConstants. OAUTH_REDIRECT_URIS, createdApp.getCallbackUrl()); oAuthApplicationInfo.addParameter(ApplicationConstants. OAUTH_CLIENT_NAME, createdApp.getApplicationName()); oAuthApplicationInfo.addParameter(ApplicationConstants. OAUTH_CLIENT_GRANT, createdApp.getGrantTypes()); return oAuthApplicationInfo; } }
oauthappdo.setUser(user); oauthappdo.setOauthConsumerKey(consumerAppDTO.getOauthConsumerKey()); oauthappdo.setOauthConsumerSecret(consumerAppDTO.getOauthConsumerSecret()); oauthappdo.setCallbackUrl(consumerAppDTO.getCallbackUrl()); oauthappdo.setApplicationName(consumerAppDTO.getApplicationName());
} else { app.setOauthConsumerKey(application.getOauthConsumerKey()); if (StringUtils.isEmpty(application.getOauthConsumerSecret())) { app.setOauthConsumerSecret(OAuthUtil.getRandomNumber()); } else { app.setOauthConsumerSecret(application.getOauthConsumerSecret());
} else { app.setOauthConsumerKey(application.getOauthConsumerKey()); app.setOauthConsumerSecret(application.getOauthConsumerSecret());
inboundAuthenticationRequestConfig.setInboundAuthKey(createdApp.getOauthConsumerKey()); inboundAuthenticationRequestConfig.setInboundAuthType(AUTH_TYPE_OAUTH_2); String oauthConsumerSecret = createdApp.getOauthConsumerSecret(); if (oauthConsumerSecret != null && !oauthConsumerSecret.isEmpty()) { Property property = new Property();
inboundAuthenticationRequestConfig.setInboundAuthKey(createdApp.getOauthConsumerKey()); inboundAuthenticationRequestConfig.setInboundAuthType(AUTH_TYPE_OAUTH_2); String oauthConsumerSecret = createdApp.getOauthConsumerSecret(); if (oauthConsumerSecret != null && !oauthConsumerSecret.isEmpty()) { Property property = new Property();