用配置文件acp_sdk.properties配置路径 加载银联公钥上级证书（中级证书）
491343
private static void initEncryptCert() {
		LogUtil.writeLog("加载敏感信息加密证书==>"+SDKConfig.getConfig().getEncryptCertPath());
		if (!isEmpty(SDKConfig.getConfig().getEncryptCertPath())) {
			encryptCert = initCert(SDKConfig.getConfig().getEncryptCertPath());
			LogUtil.writeLog("Load EncryptCert Successful");
		} else {
			LogUtil.writeLog("WARN: acpsdk.encryptCert.path is empty");
		}
	}
369198
@ShellMethod(key = "add-properties", value = "Add properties associated with a CAS group/module to a Properties/Yaml configuration file.")
    public static void add(
        @ShellOption(value = {"file"},
            help = "Path to the CAS configuration file",
            defaultValue = "/etc/cas/config/cas.properties") final String file,
        @ShellOption(value = {"group"},
            help = "Group/module whose associated settings should be added to the CAS configuration file") final String group) throws Exception {

        if (StringUtils.isBlank(file)) {
            LOGGER.warn("Configuration file must be specified");
            return;
        }

        val filePath = new File(file);
        if (filePath.exists() && (filePath.isDirectory() || !filePath.canRead() || !filePath.canWrite())) {
            LOGGER.warn("Configuration file [{}] is not readable/writable or is not a path to a file", filePath.getCanonicalPath());
            return;
        }

        val results = findProperties(group);
        LOGGER.info("Located [{}] properties matching [{}]", results.size(), group);

        switch (FilenameUtils.getExtension(filePath.getName()).toLowerCase()) {
            case "properties":
                createConfigurationFileIfNeeded(filePath);
                val props = loadPropertiesFromConfigurationFile(filePath);
                writeConfigurationPropertiesToFile(filePath, results, props);
                break;
            case "yml":
                createConfigurationFileIfNeeded(filePath);
                val yamlProps = CasCoreConfigurationUtils.loadYamlProperties(new FileSystemResource(filePath));
                writeYamlConfigurationPropertiesToFile(filePath, results, yamlProps);
                break;
            default:
                LOGGER.warn("Configuration file format [{}] is not recognized", filePath.getCanonicalPath());
        }

    }
1123869
public TrxMessageHeader addMessageProperties(TrxMessageHeader trxMessageHeader)
    {
        Map<String, Object> mapHeaderMessageInfo = trxMessageHeader.getMessageInfoMap();
        Map<String, Object> propMessageInfo = ((PropertiesField)this.getField(MessageInfo.MESSAGE_PROPERTIES)).loadProperties();
        propMessageInfo.put(TrxMessageHeader.INTERNAL_MESSAGE_CLASS, this.getField(MessageInfo.MESSAGE_CLASS).toString());
        
        MessageInfoType recMessageInfoType = (MessageInfoType)((ReferenceField)this.getField(MessageInfo.MESSAGE_INFO_TYPE_ID)).getReference();
        if (recMessageInfoType != null)
            propMessageInfo.put(TrxMessageHeader.MESSAGE_INFO_TYPE, recMessageInfoType.getField(MessageInfoType.CODE).toString());
        String schemaLocation = (String)propMessageInfo.get(SCHEMA_LOCATION);
        if (schemaLocation == null)
            schemaLocation = this.getField(MessageInfo.CODE).toString();
        if (schemaLocation != null)
            propMessageInfo.put(SCHEMA_LOCATION, schemaLocation);
        
        Record recRequestType = ((ReferenceField)this.getField(MessageInfo.REQUEST_TYPE_ID)).getReference();
        if ((recRequestType != null) && (recRequestType.getEditMode() == DBConstants.EDIT_CURRENT))
            propMessageInfo.put(TrxMessageHeader.MESSAGE_REQUEST_TYPE, recRequestType.getField(RequestType.CODE).toString());
        
        if (mapHeaderMessageInfo != null)
            mapHeaderMessageInfo.putAll(propMessageInfo);
        else
            mapHeaderMessageInfo = propMessageInfo;
        trxMessageHeader.setMessageInfoMap(mapHeaderMessageInfo);
        
        return trxMessageHeader;
    }
1351159
function enableAssociatedDomains(preferences) {
    const entitlementsFile = path.join(
      preferences.projectRoot,
      "platforms",
      "ios",
      preferences.projectName,
      "Resources",
      `${preferences.projectName}.entitlements`
    );

    activateAssociativeDomains(
      preferences.iosProjectModule.xcode,
      entitlementsFile
    );
    addPbxReference(preferences.iosProjectModule.xcode, entitlementsFile);
    preferences.iosProjectModule.write();
  }
