Package com.denimgroup.threadfix.data.entities

Examples of com.denimgroup.threadfix.data.entities.RemoteProviderType


        VeracodeRemoteProvider provider = new VeracodeRemoteProvider();
        bridge.injectDependenciesManually(provider);

        provider.utils = new VeracodeMockHttpUtils();

        RemoteProviderType type = new RemoteProviderType();
        type.setUsername(VeracodeMockHttpUtils.GOOD_USERNAME);
        type.setPassword(VeracodeMockHttpUtils.GOOD_PASSWORD);

        provider.setRemoteProviderType(type);
        provider.setChannel(new ApplicationChannel());

        List<Scan> scans = provider.getScans(getApplication(type, nativeName));
View Full Code Here


        QualysRemoteProvider provider = new QualysRemoteProvider();
        bridge.injectDependenciesManually(provider);

        provider.utils = new QualysMockHttpUtils();

        RemoteProviderType type = new RemoteProviderType();
        type.setUsername(QualysMockHttpUtils.GOOD_USERNAME);
        type.setPassword(QualysMockHttpUtils.GOOD_PASSWORD);

        provider.setRemoteProviderType(type);
        provider.setChannel(new ApplicationChannel());

        List<Scan> scans = provider.getScans(getApplication(type, nativeName));
View Full Code Here

    public static RemoteProvider getVeracodeImporterWithMock(String username, String password) {
        VeracodeRemoteProvider provider = new VeracodeRemoteProvider();

        provider.utils = new VeracodeMockHttpUtils();

        RemoteProviderType type = new RemoteProviderType();
        type.setUsername(username);
        type.setPassword(password);

        provider.setRemoteProviderType(type);

        return provider;
    }
View Full Code Here

    public static RemoteProvider getQualysImporterWithMock(String username, String password) {
        QualysRemoteProvider provider = new QualysRemoteProvider();

        provider.utils = new QualysMockHttpUtils();

        RemoteProviderType type = new RemoteProviderType();
        type.setUsername(username);
        type.setPassword(password);

        provider.setRemoteProviderType(type);

        return provider;
    }
View Full Code Here

        WhiteHatRemoteProvider provider = new WhiteHatRemoteProvider();
        bridge.injectDependenciesManually(provider);

        provider.utils = new WhiteHatMockHttpUtils();

        RemoteProviderType type = new RemoteProviderType();
        type.setApiKey(WhiteHatMockHttpUtils.GOOD_API_KEY);
        type.setMatchSourceNumbers(matchNumbers);

        provider.setRemoteProviderType(type);

        List<Scan> scans = provider.getScans(getApplication(WhiteHatMockHttpUtils.GOOD_API_KEY, nativeName, type));
View Full Code Here

    public static RemoteProvider getWhiteHatImporterWithMock(String apiKey) {
        WhiteHatRemoteProvider provider = new WhiteHatRemoteProvider();

        provider.utils = new WhiteHatMockHttpUtils();

        RemoteProviderType type = new RemoteProviderType();
        type.setApiKey(apiKey);

        provider.setRemoteProviderType(type);

        return provider;
    }
