fidelius-service/src/main/java/org/finra/fidelius/services/CredentialsService.java
@PreAuthorize("@fideliusRoleService.isAuthorized(#credential.application, #credential.account)")
    public Credential createCredential(Credential credential) {

        // Check if the credential to be created already has a history
        List<HistoryEntry> existingCredentials = getCredentialHistory(tableName,
                credential.getAccount(), credential.getRegion(), credential.getApplication(), credential.getEnvironment(),
                credential.getComponent(), credential.getShortKey(), false);
        if (!existingCredentials.isEmpty()) {
            throw new FideliusException("Credential already exists!", HttpStatus.BAD_REQUEST);
        }

        // Add the new credential
        return putCredential(credential);
    }
/**
     * Wrapper for putCredential used for creating new Credentials
     *
     * @param credential Credential to be created
     * @return Credential created
     */
Wrapper for putCredential used for creating new Credentials
@param credential Credential to be created
@return Credential created
Wrapper for putCredential used for creating new Credentials @param credential Credential to be created @return Credential created
@PreAuthorize("@fideliusRoleService.isAuthorized(#credential.application, #credential.account)")
    public Credential createCredential(Credential credential) {
        List<HistoryEntry> existingCredentials = getCredentialHistory(tableName,
                credential.getAccount(), credential.getRegion(), credential.getApplication(), credential.getEnvironment(),
                credential.getComponent(), credential.getShortKey(), false);
        if (!existingCredentials.isEmpty()) {
            throw new FideliusException("Credential already exists!", HttpStatus.BAD_REQUEST);
        }
        return putCredential(credential);
    }
@ PreAuthorize ( "@fideliusRoleService.isAuthorized(#credential.application, #credential.account)" ) public Credential createCredential ( Credential credential ) { List < HistoryEntry > existingCredentials = getCredentialHistory ( tableName , credential . getAccount ( ) , credential . getRegion ( ) , credential . getApplication ( ) , credential . getEnvironment ( ) , credential . getComponent ( ) , credential . getShortKey ( ) , false ) ; if ( ! existingCredentials . isEmpty ( ) ) { throw new FideliusException ( "Credential already exists!" , HttpStatus . BAD_REQUEST ) ; } return putCredential ( credential ) ; }
Wrapper for putCredential used for creating new Credentials
 @param credential Credential to be created
 @return Credential created
Wrapper for putCredential used for creating new Credentials @param credential Credential to be created @return Credential created
// Check if the credential to be created already has a history // Add the new credential