213912
private void uploadThumbImage(StorageNode client, InputStream inputStream, String masterFilename,
                                  String fileExtName) {
        ByteArrayInputStream thumbImageStream = null;
        try {
            thumbImageStream = generateThumbImageByDefault(inputStream);// getFileInputStream
            // 获取文件大小
            long fileSize = thumbImageStream.available();
            // 获取缩略图前缀
            String prefixName = thumbImageConfig.getPrefixName();
            LOGGER.debug("上传缩略图主文件={},前缀={}", masterFilename, prefixName);
            StorageUploadSlaveFileCommand command = new StorageUploadSlaveFileCommand(thumbImageStream, fileSize,
                    masterFilename, prefixName, fileExtName);
            connectionManager.executeFdfsCmd(client.getInetSocketAddress(), command);

        } catch (IOException e) {
            LOGGER.error("upload ThumbImage error", e);
            throw new FdfsUploadImageException("upload ThumbImage error", e.getCause());
        } finally {
            IOUtils.closeQuietly(thumbImageStream);
        }
    }
1213980
public void setProperties(Properties properties) {
        config.setProperties(properties);
        //注册解析器
        if (properties != null) {
            String resolveClass = properties.getProperty("resolveClass");
            if (StringUtil.isNotEmpty(resolveClass)) {
                try {
                    EntityHelper.setResolve((EntityResolve) Class.forName(resolveClass).newInstance());
                } catch (Exception e) {
                    throw new MapperException("创建 " + resolveClass + " 实例失败!", e);
                }
            }
        }
        //注册通用接口
        if (properties != null) {
            String mapper = properties.getProperty("mappers");
            if (StringUtil.isNotEmpty(mapper)) {
                String[] mappers = mapper.split(",");
                for (String mapperClass : mappers) {
                    if (mapperClass.length() > 0) {
                        registerMapper(mapperClass);
                    }
                }
            }
        }
    }
1107149
protected void configureSamlClient(final Collection<BaseClient> properties) {
        val index = new AtomicInteger();
        pac4jProperties.getSaml()
            .stream()
            .filter(saml -> StringUtils.isNotBlank(saml.getKeystorePath())
                && StringUtils.isNotBlank(saml.getIdentityProviderMetadataPath())
                && StringUtils.isNotBlank(saml.getServiceProviderEntityId())
                && StringUtils.isNotBlank(saml.getServiceProviderMetadataPath()))
            .forEach(saml -> {
                val cfg = new SAML2Configuration(saml.getKeystorePath(),
                    saml.getKeystorePassword(),
                    saml.getPrivateKeyPassword(), saml.getIdentityProviderMetadataPath());
                cfg.setMaximumAuthenticationLifetime(saml.getMaximumAuthenticationLifetime());
                cfg.setServiceProviderEntityId(saml.getServiceProviderEntityId());
                cfg.setServiceProviderMetadataPath(saml.getServiceProviderMetadataPath());
                cfg.setAuthnRequestBindingType(saml.getDestinationBinding());
                cfg.setForceAuth(saml.isForceAuth());
                cfg.setPassive(saml.isPassive());
                cfg.setSignMetadata(saml.isSignServiceProviderMetadata());

                if (StringUtils.isNotBlank(saml.getPrincipalIdAttribute())) {
                    cfg.setAttributeAsId(saml.getPrincipalIdAttribute());
                }
                cfg.setWantsAssertionsSigned(saml.isWantsAssertionsSigned());
                cfg.setLogoutHandler(casServerSpecificLogoutHandler);
                cfg.setUseNameQualifier(saml.isUseNameQualifier());
                cfg.setAttributeConsumingServiceIndex(saml.getAttributeConsumingServiceIndex());
                if (saml.getAssertionConsumerServiceIndex() >= 0) {
                    cfg.setAssertionConsumerServiceIndex(saml.getAssertionConsumerServiceIndex());
                }
                if (StringUtils.isNotBlank(saml.getAuthnContextClassRef())) {
                    cfg.setComparisonType(saml.getAuthnContextComparisonType().toUpperCase());
                    cfg.setAuthnContextClassRef(saml.getAuthnContextClassRef());
                }
                if (StringUtils.isNotBlank(saml.getKeystoreAlias())) {
                    cfg.setKeystoreAlias(saml.getKeystoreAlias());
                }
                if (StringUtils.isNotBlank(saml.getNameIdPolicyFormat())) {
                    cfg.setNameIdPolicyFormat(saml.getNameIdPolicyFormat());
                }

                if (!saml.getRequestedAttributes().isEmpty()) {
                    saml.getRequestedAttributes().stream()
                        .map(attribute -> new SAML2ServiceProvicerRequestedAttribute(attribute.getName(), attribute.getFriendlyName(),
                            attribute.getNameFormat(), attribute.isRequired()))
                        .forEach(attribute -> cfg.getRequestedServiceProviderAttributes().add(attribute));
                }

                val mappedAttributes = saml.getMappedAttributes();
                if (!mappedAttributes.isEmpty()) {
                    val results = mappedAttributes
                        .stream()
                        .collect(Collectors.toMap(Pac4jSamlClientProperties.ServiceProviderMappedAttribute::getName,
                            Pac4jSamlClientProperties.ServiceProviderMappedAttribute::getMappedTo));
                    cfg.setMappedAttributes(results);
                }

                val client = new SAML2Client(cfg);

                val count = index.intValue();
                if (StringUtils.isBlank(saml.getClientName())) {
                    client.setName(client.getClass().getSimpleName() + count);
                }
                configureClient(client, saml);

                index.incrementAndGet();
                LOGGER.debug("Created delegated client [{}]", client);
                properties.add(client);
            });
    }