View Full Code Here

  @Override
  @Transactional
  public ResponseCode importScansForApplications(Integer remoteProviderTypeId) {
   
    RemoteProviderType type = load(remoteProviderTypeId);
   
    if (type == null) {
      log.error("Type was null, Remote Provider import failed.");
      return ResponseCode.BAD_ID;
    } else {
     
      decryptCredentials(type);
     
      List<RemoteProviderApplication> applications = type.getRemoteProviderApplications();
     
      if (applications == null || applications.isEmpty()) {
        log.error("No applications found, Remote Provider import failed.");
        return ResponseCode.NO_APPS;
      } else {
View Full Code Here

 
  @Override
  public ResponseCode checkConfiguration(String username, String password, String apiKey, String matchSourceNumber,
                                           String platform, int typeId) {
   
    RemoteProviderType databaseRemoteProviderType = load(typeId);

        boolean matchSourceNumberBoolean = "true".equals(matchSourceNumber);

    if (databaseRemoteProviderType == null) {
      return ResponseCode.BAD_ID;
    }
   
    databaseRemoteProviderType = decryptCredentials(databaseRemoteProviderType);
   
    // TODO test this
    // If the username hasn't changed but the password has, update the apps instead of deleting them.
   
    if (databaseRemoteProviderType.getHasUserNamePassword() &&
        username != null && password != null &&
        username.equals(databaseRemoteProviderType.getUsername()) &&
        !password.equals(USE_OLD_PASSWORD) &&
        !password.equals(databaseRemoteProviderType.getPassword())) {
     
      log.warn("Provider password has changed, updating applications.");
     
      databaseRemoteProviderType.setPassword(password);
      databaseRemoteProviderType.setPlatform(platform);
            databaseRemoteProviderType.setMatchSourceNumbers(matchSourceNumberBoolean);
      remoteProviderApplicationService.updateApplications(databaseRemoteProviderType);
      store(databaseRemoteProviderType);
      return ResponseCode.SUCCESS;
     
    } else if (databaseRemoteProviderType.getHasApiKey() &&
        apiKey != null && !apiKey.startsWith(USE_OLD_PASSWORD) &&
        !apiKey.equals(databaseRemoteProviderType.getApiKey())
        ||
        databaseRemoteProviderType.getHasUserNamePassword() &&
        username != null &&
        !username.equals(databaseRemoteProviderType.getUsername())) {
     
      databaseRemoteProviderType.setApiKey(apiKey);
      databaseRemoteProviderType.setUsername(username);
      databaseRemoteProviderType.setPassword(password);
            databaseRemoteProviderType.setPlatform(platform);
            databaseRemoteProviderType.setMatchSourceNumbers(matchSourceNumberBoolean);

            List<RemoteProviderApplication> apps = remoteProviderApplicationService
                          .getApplications(databaseRemoteProviderType);
     
      if (apps == null) {
       
        return ResponseCode.NO_APPS;

      } else {
        log.warn("Provider username has changed, deleting old apps.");
       
        remoteProviderApplicationService.deleteApps(databaseRemoteProviderType);

        databaseRemoteProviderType.setRemoteProviderApplications(apps);
       
        for (RemoteProviderApplication remoteProviderApplication :
            databaseRemoteProviderType.getRemoteProviderApplications()) {
          remoteProviderApplicationService.store(remoteProviderApplication);
        }
               
        store(encryptCredentials(databaseRemoteProviderType));
        return ResponseCode.SUCCESS;
      }
    } else if (databaseRemoteProviderType.getMatchSourceNumbers() == null ||
                databaseRemoteProviderType.getMatchSourceNumbers() != matchSourceNumberBoolean) {

            databaseRemoteProviderType.setMatchSourceNumbers(matchSourceNumberBoolean);
            store(databaseRemoteProviderType);
            return ResponseCode.SUCCESS;

        } else {
      log.info("No change was made to the credentials.");
View Full Code Here

    }
  }

  @Override
  public void clearConfiguration(int id) {
    RemoteProviderType type = load(id);
   
    if (type != null) {
      type.setEncrypted(false);
      type.setEncryptedApiKey(null);
      type.setEncryptedUsername(null);
      type.setEncryptedPassword(null);
      if (type.getRemoteProviderApplications() != null) {
        remoteProviderApplicationService.deleteApps(type);
      }
     
      store(type);
    }
View Full Code Here

    model.addAttribute("successMessage", ControllerUtils.getSuccessMessage(request));
    model.addAttribute("errorMessage", ControllerUtils.getErrorMessage(request));
    PermissionUtils.filterApps(typeList);

    model.addAttribute("remoteProviders", typeList);
    model.addAttribute("remoteProviderType", new RemoteProviderType());
    model.addAttribute("remoteProviderApplication", new RemoteProviderApplication());
    model.addAttribute("organizationList", organizationService.loadAllActiveFilter());

        PermissionUtils.addPermissions(model, null, null, Permission.CAN_MANAGE_REMOTE_PROVIDERS, Permission.CAN_UPLOAD_SCANS);
    return "config/remoteproviders/index";
View Full Code Here

TOP

Related Classes of com.denimgroup.threadfix.data.entities.RemoteProviderType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.