/** * Regenerate consumer secret for the application and retrieve application details. * * @param consumerKey Consumer key for the application. * @return OAuthConsumerAppDTO OAuth application details. * @throws IdentityOAuthAdminException Error while regenerating the consumer secret. */ public OAuthConsumerAppDTO updateAndRetrieveOauthSecretKey(String consumerKey) throws IdentityOAuthAdminException { OAuthConsumerAppDTO oAuthConsumerAppDTO = new OAuthConsumerAppDTO(); String newSecretKey = OAuthUtil.getRandomNumber(); CacheEntry clientCredentialDO = new ClientCredentialDO(newSecretKey); oAuthConsumerAppDTO.setOauthConsumerKey(consumerKey); oAuthConsumerAppDTO.setOauthConsumerSecret(newSecretKey); Properties properties = new Properties(); properties.setProperty(OAuthConstants.OAUTH_APP_NEW_SECRET_KEY, newSecretKey); properties.setProperty(OAuthConstants.ACTION_PROPERTY_KEY, OAuthConstants.ACTION_REGENERATE); updateAppAndRevokeTokensAndAuthzCodes(consumerKey, properties); OAuthCache.getInstance().addToCache(new OAuthCacheKey(consumerKey), clientCredentialDO); if (log.isDebugEnabled()) { log.debug("Client Secret for OAuth app with consumerKey: " + consumerKey + " updated in OAuthCache."); } return oAuthConsumerAppDTO; }
/** * Get OAuth application data by the consumer key. * * @param consumerKey Consumer Key * @return <code>OAuthConsumerAppDTO</code> with application information * @throws IdentityOAuthAdminException Error when reading application information from persistence store. */ public OAuthConsumerAppDTO getOAuthApplicationData(String consumerKey) throws IdentityOAuthAdminException { OAuthConsumerAppDTO dto; OAuthAppDAO dao = new OAuthAppDAO(); try { OAuthAppDO app = dao.getAppInformation(consumerKey); if (app != null) { dto = buildConsumerAppDTO(app); if (log.isDebugEnabled()) { log.debug("Found App :" + dto.getApplicationName() + " for consumerKey: " + consumerKey); } } else { dto = new OAuthConsumerAppDTO(); } return dto; } catch (InvalidOAuthClientException | IdentityOAuth2Exception e) { throw handleError("Error while retrieving the app information using consumerKey: " + consumerKey, e); } }
/** * Get OAuth application data by the application name. * * @param appName OAuth application name * @return <code>OAuthConsumerAppDTO</code> with application information * @throws IdentityOAuthAdminException Error when reading application information from persistence store. */ public OAuthConsumerAppDTO getOAuthApplicationDataByAppName(String appName) throws IdentityOAuthAdminException { OAuthConsumerAppDTO dto; OAuthAppDAO dao = new OAuthAppDAO(); try { OAuthAppDO app = dao.getAppInformationByAppName(appName); if (app != null) { dto = buildConsumerAppDTO(app); } else { dto = new OAuthConsumerAppDTO(); } return dto; } catch (InvalidOAuthClientException | IdentityOAuth2Exception e) { throw handleError("Error while retrieving the app information by app name: " + appName, e); } }
String spName) throws DCRMException { OAuthConsumerAppDTO oAuthConsumerApp = new OAuthConsumerAppDTO(); oAuthConsumerApp.setApplicationName(spName); oAuthConsumerApp.setCallbackUrl(
clientId, authenticatedUser, userStoreDomain, scopeString, true); if (scopedToken != null && !distinctClientUserScopeCombo.contains(clientId + ":" + username)) { OAuthConsumerAppDTO appDTO = new OAuthConsumerAppDTO(); OAuthAppDO appDO; try {
OAuthConsumerAppDTO oAuthConsumerAppDTO = new OAuthConsumerAppDTO(); oAuthConsumerAppDTO.setApplicationName(applicationName); oAuthConsumerAppDTO.setCallbackUrl(callbackUrl);
OAuthConsumerAppDTO oAuthConsumerApp = new OAuthConsumerAppDTO(); oAuthConsumerApp.setApplicationName(applicationName);
for (int i = 0; i < apps.length; i++) { app = apps[i]; dto = new OAuthConsumerAppDTO(); dto.setApplicationName(app.getApplicationName()); dto.setCallbackUrl(app.getCallbackUrl());
/** * Get OAuth application data by the application name. * * @param appName OAuth application name * @return <code>OAuthConsumerAppDTO</code> with application information * @throws Exception Error when reading application information from persistence store. */ public OAuthConsumerAppDTO getOAuthApplicationDataByAppName(String appName) throws IdentityOAuthAdminException { OAuthConsumerAppDTO dto = new OAuthConsumerAppDTO(); OAuthAppDAO dao = new OAuthAppDAO(); try { OAuthAppDO app = dao.getAppInformationByAppName(appName); if (app != null) { dto.setApplicationName(app.getApplicationName()); dto.setCallbackUrl(app.getCallbackUrl()); dto.setOauthConsumerKey(app.getOauthConsumerKey()); dto.setOauthConsumerSecret(app.getOauthConsumerSecret()); dto.setOAuthVersion(app.getOauthVersion()); dto.setGrantTypes(app.getGrantTypes()); dto.setPkceMandatory(app.isPkceMandatory()); dto.setPkceSupportPlain(app.isPkceSupportPlain()); } return dto; } catch (InvalidOAuthClientException | IdentityOAuth2Exception e) { throw new IdentityOAuthAdminException("Error while retrieving the app information by app name", e); } }
OAuthConsumerAppDTO oAuthConsumerApp = new OAuthConsumerAppDTO(); oAuthConsumerApp.setApplicationName(applicationName); oAuthConsumerApp.setCallbackUrl(callbackUrl);
/** * Get OAuth application data by the consumer key. * * @param consumerKey Consumer Key * @return <code>OAuthConsumerAppDTO</code> with application information * @throws Exception Error when reading application information from persistence store. */ public OAuthConsumerAppDTO getOAuthApplicationData(String consumerKey) throws IdentityOAuthAdminException { OAuthConsumerAppDTO dto = new OAuthConsumerAppDTO(); OAuthAppDAO dao = new OAuthAppDAO(); try { OAuthAppDO app = dao.getAppInformation(consumerKey); if (app != null) { dto.setApplicationName(app.getApplicationName()); dto.setCallbackUrl(app.getCallbackUrl()); dto.setOauthConsumerKey(app.getOauthConsumerKey()); dto.setOauthConsumerSecret(app.getOauthConsumerSecret()); dto.setOAuthVersion(app.getOauthVersion()); dto.setGrantTypes(app.getGrantTypes()); dto.setPkceMandatory(app.isPkceMandatory()); dto.setPkceSupportPlain(app.isPkceSupportPlain()); } return dto; } catch (InvalidOAuthClientException | IdentityOAuth2Exception e) { throw new IdentityOAuthAdminException("Error while retrieving the app information using consumer key", e); } }
OAuthConsumerAppDTO dto = new OAuthConsumerAppDTO(); dto.setApplicationName(appDO.getApplicationName()); dto.setCallbackUrl(appDO.getCallbackUrl());