public class CommonUtil extends Object
| Constructor and Description |
|---|
CommonUtil() |
| Modifier and Type | Method and Description |
|---|---|
static org.opensaml.xml.XMLObject |
buildXMLObject(QName objectQName)
Builds the requested XMLObject.
|
protected static SAMLTokenIssuerConfig |
createTokenIssuerConfiguration(org.apache.axiom.om.OMElement configElement) |
protected static SAMLTokenIssuerConfig |
createTokenIssuerConfiguration(org.apache.axis2.description.Parameter messageContextParameter) |
protected static SAMLTokenIssuerConfig |
createTokenIssuerConfiguration(String configFile) |
static org.opensaml.xml.signature.KeyInfo |
getCertificateBasedKeyInfo(X509Certificate certificate)
Creates the certificate based KeyInfo object.
|
static X509Certificate |
getCertificateByAlias(org.apache.ws.security.components.crypto.Crypto crypto,
String alias)
Gets the certificates chain by alias.
|
static X509Certificate[] |
getCertificatesByAlias(org.apache.ws.security.components.crypto.Crypto crypto,
String alias)
Gets the certificates chain by alias.
|
static org.apache.ws.security.components.crypto.Crypto |
getCrypto(Properties properties,
ClassLoader classLoader)
Constructs crypto configuration based on the given properties.
|
static org.apache.ws.security.components.crypto.Crypto |
getCrypto(String propertiesFile,
ClassLoader classLoader)
Constructs crypto configuration based on the given properties.
|
static byte[] |
getDecryptedBytes(CallbackHandler callbackHandler,
org.apache.ws.security.components.crypto.Crypto crypto,
Node encryptedKeyElement)
Decrypts the EncryptedKey element and returns the secret that was used.
|
static Document |
getOMDOMDocument()
This method creates a DOM compatible Axiom document.
|
static SAMLCallbackHandler |
getSAMLCallbackHandler(SAMLTokenIssuerConfig tokenIssuerConfiguration,
RahasData data)
Gets the SAML callback handler.
|
static org.opensaml.xml.signature.KeyInfo |
getSymmetricKeyBasedKeyInfo(Document doc,
RahasData data,
X509Certificate serviceCert,
int keySize,
org.apache.ws.security.components.crypto.Crypto crypto,
int keyComputation)
This method creates KeyInfo element of an assertion.
|
static SAMLTokenIssuerConfig |
getTokenIssuerConfiguration(org.apache.axiom.om.OMElement configElement,
String configFile,
org.apache.axis2.description.Parameter messageContextParameter)
Creates the token issuer configuration.
|
public static Document getOMDOMDocument() throws TrustException
TrustException - If an error occurred while creating the Document.public static X509Certificate getCertificateByAlias(org.apache.ws.security.components.crypto.Crypto crypto, String alias) throws TrustException
crypto - Crypto to lookup certificate.alias - Alias name.TrustException - If an error occurred
while retrieving the certificate or if no certificates are found for given alias.public static X509Certificate[] getCertificatesByAlias(org.apache.ws.security.components.crypto.Crypto crypto, String alias) throws TrustException
crypto - Crypto to lookup certificate.alias - Alias name.TrustException - If an error occurred
while retrieving the certificate.public static byte[] getDecryptedBytes(CallbackHandler callbackHandler, org.apache.ws.security.components.crypto.Crypto crypto, Node encryptedKeyElement) throws org.apache.ws.security.WSSecurityException
callbackHandler - Callback handler to pass to WSS4J framework.crypto - To get private key information.encryptedKeyElement - The encrypted Key element.org.apache.ws.security.WSSecurityException - If an error is occurred while decrypting the element.public static org.apache.ws.security.components.crypto.Crypto getCrypto(Properties properties, ClassLoader classLoader) throws TrustException
properties - Crypto configuration properties.classLoader - Class loader used to create provider.TrustException - If an error occurred while creating the Crypto object.public static org.apache.ws.security.components.crypto.Crypto getCrypto(String propertiesFile, ClassLoader classLoader) throws TrustException
propertiesFile - Crypto configuration properties file name.classLoader - Class loader used to create provider.TrustException - If an error occurred while creating the Crypto object.public static SAMLTokenIssuerConfig getTokenIssuerConfiguration(org.apache.axiom.om.OMElement configElement, String configFile, org.apache.axis2.description.Parameter messageContextParameter) throws TrustException
<saml-issuer-config>
<issuerName>Test_STS</issuerName>
<issuerKeyAlias>ip</issuerKeyAlias>
<issuerKeyPassword>password</issuerKeyPassword>
<cryptoProperties>
<crypto provider="org.apache.ws.security.components.crypto.Merlin">
<property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</property>
<property name="org.apache.ws.security.crypto.merlin.file">META-INF/rahas-sts.jks</property>
<property name="org.apache.ws.security.crypto.merlin.keystore.password">password</property>
</crypto>
</cryptoProperties>
<timeToLive>300000</timeToLive>
<keySize>256</keySize>
<addRequestedAttachedRef />
<addRequestedUnattachedRef />
<keyComputation>2</keyComputation>
<proofKeyType>BinarySecret</proofKeyType>
<trusted-services>
<service alias="bob">http://localhost:8080/axis2/services/STS</service>
</trusted-services>
</saml-issuer-config>configElement - Configuration as an OMElement.configFile - Configuration as a file.messageContextParameter - Configuration as a message context parameter.TrustException - If an error occurred while creating SAMLTokenIssuerConfig object.protected static SAMLTokenIssuerConfig createTokenIssuerConfiguration(org.apache.axiom.om.OMElement configElement) throws TrustException
TrustExceptionprotected static SAMLTokenIssuerConfig createTokenIssuerConfiguration(String configFile) throws TrustException
TrustExceptionprotected static SAMLTokenIssuerConfig createTokenIssuerConfiguration(org.apache.axis2.description.Parameter messageContextParameter) throws TrustException
TrustExceptionpublic static org.opensaml.xml.XMLObject buildXMLObject(QName objectQName) throws TrustException
objectQName - name of the XMLObjectTrustException - If unable to find the appropriate builder.public static org.opensaml.xml.signature.KeyInfo getSymmetricKeyBasedKeyInfo(Document doc, RahasData data, X509Certificate serviceCert, int keySize, org.apache.ws.security.components.crypto.Crypto crypto, int keyComputation) throws org.apache.ws.security.WSSecurityException, TrustException
doc - An Axiom based DOM Document.data - The ephemeral key which we use here need in encrypting the message also. Therefore
we need to save the ephemeral key in RahasData passed here.serviceCert - Public key used to encrypt the assertion is extracted from this certificate.keySize - Size of the key to be usedcrypto - The relevant private keykeyComputation - Key computation mechanism.org.apache.ws.security.WSSecurityException - We use WSS4J to generate encrypted key. This exception will trigger if an
error occurs while generating the encrypted key.TrustException - If an error occurred while creating KeyInfo object.public static org.opensaml.xml.signature.KeyInfo getCertificateBasedKeyInfo(X509Certificate certificate) throws TrustException
certificate - The public key certificate used to create the KeyInfo object.TrustException - If an error occurred while creating the KeyInfopublic static SAMLCallbackHandler getSAMLCallbackHandler(SAMLTokenIssuerConfig tokenIssuerConfiguration, RahasData data) throws TrustException
tokenIssuerConfiguration - The SAML token issuer configuration.data - The RahasData.TrustException - If an error occurred while loading class from class loaderCopyright © Apache Software Foundation. All Rights Reserved.