@Test public void deleteCredential() throws Exception { Credential credential = new Credential(); credential.setAccount("dev"); credential.setRegion("us-east-1"); credential.setApplication("membership"); credential.setEnvironment("environment"); credential.setComponent("testComponent"); credential.setShortKey("shortKey"); doNothing().when(fideliusService).deleteCredential(anyString(), anyString(), anyString(), anyString(), anyString(), anyString()); Credential actual = credentialsService.deleteCredential(credential); assertEquals(credential, actual); }
@PreAuthorize("@fideliusRoleService.isAuthorizedToDelete(#credential.getApplication(), #credential.getAccount())") public Credential deleteCredential(Credential credential) { setFideliusEnvironment(credential.getAccount(), credential.getRegion()); String user = fideliusRoleService.getUserProfile().getUserId(); try { if (credential.getComponent() == null || credential.getComponent().equals("null")) { credential.setComponent(null); } fideliusService.deleteCredential(credential.getShortKey(), credential.getApplication(), credential.getEnvironment(), credential.getComponent(), tableName, user); } catch (Exception e) { this.logger.info("Credential not deleted " + e.toString()); return null; } return credential; }
CredentialsService { @PreAuthorize("@fideliusRoleService.isAuthorizedToDelete(#credential.getApplication(), #credential.getAccount())") public Credential deleteCredential(Credential credential) { setFideliusEnvironment(credential.getAccount(), credential.getRegion()); String user = fideliusRoleService.getUserProfile().getUserId(); try { if (credential.getComponent() == null || credential.getComponent().equals("null")) { credential.setComponent(null); } fideliusService.deleteCredential(credential.getShortKey(), credential.getApplication(), credential.getEnvironment(), credential.getComponent(), tableName, user); } catch (Exception e) { this.logger.info("Credential not deleted " + e.toString()); return null; } return credential; } }
CredentialsService { @PreAuthorize("@fideliusRoleService.isAuthorizedToDelete(#credential.getApplication(), #credential.getAccount())") public Credential deleteCredential(Credential credential) { setFideliusEnvironment(credential.getAccount(), credential.getRegion()); String user = fideliusRoleService.getUserProfile().getUserId(); try { if (credential.getComponent() == null || credential.getComponent().equals("null")) { credential.setComponent(null); } fideliusService.deleteCredential(credential.getShortKey(), credential.getApplication(), credential.getEnvironment(), credential.getComponent(), tableName, user); } catch (Exception e) { this.logger.info("Credential not deleted " + e.toString()); return null; } return credential; }  }
CredentialsService { @PreAuthorize("@fideliusRoleService.isAuthorizedToDelete(#credential.getApplication(), #credential.getAccount())") public Credential deleteCredential(Credential credential) { setFideliusEnvironment(credential.getAccount(), credential.getRegion()); String user = fideliusRoleService.getUserProfile().getUserId(); try { if (credential.getComponent() == null || credential.getComponent().equals("null")) { credential.setComponent(null); } fideliusService.deleteCredential(credential.getShortKey(), credential.getApplication(), credential.getEnvironment(), credential.getComponent(), tableName, user); } catch (Exception e) { this.logger.info("Credential not deleted " + e.toString()); return null; } return credential; }  @PreAuthorize("@fideliusRoleService.isAuthorized(#application, #account, \"LIST_CREDENTIALS\")") List<Credential> getAllCredentials(String tableName, String account, String region, String application); @PreAuthorize("@fideliusRoleService.isAuthorized(#application, #account, \"LIST_CREDENTIALS\")") Credential getCredential(String account, String region, String application, String longKey); @PreAuthorize("@fideliusRoleService.isAuthorized(#application, #account, \"LIST_CREDENTIALS\")") List<HistoryEntry> getCredentialHistory(String tableName, String account, String region, String application, String environment, String component, String key); @PreAuthorize("@fideliusRoleService.isAuthorized(#application, #account)") Credential getCredentialSecret(String account, String region, String application, String environment,
                                      String component, String shortKey); @PreAuthorize("@fideliusRoleService.isAuthorized(#credential.application, #credential.account)") Credential putCredential(Credential credential); @PreAuthorize("@fideliusRoleService.isAuthorized(#credential.application, #credential.account)") Credential createCredential(Credential credential); @PreAuthorize("@fideliusRoleService.isAuthorizedToDelete(#credential.getApplication(), #credential.getAccount())") Credential deleteCredential(Credential credential); }
CredentialsService { @PreAuthorize("@fideliusRoleService.isAuthorizedToDelete(#credential.getApplication(), #credential.getAccount())") public Credential deleteCredential(Credential credential) { setFideliusEnvironment(credential.getAccount(), credential.getRegion()); String user = fideliusRoleService.getUserProfile().getUserId(); try { if (credential.getComponent() == null || credential.getComponent().equals("null")) { credential.setComponent(null); } fideliusService.deleteCredential(credential.getShortKey(), credential.getApplication(), credential.getEnvironment(), credential.getComponent(), tableName, user); } catch (Exception e) { this.logger.info("Credential not deleted " + e.toString()); return null; } return credential; }  @PreAuthorize("@fideliusRoleService.isAuthorized(#application, #account, \"LIST_CREDENTIALS\")") List<Credential> getAllCredentials(String tableName, String account, String region, String application); @PreAuthorize("@fideliusRoleService.isAuthorized(#application, #account, \"LIST_CREDENTIALS\")") Credential getCredential(String account, String region, String application, String longKey); @PreAuthorize("@fideliusRoleService.isAuthorized(#application, #account, \"LIST_CREDENTIALS\")") List<HistoryEntry> getCredentialHistory(String tableName, String account, String region, String application, String environment, String component, String key); @PreAuthorize("@fideliusRoleService.isAuthorized(#application, #account)") Credential getCredentialSecret(String account, String region, String application, String environment,
                                      String component, String shortKey); @PreAuthorize("@fideliusRoleService.isAuthorized(#credential.application, #credential.account)") Credential putCredential(Credential credential); @PreAuthorize("@fideliusRoleService.isAuthorized(#credential.application, #credential.account)") Credential createCredential(Credential credential); @PreAuthorize("@fideliusRoleService.isAuthorizedToDelete(#credential.getApplication(), #credential.getAccount())") Credential deleteCredential(Credential credential);  }