/** * Revoke approve always of the consent for OAuth apps by resource owners * * @param appName name of the app * @param state state of the approve always * @return revokeRespDTO DTO representing success or failure message */ public OAuthRevocationResponseDTO updateApproveAlwaysForAppConsentByResourceOwner(String appName, String state) throws IdentityOAuthAdminException { OAuthRevocationResponseDTO revokeRespDTO = new OAuthRevocationResponseDTO(); String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); String tenantAwareUserName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); try { OAuthTokenPersistenceFactory.getInstance().getTokenManagementDAO() .updateApproveAlwaysForAppConsentByResourceOwner(tenantAwareUserName, tenantDomain, appName, state); } catch (IdentityOAuth2Exception e) { String errorMsg = "Error occurred while revoking OAuth Consent approve always of Application " + appName + " of user " + tenantAwareUserName; log.error(errorMsg, e); revokeRespDTO.setError(true); revokeRespDTO.setErrorCode(OAuth2ErrorCodes.INVALID_REQUEST); revokeRespDTO.setErrorMsg("Invalid revocation request"); } return revokeRespDTO; }
triggerPostRevokeListeners(revokeRequestDTO, new OAuthRevocationResponseDTO (), accessTokenDOs.toArray(new AccessTokenDO[accessTokenDOs.size()])); OAuthRevocationResponseDTO revokeRespDTO = new OAuthRevocationResponseDTO(); revokeRespDTO.setError(true); revokeRespDTO.setErrorCode(OAuth2ErrorCodes.INVALID_REQUEST); return revokeRespDTO; return new OAuthRevocationResponseDTO();
triggerPostRevokeListeners(revokeRequestDTO, new OAuthRevocationResponseDTO (), accessTokenDOs.toArray(new AccessTokenDO[accessTokenDOs.size()])); OAuthRevocationResponseDTO revokeRespDTO = new OAuthRevocationResponseDTO(); revokeRespDTO.setError(true); revokeRespDTO.setErrorCode(OAuth2ErrorCodes.INVALID_REQUEST); return revokeRespDTO; return new OAuthRevocationResponseDTO();