use of org.gluu.oxauth.model.common.WebKeyStorage in project oxAuth by GluuFederation.
the class CryptoProviderFactory method getCryptoProvider.
public static AbstractCryptoProvider getCryptoProvider(AppConfiguration configuration) throws Exception {
AbstractCryptoProvider cryptoProvider = null;
WebKeyStorage webKeyStorage = configuration.getWebKeysStorage();
if (webKeyStorage == null) {
return null;
}
switch(webKeyStorage) {
case KEYSTORE:
cryptoProvider = getKeyStoreProvider(configuration);
break;
case PKCS11:
cryptoProvider = new OxElevenCryptoProvider(configuration.getOxElevenGenerateKeyEndpoint(), configuration.getOxElevenSignEndpoint(), configuration.getOxElevenVerifySignatureEndpoint(), configuration.getOxElevenDeleteKeyEndpoint(), configuration.getOxElevenTestModeToken());
break;
}
if (configuration.getKeyRegenerationEnabled()) {
// set interval only if re-generation is enabled
cryptoProvider.setKeyRegenerationIntervalInDays(configuration.getKeyRegenerationInterval() / 24);
}
return cryptoProvider;
}
use of org.gluu.oxauth.model.common.WebKeyStorage in project oxAuth by GluuFederation.
the class CryptoProviderProviderFactory method getCryptoProvider.
@Produces
@ApplicationScoped
public AbstractCryptoProvider getCryptoProvider() throws Exception {
log.debug("Started to create crypto provider");
WebKeyStorage webKeyStorage = appConfiguration.getWebKeysStorage();
if (webKeyStorage == null) {
throw new RuntimeException("Failed to initialize cryptoProvider, cryptoProviderType is not specified!");
}
AbstractCryptoProvider cryptoProvider = org.gluu.oxauth.model.crypto.CryptoProviderFactory.getCryptoProvider(appConfiguration);
if (cryptoProvider == null) {
throw new RuntimeException("Failed to initialize cryptoProvider, cryptoProviderType is unsupported: " + webKeyStorage);
}
return cryptoProvider;
}
Aggregations