197118
public synchronized void persistProperties(Properties properties, File propsFile, String message) {
    Properties toWrite = new Properties();
    for(String key : properties.stringPropertyNames()) {

      if(System.getProperties().containsKey(key) && !properties.getProperty(key).equals(System.getProperty(key))) {

        toWrite.setProperty(key, properties.getProperty(key));
      } 
      else if(System.getenv().containsKey(key) && !properties.getProperty(key).equals(System.getenv(key))) {

        toWrite.setProperty(key, properties.getProperty(key));
      } 
      else if(!System.getProperties().containsKey(key) && !System.getenv().containsKey(key)){

        toWrite.setProperty(key, properties.getProperty(key));
      }
    }
    writer.persistProperties(toWrite, propsFile, message, log);
  }
450690
private void initializeSignProperties() {
        if (!signPackage && !signChanges) {
            return;
        }

        if (key != null && keyring != null && passphrase != null) {
            return;
        }

        Map<String, String> properties =
                readPropertiesFromActiveProfiles(signCfgPrefix, KEY, KEYRING, PASSPHRASE);

        key = lookupIfEmpty(key, properties, KEY);
        keyring = lookupIfEmpty(keyring, properties, KEYRING);
        passphrase = decrypt(lookupIfEmpty(passphrase, properties, PASSPHRASE));

        if (keyring == null) {
            try {
                keyring = Utils.guessKeyRingFile().getAbsolutePath();
                console.info("Located keyring at " + keyring);
            } catch (FileNotFoundException e) {
                console.warn(e.getMessage());
            }
        }
    }
1068744
private Response addSpaceACLsToResponse(ResponseBuilder response,
                                            String spaceID,
                                            String storeID)
        throws ResourceException {
        Map<String, String> aclProps = new HashMap<String, String>();
        Map<String, AclType> acls = spaceResource.getSpaceACLs(spaceID,
                                                               storeID);
        for (String key : acls.keySet()) {
            aclProps.put(key, acls.get(key).name());
        }
        return addPropertiesToResponse(response, aclProps);
    }
