Search in sources :

Example 1 with ConfigurationException

use of eu.unicore.util.configuration.ConfigurationException in project unity by unity-idm.

the class TokenSigner method setupRSASigner.

private void setupRSASigner() {
    PrivateKey pk = credential.getKey();
    if (pk == null || !(pk instanceof RSAPrivateKey)) {
        throw new ConfigurationException("The private key must be RSA if one of RS signingAlgorithm is used");
    }
    internalSigner = new RSASSASigner(pk);
}
Also used : RSAPrivateKey(java.security.interfaces.RSAPrivateKey) PrivateKey(java.security.PrivateKey) ECPrivateKey(java.security.interfaces.ECPrivateKey) ConfigurationException(eu.unicore.util.configuration.ConfigurationException) RSASSASigner(com.nimbusds.jose.crypto.RSASSASigner) RSAPrivateKey(java.security.interfaces.RSAPrivateKey)

Example 2 with ConfigurationException

use of eu.unicore.util.configuration.ConfigurationException in project unity by unity-idm.

the class TokenSigner method setupECSigner.

private void setupECSigner(String signAlg) {
    PrivateKey pk = credential.getKey();
    if (pk == null || !(pk instanceof ECPrivateKey)) {
        throw new ConfigurationException("The private key must be EC if one of ES signingAlgorithm is used");
    }
    try {
        ECPrivateKey ecPrivateKey = (ECPrivateKey) pk;
        internalSigner = new ECDSASigner(ecPrivateKey);
        curve = Curve.forECParameterSpec(ecPrivateKey.getParams());
    } catch (JOSEException e) {
        throw new ConfigurationException("The EC key is incorrect", e);
    }
    if (!internalSigner.supportedJWSAlgorithms().contains(JWSAlgorithm.parse(signAlg)))
        throw new ConfigurationException("privateKey is not compatible with used ES algorithm");
}
Also used : ECPrivateKey(java.security.interfaces.ECPrivateKey) RSAPrivateKey(java.security.interfaces.RSAPrivateKey) PrivateKey(java.security.PrivateKey) ECPrivateKey(java.security.interfaces.ECPrivateKey) ConfigurationException(eu.unicore.util.configuration.ConfigurationException) ECDSASigner(com.nimbusds.jose.crypto.ECDSASigner) JOSEException(com.nimbusds.jose.JOSEException)

Example 3 with ConfigurationException

use of eu.unicore.util.configuration.ConfigurationException in project unity by unity-idm.

the class OAuthAuthzWebEndpoint method setSerializedConfiguration.

@Override
public void setSerializedConfiguration(String properties) {
    super.setSerializedConfiguration(properties);
    try {
        oauthProperties = new OAuthASProperties(this.properties, pkiManagement, getServletUrl(OAUTH_CONSUMER_SERVLET_PATH));
        coordinator.registerAuthzEndpoint(oauthProperties.getValue(OAuthASProperties.ISSUER_URI), getServletUrl(OAUTH_CONSUMER_SERVLET_PATH));
    } catch (Exception e) {
        throw new ConfigurationException("Can't initialize the OAuth 2 AS endpoint's configuration", e);
    }
}
Also used : ConfigurationException(eu.unicore.util.configuration.ConfigurationException) OAuthASProperties(pl.edu.icm.unity.oauth.as.OAuthASProperties) SerializeException(com.nimbusds.oauth2.sdk.SerializeException) ConfigurationException(eu.unicore.util.configuration.ConfigurationException) EopException(pl.edu.icm.unity.webui.idpcommon.EopException) IOException(java.io.IOException)

Example 4 with ConfigurationException

use of eu.unicore.util.configuration.ConfigurationException in project unity by unity-idm.

the class SMSRetrieval method setSerializedConfiguration.

@Override
public void setSerializedConfiguration(String configuration) {
    this.configuration = configuration;
    try {
        Properties properties = new Properties();
        properties.load(new StringReader(configuration));
        SMSRetrievalProperties config = new SMSRetrievalProperties(properties);
        name = config.getLocalizedString(msg, SMSRetrievalProperties.NAME);
        if (name.isEmpty())
            name = new I18nString("WebSMSRetrieval.title", msg);
    } catch (Exception e) {
        throw new ConfigurationException("The configuration of the web-" + "based SMS retrieval can not be parsed", e);
    }
}
Also used : ConfigurationException(eu.unicore.util.configuration.ConfigurationException) StringReader(java.io.StringReader) I18nString(pl.edu.icm.unity.types.I18nString) Properties(java.util.Properties) EngineException(pl.edu.icm.unity.exceptions.EngineException) ConfigurationException(eu.unicore.util.configuration.ConfigurationException) WrongArgumentException(pl.edu.icm.unity.exceptions.WrongArgumentException)

Example 5 with ConfigurationException

use of eu.unicore.util.configuration.ConfigurationException in project unity by unity-idm.

the class TLSRetrieval method setSerializedConfiguration.

@Override
public void setSerializedConfiguration(String configuration) {
    this.configuration = configuration;
    try {
        Properties properties = new Properties();
        properties.load(new StringReader(configuration));
        TLSRetrievalProperties config = new TLSRetrievalProperties(properties);
        name = config.getLocalizedString(msg, TLSRetrievalProperties.NAME);
        if (name.isEmpty())
            name = new I18nString("WebTLSRetrieval.title", msg);
        registrationFormForUnknown = config.getValue(TLSRetrievalProperties.REGISTRATION_FORM_FOR_UNKNOWN);
        enableAssociation = config.getBooleanValue(TLSRetrievalProperties.ENABLE_ASSOCIATION);
    } catch (Exception e) {
        throw new ConfigurationException("The configuration of the web-" + "based TLS retrieval can not be parsed", e);
    }
}
Also used : ConfigurationException(eu.unicore.util.configuration.ConfigurationException) StringReader(java.io.StringReader) I18nString(pl.edu.icm.unity.types.I18nString) Properties(java.util.Properties) ConfigurationException(eu.unicore.util.configuration.ConfigurationException)

Aggregations

ConfigurationException (eu.unicore.util.configuration.ConfigurationException)57 Properties (java.util.Properties)23 IOException (java.io.IOException)20 StringReader (java.io.StringReader)18 EngineException (pl.edu.icm.unity.exceptions.EngineException)16 InternalException (pl.edu.icm.unity.exceptions.InternalException)14 I18nString (pl.edu.icm.unity.types.I18nString)10 CommonWebAuthnProperties (pl.edu.icm.unity.webui.authn.CommonWebAuthnProperties)7 X509Certificate (java.security.cert.X509Certificate)5 File (java.io.File)4 ArrayList (java.util.ArrayList)4 SamlProperties (pl.edu.icm.unity.saml.SamlProperties)4 PrivateKey (java.security.PrivateKey)3 ServletException (javax.servlet.ServletException)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 JOSEException (com.nimbusds.jose.JOSEException)2 StrictSamlTrustChecker (eu.unicore.samly2.trust.StrictSamlTrustChecker)2 FileInputStream (java.io.FileInputStream)2 FileNotFoundException (java.io.FileNotFoundException)2 MalformedURLException (java.net.MalformedURLException)2