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; }
/** * 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; } }
oAuthApplicationInfo.setCallBackURL(createdApp.getCallbackUrl()); oAuthApplicationInfo.setClientSecret(createdApp.getOauthConsumerSecret()); oAuthApplicationInfo.setIsSaasApplication(serviceProviderCreated.isSaasApp()); OAUTH_REDIRECT_URIS, createdApp.getCallbackUrl()); oAuthApplicationInfo.addParameter(ApplicationConstants. OAUTH_CLIENT_NAME, createdApp.getApplicationName());
app.setApplicationName(application.getApplicationName()); if ((application.getGrantTypes().contains(AUTHORIZATION_CODE) || application.getGrantTypes() .contains(IMPLICIT)) && StringUtils.isEmpty(application.getCallbackUrl())) { throw new IdentityOAuthAdminException("Callback Url is required for Code or Implicit grant types"); app.setCallbackUrl(application.getCallbackUrl()); if (application.getOauthConsumerKey() == null) { app.setOauthConsumerKey(OAuthUtil.getRandomNumber());
oauthappdo.setOauthConsumerKey(consumerAppDTO.getOauthConsumerKey()); oauthappdo.setOauthConsumerSecret(consumerAppDTO.getOauthConsumerSecret()); oauthappdo.setCallbackUrl(consumerAppDTO.getCallbackUrl()); oauthappdo.setApplicationName(consumerAppDTO.getApplicationName()); oauthappdo.setPkceMandatory(consumerAppDTO.getPkceMandatory());
app.setApplicationName(application.getApplicationName()); if ((application.getGrantTypes().contains(AUTHORIZATION_CODE) || application.getGrantTypes() .contains(IMPLICIT)) && StringUtils.isEmpty(application.getCallbackUrl())) { throw new IdentityOAuthAdminException("Callback Url is required for Code or Implicit grant types"); app.setCallbackUrl(application.getCallbackUrl()); app.setState(APP_STATE_ACTIVE); if (StringUtils.isEmpty(application.getOauthConsumerKey())) {
oauthappdo.setCallbackUrl(consumerAppDTO.getCallbackUrl()); oauthappdo.setApplicationName(consumerAppDTO.getApplicationName()); oauthappdo.setPkceMandatory(consumerAppDTO.getPkceMandatory());
registrationResponseProfile.getRedirectUrls().add(createdApp.getCallbackUrl()); registrationResponseProfile.setClientSecret(oauthConsumerSecret); registrationResponseProfile.setClientName(createdApp.getApplicationName());
oAuthApplicationInfo.setCallBackURL(createdApp.getCallbackUrl()); oAuthApplicationInfo.setClientSecret(oauthConsumerSecret); oAuthApplicationInfo.setClientName(createdApp.getApplicationName()); DCRConstants.ClientMetadata.OAUTH_REDIRECT_URIS, createdApp.getCallbackUrl()); oAuthApplicationInfo.addParameter( DCRConstants.ClientMetadata.OAUTH_CLIENT_GRANT, createdApp.getGrantTypes());