663142
public void addPayloadProperty(Object msg, Map<String,Object> properties, String key)
    {
        String name = "get" + key;
        try {
            Method method = msg.getClass().getMethod(name, EMPTY_PARAMS);
            if (method != null)
            {
                Object value = method.invoke(msg, EMPTY_DATA);
                if (value != null)
                {
                    if (value.getClass().getName().contains("ErrorsType"))
                        this.addErrorsProperties(properties, value);
                    else
                        properties.put(key, value);
                }
            }
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            // Ignore this error
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
145577
private void saveToPropertyVfsBundle() throws CmsException {

        for (Locale l : m_changedTranslations) {
            SortedProperties props = m_localizations.get(l);
            LockedFile f = m_lockedBundleFiles.get(l);
            if ((null != props) && (null != f)) {
                try {
                    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                    Writer writer = new OutputStreamWriter(outputStream, f.getEncoding());
                    props.store(writer, null);
                    byte[] contentBytes = outputStream.toByteArray();
                    CmsFile file = f.getFile();
                    file.setContents(contentBytes);
                    String contentEncodingProperty = m_cms.readPropertyObject(
                        file,
                        CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING,
                        false).getValue();
                    if ((null == contentEncodingProperty) || !contentEncodingProperty.equals(f.getEncoding())) {
                        m_cms.writePropertyObject(
                            m_cms.getSitePath(file),
                            new CmsProperty(
                                CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING,
                                f.getEncoding(),
                                f.getEncoding()));
                    }
                    m_cms.writeFile(file);
                } catch (IOException e) {
                    LOG.error(
                        Messages.get().getBundle().key(
                            Messages.ERR_READING_FILE_UNSUPPORTED_ENCODING_2,
                            f.getFile().getRootPath(),
                            f.getEncoding()),
                        e);

                }
            }
        }
    }
265723
function handleSSLProperties (config) {
  const sslFiles = ['sslKey', 'sslCert', 'sslDHParams']
  let key
  let resolvedFilePath
  let filePath
  for (let i = 0; i < sslFiles.length; i++) {
    key = sslFiles[i]
    filePath = config[key]
    if (!filePath) {
      continue
    }
    resolvedFilePath = fileUtils.lookupConfRequirePath(filePath)
    try {
      config[key] = fs.readFileSync(resolvedFilePath, 'utf8')
    } catch (e) {
      throw new Error(`The file path "${resolvedFilePath}" provided by "${key}" does not exist.`)
    }
  }
}
754513
def _add_new_repo(repo, properties):
    '''
    
    '''
    repostr = '# ' if not properties.get('enabled') else ''
    repostr += 'src/gz ' if properties.get('compressed') else 'src '
    if ' ' in repo:
        repostr += '"' + repo + '" '
    else:
        repostr += repo + ' '
    repostr += properties.get('uri')
    repostr = _set_trusted_option_if_needed(repostr, properties.get('trusted'))
    repostr += '\n'
    conffile = os.path.join(OPKG_CONFDIR, repo + '.conf')

    with salt.utils.files.fopen(conffile, 'a') as fhandle:
        fhandle.write(salt.utils.stringutils.to_str(repostr))
1243730
private void addPropertiesFromFile(final SystemProperties config, final ServletContext context) {
        String fileLocation = StringUtils.replaceVariables(config.getFile(), new HashMap<String, Object>(), true);
        InputStream inStream = null;
        try {
            inStream = getStreamForLocation(fileLocation, context);
            Properties propsFromFile = new Properties();
            propsFromFile.load(inStream);
            for (String prop : propsFromFile.stringPropertyNames()) {
                String propertyValue = propsFromFile.getProperty(prop);
                if (propertyValue != null && (config.isOverrideProperties() || (System.getProperty(prop) == null))) {
                    System.setProperty(prop, propertyValue);
                }
            }
        } catch (FileNotFoundException e) {
            if (!config.isIgnoreMissingFile()) { 
                throw new IllegalStateException("Could not find properties file: " + fileLocation, e);
            }
        } catch (IOException e) {
            if (!config.isIgnoreMissingFile()) { 
                throw new IllegalStateException("Error occurred when reading properties file: " + fileLocation, e);
            }
        } finally {
            if (inStream != null) {
                try {
                    inStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
313243
function Pa () {

  var paFile = path.resolve('package.json');

  var writePackageJson = function (json) {
    fs.writeFileSync(paFile, JSON.stringify(json, null, 2));
  };

  this.init = function () {
    this.pkg = require(paFile);
    return this;
  };

  this.get = function (key) {
    var val = this.pkg[key] || this.pkg[require('./alias').init().aliases[key]];
    if (typeof val === 'undefined') {
      return ('can not read property ' + key + ' from package.json').red;
    }
    return (typeof val === 'object' ? JSON.stringify(val, null, 2) : val).green;
  };

  this.set = function (key, value) {
    key = this.pkg[key] ? key : require('./alias').init().aliases[key];
    this.pkg[key] = value;
    writePackageJson(this.pkg);
    return ("set key '" + key + "' to value '" + value + "'").green;
  };

  this.trigger = function (argv) {
    switch (argv._.length) {
      case 0:
        return JSON.stringify(this.pkg, null, 2).green;
      case 1:
        return this.get(argv._[0]);
      case 2:
        return this.set(argv._[0], argv._[1]);
      default:
        return "something bad happened, just run 'pa [key] [value]' to set the new value in your package.json";
    }

  };

}
1002975
private List<String> updateProperties(FSAConfigProperties configProps, CommandLineArgs commandLineArgs) {
        // Check whether the user inserted api key, project OR/AND product via command line
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.ORG_TOKEN_PROPERTY_KEY, commandLineArgs.apiKey);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.UPDATE_TYPE, commandLineArgs.updateType);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.PRODUCT_NAME_PROPERTY_KEY, commandLineArgs.product);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.PRODUCT_VERSION_PROPERTY_KEY, commandLineArgs.productVersion);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.PROJECT_VERSION_PROPERTY_KEY, commandLineArgs.projectVersion);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.USER_KEY_PROPERTY_KEY, commandLineArgs.userKey);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.PROJECT_TOKEN_PROPERTY_KEY, commandLineArgs.projectToken);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.PRODUCT_TOKEN_PROPERTY_KEY, commandLineArgs.productToken);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.LOG_LEVEL_KEY, commandLineArgs.logLevel);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.SEND_LOGS_TO_WSS, commandLineArgs.sendLogsToWss);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.SCAN_COMMENT, commandLineArgs.scanComment);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.LOG_CONTEXT, commandLineArgs.logContext);
//        readPropertyFromCommandLine(configProps, SERVICE_URL_KEYWORD, commandLineArgs.wssUrl);
        // request file
        List<String> offlineRequestFiles = new LinkedList<>();
        offlineRequestFiles.addAll(commandLineArgs.requestFiles);
        if (offlineRequestFiles.size() > 0) {
            configProps.put(ConfigPropertyKeys.OFFLINE_PROPERTY_KEY, FALSE);
        }
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.OFFLINE_PROPERTY_KEY, commandLineArgs.offline);
        //Impact Analysis parameters
        readListFromCommandLine(configProps, ConfigPropertyKeys.APP_PATH, commandLineArgs.appPath);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.VIA_DEBUG, commandLineArgs.viaDebug);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.VIA_ANALYSIS_LEVEL, commandLineArgs.viaLevel);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.ENABLE_IMPACT_ANALYSIS, commandLineArgs.enableImpactAnalysis);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.IA_LANGUAGE, commandLineArgs.iaLanguage);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.X_PATHS, commandLineArgs.xPaths);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.ANALYZE_MULTI_MODULE, commandLineArgs.analyzeMultiModule);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.X_MODULE_PATH, commandLineArgs.xModulePath);
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.ADD_SHA1, commandLineArgs.addSha1);

        // proxy
        if (commandLineArgs.proxy == null) {
            readPropertyFromCommandLine(configProps, ConfigPropertyKeys.PROXY_HOST_PROPERTY_KEY, commandLineArgs.proxyHost);
            readPropertyFromCommandLine(configProps, ConfigPropertyKeys.PROXY_PORT_PROPERTY_KEY, commandLineArgs.proxyPort);
            readPropertyFromCommandLine(configProps, ConfigPropertyKeys.PROXY_USER_PROPERTY_KEY, commandLineArgs.proxyUser);
            readPropertyFromCommandLine(configProps, ConfigPropertyKeys.PROXY_PASS_PROPERTY_KEY, commandLineArgs.proxyPass);
        } else {
            List<String> errors = new ArrayList<>();
            String[] parsedProxy = parseProxy(commandLineArgs.proxy, errors);
            if (errors.isEmpty()) {
                readPropertyFromCommandLine(configProps, ConfigPropertyKeys.PROXY_HOST_PROPERTY_KEY, parsedProxy[0]);
                readPropertyFromCommandLine(configProps, ConfigPropertyKeys.PROXY_PORT_PROPERTY_KEY, parsedProxy[1]);
                readPropertyFromCommandLine(configProps, ConfigPropertyKeys.PROXY_USER_PROPERTY_KEY, parsedProxy[2]);
                readPropertyFromCommandLine(configProps, ConfigPropertyKeys.PROXY_PASS_PROPERTY_KEY, parsedProxy[3]);
            }
        }

        // archiving
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.ARCHIVE_FAST_UNPACK_KEY, commandLineArgs.archiveFastUnpack);

        // project per folder
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.PROJECT_PER_SUBFOLDER, commandLineArgs.projectPerFolder);

        // Check whether the user inserted scmRepositoriesFile via command line
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.SCM_REPOSITORIES_FILE, commandLineArgs.repositoriesFile);

        // User-entry of a flag that overrides default FSA process termination
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.REQUIRE_KNOWN_SHA1, commandLineArgs.requireKnownSha1);

        // docker flag to scan docker images
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.SCAN_DOCKER_IMAGES, commandLineArgs.scanDockerImages);

        //docker flag to scan docker images by using docker or tar files folder (which specified with parameter -d)
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.SCAN_TAR_IMAGES, commandLineArgs.scanDockerImages);

        //docker flag to delete tar images files after extracting
        readPropertyFromCommandLine(configProps, ConfigPropertyKeys.DELETE_TAR_FILES, commandLineArgs.scanDockerImages);

        return offlineRequestFiles;
    }