in ws-security-stax/src/main/java/org/apache/wss4j/stax/setup/ConfigurationConverter.java [472:622]
public static void parseNonBooleanProperties(
Map<String, Object> config,
WSSSecurityProperties properties
) {
String pwType = getString(ConfigurationConstants.PASSWORD_TYPE, config);
if ("PasswordDigest".equals(pwType)) {
properties.setUsernameTokenPasswordType(UsernameTokenPasswordType.PASSWORD_DIGEST);
} else if ("PasswordText".equals(pwType)) {
properties.setUsernameTokenPasswordType(UsernameTokenPasswordType.PASSWORD_TEXT);
} else if ("PasswordNone".equals(pwType)) {
properties.setUsernameTokenPasswordType(UsernameTokenPasswordType.PASSWORD_NONE);
}
String signatureKeyIdentifier = getString(ConfigurationConstants.SIG_KEY_ID, config);
WSSecurityTokenConstants.KeyIdentifier convSigKeyIdentifier =
convertKeyIdentifier(signatureKeyIdentifier);
if (convSigKeyIdentifier != null) {
properties.setSignatureKeyIdentifier(convSigKeyIdentifier);
}
String sigAlgo = getString(ConfigurationConstants.SIG_ALGO, config);
properties.setSignatureAlgorithm(sigAlgo);
String sigDigestAlgo = getString(ConfigurationConstants.SIG_DIGEST_ALGO, config);
properties.setSignatureDigestAlgorithm(sigDigestAlgo);
String sigC14nAlgo = getString(ConfigurationConstants.SIG_C14N_ALGO, config);
properties.setSignatureCanonicalizationAlgorithm(sigC14nAlgo);
Object sigParts = config.get(ConfigurationConstants.SIGNATURE_PARTS);
configureParts(sigParts, properties, sigDigestAlgo, true, true);
sigParts = config.get(ConfigurationConstants.OPTIONAL_SIGNATURE_PARTS);
configureParts(sigParts, properties, sigDigestAlgo, false, true);
String iterations = getString(ConfigurationConstants.DERIVED_KEY_ITERATIONS, config);
if (iterations != null) {
int iIterations = Integer.parseInt(iterations);
properties.setDerivedKeyIterations(iIterations);
}
String encKeyIdentifier = getString(ConfigurationConstants.ENC_KEY_ID, config);
WSSecurityTokenConstants.KeyIdentifier convEncKeyIdentifier =
convertKeyIdentifier(encKeyIdentifier);
if (convEncKeyIdentifier != null) {
properties.setEncryptionKeyIdentifier(convEncKeyIdentifier);
}
Object encParts = config.get(ConfigurationConstants.ENCRYPTION_PARTS);
configureParts(encParts, properties, null, true, false);
encParts = config.get(ConfigurationConstants.OPTIONAL_ENCRYPTION_PARTS);
configureParts(encParts, properties, null, false, false);
String encSymcAlgo = getString(ConfigurationConstants.ENC_SYM_ALGO, config);
properties.setEncryptionSymAlgorithm(encSymcAlgo);
String encKeyTransport = getString(ConfigurationConstants.ENC_KEY_TRANSPORT, config);
properties.setEncryptionKeyTransportAlgorithm(encKeyTransport);
String encDigestAlgo = getString(ConfigurationConstants.ENC_DIGEST_ALGO, config);
properties.setEncryptionKeyTransportDigestAlgorithm(encDigestAlgo);
String encMGFAlgo = getString(ConfigurationConstants.ENC_MGF_ALGO, config);
properties.setEncryptionKeyTransportMGFAlgorithm(encMGFAlgo);
// Subject Cert Constraints
String certConstraints =
getString(ConfigurationConstants.SIG_SUBJECT_CERT_CONSTRAINTS, config);
if (certConstraints != null) {
String certConstraintsSeparator =
getString(ConfigurationConstants.SIG_CERT_CONSTRAINTS_SEPARATOR, config);
if (certConstraintsSeparator == null || certConstraintsSeparator.isEmpty()) {
certConstraintsSeparator = ",";
}
Collection<Pattern> subjectCertConstraints =
getCertConstraints(certConstraints, certConstraintsSeparator);
properties.setSubjectCertConstraints(subjectCertConstraints);
}
// Subject Cert Constraints
String issuerCertConstraintsString =
getString(ConfigurationConstants.SIG_ISSUER_CERT_CONSTRAINTS, config);
if (issuerCertConstraintsString != null) {
String certConstraintsSeparator =
getString(ConfigurationConstants.SIG_CERT_CONSTRAINTS_SEPARATOR, config);
if (certConstraintsSeparator == null || certConstraintsSeparator.isEmpty()) {
certConstraintsSeparator = ",";
}
Collection<Pattern> issuerCertConstraints =
getCertConstraints(certConstraints, certConstraintsSeparator);
properties.setIssuerDNConstraints(issuerCertConstraints);
}
properties.setUtTTL(decodeTimeToLive(config, false));
properties.setUtFutureTTL(decodeFutureTimeToLive(config, false));
properties.setTimestampTTL(decodeTimeToLive(config, true));
properties.setTimeStampFutureTTL(decodeFutureTimeToLive(config, true));
@SuppressWarnings("unchecked")
final Map<QName, Validator> validatorMap =
(Map<QName, Validator>)config.get(ConfigurationConstants.VALIDATOR_MAP);
if (validatorMap != null) {
for (Map.Entry<QName, Validator> entry : validatorMap.entrySet()) {
properties.addValidator(entry.getKey(), entry.getValue());
}
}
ReplayCache nonceCache = //NOPMD
(ReplayCache)config.get(ConfigurationConstants.NONCE_CACHE_INSTANCE);
if (nonceCache != null) {
properties.setNonceReplayCache(nonceCache);
}
ReplayCache timestampCache = //NOPMD
(ReplayCache)config.get(ConfigurationConstants.TIMESTAMP_CACHE_INSTANCE);
if (timestampCache != null) {
properties.setTimestampReplayCache(timestampCache);
}
ReplayCache samlOneTimeUseCache = //NOPMD
(ReplayCache)config.get(ConfigurationConstants.SAML_ONE_TIME_USE_CACHE_INSTANCE);
if (samlOneTimeUseCache != null) {
properties.setSamlOneTimeUseReplayCache(samlOneTimeUseCache);
}
String derivedSignatureKeyLength = getString(ConfigurationConstants.DERIVED_SIGNATURE_KEY_LENGTH, config);
if (derivedSignatureKeyLength != null) {
int sigLength = Integer.parseInt(derivedSignatureKeyLength);
properties.setDerivedSignatureKeyLength(sigLength);
}
String derivedEncryptionKeyLength = getString(ConfigurationConstants.DERIVED_ENCRYPTION_KEY_LENGTH, config);
if (derivedEncryptionKeyLength != null) {
int encLength = Integer.parseInt(derivedEncryptionKeyLength);
properties.setDerivedEncryptionKeyLength(encLength);
}
String derivedTokenReference = getString(ConfigurationConstants.DERIVED_TOKEN_REFERENCE, config);
WSSConstants.DerivedKeyTokenReference convertedDerivedTokenReference =
convertDerivedReference(derivedTokenReference);
if (convertedDerivedTokenReference != null) {
properties.setDerivedKeyTokenReference(convertedDerivedTokenReference);
}
String derivedKeyIdentifier = getString(ConfigurationConstants.DERIVED_TOKEN_KEY_ID, config);
WSSecurityTokenConstants.KeyIdentifier convertedDerivedKeyIdentifier =
convertKeyIdentifier(derivedKeyIdentifier);
if (convertedDerivedKeyIdentifier != null) {
properties.setDerivedKeyKeyIdentifier(convertedDerivedKeyIdentifier);
}
}