/** * Get OAuth2/OIDC application information with client name * * @param clientName * @return Application * @throws DCRMException */ public Application getApplicationByName(String clientName) throws DCRMException { if (StringUtils.isEmpty(clientName)) { throw DCRMUtils.generateClientException( DCRMConstants.ErrorMessages.BAD_REQUEST_INSUFFICIENT_DATA, null); } String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); if (!isServiceProviderExist(clientName, tenantDomain)) { throw DCRMUtils.generateClientException( DCRMConstants.ErrorMessages.NOT_FOUND_APPLICATION_WITH_NAME, clientName); } try { OAuthConsumerAppDTO oAuthConsumerAppDTO = oAuthAdminService.getOAuthApplicationDataByAppName(clientName); if (!isUserAuthorized(oAuthConsumerAppDTO.getOauthConsumerKey())) { throw DCRMUtils.generateClientException( DCRMConstants.ErrorMessages.FORBIDDEN_UNAUTHORIZED_USER, clientName); } return buildResponse(oAuthConsumerAppDTO); } catch (IdentityOAuthAdminException e) { throw DCRMUtils.generateServerException( DCRMConstants.ErrorMessages.FAILED_TO_GET_APPLICATION, clientName, e); } }
createdApp = oAuthAdminService.getOAuthApplicationDataByAppName(oAuthConsumerApp.getApplicationName()); } catch (IdentityOAuthAdminException e) { throw DCRMUtils.generateServerException(
if (isHashingDiabled) { oAuthAdminService.registerOAuthApplicationData(oAuthConsumerAppDTO); createdApp = oAuthAdminService.getOAuthApplicationDataByAppName(oAuthConsumerAppDTO .getApplicationName()); } else {
oAuthAdminService.getOAuthApplicationDataByAppName(oAuthConsumerApp.getApplicationName()); if (log.isDebugEnabled()) { log.debug("Retrieved Details for OAuth App " + createdApp.getApplicationName());