CXF-6925 - Make per-realm crypto configuration as flexible as the static one
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4a066425 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4a066425 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4a066425 Branch: refs/heads/master Commit: 4a066425084878cf92e968fde608fc4da1b7343c Parents: 6ee177c Author: Colm O hEigeartaigh <cohei...@apache.org> Authored: Tue May 31 16:02:44 2016 +0100 Committer: Colm O hEigeartaigh <cohei...@apache.org> Committed: Tue May 31 16:02:44 2016 +0100 ---------------------------------------------------------------------- .../cxf/sts/token/realm/RealmProperties.java | 22 ++++++++++++++------ .../apache/cxf/sts/token/realm/SAMLRealm.java | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/4a066425/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/RealmProperties.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/RealmProperties.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/RealmProperties.java index 3f5112f..dfe65c6 100644 --- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/RealmProperties.java +++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/RealmProperties.java @@ -45,7 +45,7 @@ public class RealmProperties { private String signatureAlias; private Crypto signatureCrypto; private SignatureProperties signatureProperties; - private String signaturePropertiesFile; + private Object signatureCryptoProperties; private String callbackHandlerClass; private CallbackHandler callbackHandler; @@ -93,10 +93,20 @@ public class RealmProperties { * Set the String corresponding to the signature Properties class * @param signaturePropertiesFile the String corresponding to the signature properties file */ + @Deprecated public void setSignaturePropertiesFile(String signaturePropertiesFile) { - this.signaturePropertiesFile = signaturePropertiesFile; + setSignatureCryptoProperties(signaturePropertiesFile); + } + + /** + * Set the Object corresponding to the signature Properties class. It can be a String + * corresponding to a filename, a Properties object, or a URL. + * @param signatureCryptoProperties the object corresponding to the signature properties + */ + public void setSignatureCryptoProperties(Object signatureCryptoProperties) { + this.signatureCryptoProperties = signatureCryptoProperties; if (LOG.isLoggable(Level.FINE)) { - LOG.fine("Setting signature properties: " + signaturePropertiesFile); + LOG.fine("Setting signature crypto properties: " + signatureCryptoProperties); } } @@ -122,10 +132,10 @@ public class RealmProperties { * @return the signature Crypto object */ public Crypto getSignatureCrypto() { - if (signatureCrypto == null && signaturePropertiesFile != null) { - Properties sigProperties = SecurityUtils.loadProperties(signaturePropertiesFile); + if (signatureCrypto == null && signatureCryptoProperties != null) { + Properties sigProperties = SecurityUtils.loadProperties(signatureCryptoProperties); if (sigProperties == null) { - LOG.fine("Cannot load signature properties using: " + signaturePropertiesFile); + LOG.fine("Cannot load signature properties using: " + signatureCryptoProperties); throw new STSException("Configuration error: cannot load signature properties"); } try { http://git-wip-us.apache.org/repos/asf/cxf/blob/4a066425/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/SAMLRealm.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/SAMLRealm.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/SAMLRealm.java index fe2be74..c4a1b40 100644 --- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/SAMLRealm.java +++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/SAMLRealm.java @@ -20,7 +20,7 @@ package org.apache.cxf.sts.token.realm; /** - * Use RealmProperties intead + * Use RealmProperties instead */ @Deprecated public class SAMLRealm extends RealmProperties {