private void setValuesToStatementWithPKCENoOwnerUpdate(OAuthAppDO oauthAppDO, PreparedStatement prepStmt) throws SQLException, IdentityOAuth2Exception { prepStmt.setString(4, oauthAppDO.isPkceMandatory() ? "1" : "0"); prepStmt.setString(5, oauthAppDO.isPkceSupportPlain() ? "1" : "0"); prepStmt.setLong(6, oauthAppDO.getUserAccessTokenExpiryTime()); prepStmt.setLong(7, oauthAppDO.getApplicationAccessTokenExpiryTime()); prepStmt.setLong(8, oauthAppDO.getRefreshTokenExpiryTime()); prepStmt.setLong(9, oauthAppDO.getIdTokenExpiryTime()); prepStmt.setString(10, persistenceProcessor.getProcessedClientId(oauthAppDO.getOauthConsumerKey())); }
private void setValuesToStatementWithPKCEAndOwnerUpdate(OAuthAppDO oauthAppDO, PreparedStatement prepStmt) throws SQLException, IdentityOAuth2Exception { prepStmt.setString(4, oauthAppDO.isPkceMandatory() ? "1" : "0"); prepStmt.setString(5, oauthAppDO.isPkceSupportPlain() ? "1" : "0"); prepStmt.setLong(6, oauthAppDO.getUserAccessTokenExpiryTime()); prepStmt.setLong(7, oauthAppDO.getApplicationAccessTokenExpiryTime()); prepStmt.setLong(8, oauthAppDO.getRefreshTokenExpiryTime()); prepStmt.setLong(9, oauthAppDO.getIdTokenExpiryTime()); prepStmt.setString(10, oauthAppDO.getAppOwner().getUserName()); prepStmt.setString(11, oauthAppDO.getAppOwner().getUserStoreDomain()); prepStmt.setString(12, persistenceProcessor.getProcessedClientId(oauthAppDO.getOauthConsumerKey())); }
if(!oAuthAppDO.isPkceSupportPlain()) { throw new IdentityOAuth2Exception("This application does not allow 'plain' transformation algorithm.");
if (!oAuthApp.isPkceSupportPlain()) { throw new IdentityOAuth2Exception("This application does not allow 'plain' transformation algorithm.");
if(OAuth2ServiceComponentHolder.isPkceEnabled()) { prepStmt.setString(4, oauthAppDO.isPkceMandatory() ? "1" : "0"); prepStmt.setString(5, oauthAppDO.isPkceSupportPlain() ? "1" : "0");
prepStmt.setString(9, consumerAppDO.getGrantTypes()); prepStmt.setString(10, consumerAppDO.isPkceMandatory() ? "1" : "0"); prepStmt.setString(11, consumerAppDO.isPkceSupportPlain() ? "1" : "0"); prepStmt.setLong(12, consumerAppDO.getUserAccessTokenExpiryTime()); prepStmt.setLong(13, consumerAppDO.getApplicationAccessTokenExpiryTime());
prepStmt.setString(9, consumerAppDO.getGrantTypes()); prepStmt.setString(10, consumerAppDO.isPkceMandatory() ? "1" : "0"); prepStmt.setString(11, consumerAppDO.isPkceSupportPlain() ? "1" : "0"); prepStmt.execute(); connection.commit();
validationResponseDTO.setApplicationName(appDO.getApplicationName()); validationResponseDTO.setPkceMandatory(appDO.isPkceMandatory()); validationResponseDTO.setPkceSupportPlain(appDO.isPkceSupportPlain()); return validationResponseDTO; validationResponseDTO.setCallbackURL(callbackURI); validationResponseDTO.setPkceMandatory(appDO.isPkceMandatory()); validationResponseDTO.setPkceSupportPlain(appDO.isPkceSupportPlain()); return validationResponseDTO; } else { // Provided callback URL does not match the registered callback url.
validationResponseDTO.setApplicationName(appDO.getApplicationName()); validationResponseDTO.setPkceMandatory(appDO.isPkceMandatory()); validationResponseDTO.setPkceSupportPlain(appDO.isPkceSupportPlain()); return validationResponseDTO; validationResponseDTO.setCallbackURL(callbackURI); validationResponseDTO.setPkceMandatory(appDO.isPkceMandatory()); validationResponseDTO.setPkceSupportPlain(appDO.isPkceSupportPlain()); return validationResponseDTO; } else { // Provided callback URL does not match the registered callback url.
appDTO.setGrantTypes(appDO.getGrantTypes()); appDTO.setPkceMandatory(appDO.isPkceMandatory()); appDTO.setPkceSupportPlain(appDO.isPkceSupportPlain()); appDTOs.add(appDTO); } catch (InvalidOAuthClientException e) {
dto.setUsername(app.getUser().toString()); dto.setPkceMandatory(app.isPkceMandatory()); dto.setPkceSupportPlain(app.isPkceSupportPlain()); dtos[i] = dto;
/** * 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); } }
/** * 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); } }
dto.setState(appDO.getState()); dto.setPkceMandatory(appDO.isPkceMandatory()); dto.setPkceSupportPlain(appDO.isPkceSupportPlain()); dto.setUserAccessTokenExpiryTime(appDO.getUserAccessTokenExpiryTime()); dto.setApplicationAccessTokenExpiryTime(appDO.getApplicationAccessTokenExpiryTime());