This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/master by this push:
new 8012bd5 Fix following CAS code changes
8012bd5 is described below
commit 8012bd539cf5d7fd536d98289c500680b5388a37
Author: Francesco Chicchiriccò <[email protected]>
AuthorDate: Thu Dec 30 14:28:00 2021 +0100
Fix following CAS code changes
---
.../syncope/wa/starter/config/SyncopeWARefreshContextJob.java | 5 ++---
.../wa/starter/oidc/SyncopeWAOIDCJWKSGeneratorService.java | 6 +++---
.../saml/idp/metadata/RestfulSamlIdPMetadataGenerator.java | 10 +++++++---
.../saml/idp/metadata/RestfulSamlIdPMetadataLocator.java | 11 +++++------
.../surrogate/SyncopeWASurrogateAuthenticationService.java | 2 +-
.../syncope/wa/starter/u2f/SyncopeWAU2FDeviceRepository.java | 2 +-
.../webauthn/SyncopeWAWebAuthnCredentialRepository.java | 2 +-
7 files changed, 20 insertions(+), 18 deletions(-)
diff --git
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/SyncopeWARefreshContextJob.java
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/SyncopeWARefreshContextJob.java
index b4c72c0..348d3f8 100644
---
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/SyncopeWARefreshContextJob.java
+++
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/SyncopeWARefreshContextJob.java
@@ -52,7 +52,7 @@ public class SyncopeWARefreshContextJob implements Job {
LOG.debug("Attempting to refresh WA application context");
if (!WARestClient.isReady()) {
LOG.debug("Syncope client is not yet ready");
- throw new RuntimeException("Syncope core is not yet ready to
access requests");
+ throw new IllegalStateException("Syncope core is not yet ready
to access requests");
}
contextRefresher.refresh();
LOG.info("Refreshed application context to bootstrap property
sources, etc...");
@@ -62,8 +62,7 @@ public class SyncopeWARefreshContextJob implements Job {
LOG.info("Generated SAML2 IdP metadata for {}",
document.getAppliesTo());
advertiseReady();
-
- } catch (RuntimeException e) {
+ } catch (Exception e) {
throw new JobExecutionException("While generating SAML2 IdP
metadata", e);
}
}
diff --git
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/oidc/SyncopeWAOIDCJWKSGeneratorService.java
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/oidc/SyncopeWAOIDCJWKSGeneratorService.java
index 830733a..6b481e1 100644
---
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/oidc/SyncopeWAOIDCJWKSGeneratorService.java
+++
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/oidc/SyncopeWAOIDCJWKSGeneratorService.java
@@ -58,7 +58,7 @@ public class SyncopeWAOIDCJWKSGeneratorService implements
OidcJsonWebKeystoreGen
@Override
public JsonWebKeySet store(final JsonWebKeySet jsonWebKeySet) throws
Exception {
if (!WARestClient.isReady()) {
- throw new RuntimeException("Syncope core is not yet ready");
+ throw new IllegalStateException("Syncope core is not yet ready");
}
OIDCJWKSService service =
waRestClient.getSyncopeClient().getService(OIDCJWKSService.class);
OIDCJWKSTO to = new OIDCJWKSTO();
@@ -75,7 +75,7 @@ public class SyncopeWAOIDCJWKSGeneratorService implements
OidcJsonWebKeystoreGen
@Override
public Resource generate() {
if (!WARestClient.isReady()) {
- throw new RuntimeException("Syncope core is not yet ready");
+ throw new IllegalStateException("Syncope core is not yet ready");
}
OIDCJWKSService service =
waRestClient.getSyncopeClient().getService(OIDCJWKSService.class);
@@ -95,7 +95,7 @@ public class SyncopeWAOIDCJWKSGeneratorService implements
OidcJsonWebKeystoreGen
}
}
if (jwksTO == null) {
- throw new RuntimeException("Unable to determine OIDC JWKS
resource");
+ throw new IllegalStateException("Unable to determine OIDC JWKS
resource");
}
return new
ByteArrayResource(jwksTO.getJson().getBytes(StandardCharsets.UTF_8), "OIDC
JWKS");
}
diff --git
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/saml/idp/metadata/RestfulSamlIdPMetadataGenerator.java
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/saml/idp/metadata/RestfulSamlIdPMetadataGenerator.java
index 22560a2..a89068a 100644
---
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/saml/idp/metadata/RestfulSamlIdPMetadataGenerator.java
+++
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/saml/idp/metadata/RestfulSamlIdPMetadataGenerator.java
@@ -83,19 +83,23 @@ public class RestfulSamlIdPMetadataGenerator extends
BaseSamlIdPMetadataGenerato
}
@Override
- public Pair<String, String> buildSelfSignedEncryptionCert(final
Optional<SamlRegisteredService> registeredService) {
+ public Pair<String, String> buildSelfSignedEncryptionCert(final
Optional<SamlRegisteredService> registeredService)
+ throws Exception {
+
return generateCertificateAndKey();
}
@Override
- public Pair<String, String> buildSelfSignedSigningCert(final
Optional<SamlRegisteredService> registeredService) {
+ public Pair<String, String> buildSelfSignedSigningCert(final
Optional<SamlRegisteredService> registeredService)
+ throws Exception {
+
return generateCertificateAndKey();
}
private SyncopeClient getSyncopeClient() {
if (!WARestClient.isReady()) {
LOG.info("Syncope client is not yet ready");
- throw new RuntimeException("Syncope core is not yet ready to
access requests");
+ throw new IllegalStateException("Syncope core is not yet ready to
access requests");
}
return restClient.getSyncopeClient();
}
diff --git
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/saml/idp/metadata/RestfulSamlIdPMetadataLocator.java
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/saml/idp/metadata/RestfulSamlIdPMetadataLocator.java
index 25352ce..b66b2ca 100644
---
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/saml/idp/metadata/RestfulSamlIdPMetadataLocator.java
+++
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/saml/idp/metadata/RestfulSamlIdPMetadataLocator.java
@@ -20,10 +20,13 @@ package org.apache.syncope.wa.starter.saml.idp.metadata;
import com.github.benmanes.caffeine.cache.Cache;
import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+import java.util.Optional;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.SAML2IdPEntityTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.common.rest.api.service.SAML2IdPEntityService;
import org.apache.syncope.wa.bootstrap.WARestClient;
import
org.apereo.cas.support.saml.idp.metadata.locator.AbstractSamlIdPMetadataLocator;
import org.apereo.cas.support.saml.services.SamlRegisteredService;
@@ -32,10 +35,6 @@ import org.apereo.cas.util.crypto.CipherExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Base64;
-import java.util.Optional;
-import org.apache.syncope.common.rest.api.service.SAML2IdPEntityService;
-
public class RestfulSamlIdPMetadataLocator extends
AbstractSamlIdPMetadataLocator {
private static final Logger LOG =
LoggerFactory.getLogger(RestfulSamlIdPMetadataLocator.class);
@@ -89,7 +88,7 @@ public class RestfulSamlIdPMetadataLocator extends
AbstractSamlIdPMetadataLocato
return null;
} catch (Exception e) {
if (e instanceof SyncopeClientException
- && ((SyncopeClientException) e).getType() ==
ClientExceptionType.NotFound) {
+ && ((SyncopeClientException) e).getType() ==
ClientExceptionType.NotFound) {
LOG.info(e.getMessage());
} else {
if (LOG.isDebugEnabled()) {
@@ -125,7 +124,7 @@ public class RestfulSamlIdPMetadataLocator extends
AbstractSamlIdPMetadataLocato
private SyncopeClient getSyncopeClient() {
if (!WARestClient.isReady()) {
LOG.info("Syncope client is not yet ready");
- throw new RuntimeException("Syncope core is not yet ready to
access requests");
+ throw new IllegalStateException("Syncope core is not yet ready to
access requests");
}
return restClient.getSyncopeClient();
}
diff --git
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/surrogate/SyncopeWASurrogateAuthenticationService.java
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/surrogate/SyncopeWASurrogateAuthenticationService.java
index d9a00b6..8d42f04 100644
---
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/surrogate/SyncopeWASurrogateAuthenticationService.java
+++
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/surrogate/SyncopeWASurrogateAuthenticationService.java
@@ -64,7 +64,7 @@ public class SyncopeWASurrogateAuthenticationService
implements SurrogateAuthent
private ImpersonationService getImpersonationService() {
if (!WARestClient.isReady()) {
- throw new RuntimeException("Syncope core is not yet ready");
+ throw new IllegalStateException("Syncope core is not yet ready");
}
return
waRestClient.getSyncopeClient().getService(ImpersonationService.class);
}
diff --git
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/u2f/SyncopeWAU2FDeviceRepository.java
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/u2f/SyncopeWAU2FDeviceRepository.java
index f6539fb..9dae3d5 100644
---
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/u2f/SyncopeWAU2FDeviceRepository.java
+++
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/u2f/SyncopeWAU2FDeviceRepository.java
@@ -148,7 +148,7 @@ public class SyncopeWAU2FDeviceRepository extends
BaseU2FDeviceRepository {
private U2FRegistrationService getU2FService() {
if (!WARestClient.isReady()) {
- throw new RuntimeException("Syncope core is not yet ready");
+ throw new IllegalStateException("Syncope core is not yet ready");
}
return
waRestClient.getSyncopeClient().getService(U2FRegistrationService.class);
}
diff --git
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/webauthn/SyncopeWAWebAuthnCredentialRepository.java
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/webauthn/SyncopeWAWebAuthnCredentialRepository.java
index 52aab5c..e5fd732 100644
---
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/webauthn/SyncopeWAWebAuthnCredentialRepository.java
+++
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/webauthn/SyncopeWAWebAuthnCredentialRepository.java
@@ -129,7 +129,7 @@ public class SyncopeWAWebAuthnCredentialRepository extends
BaseWebAuthnCredentia
private WebAuthnRegistrationService getService() {
if (!WARestClient.isReady()) {
- throw new RuntimeException("Syncope core is not yet ready");
+ throw new IllegalStateException("Syncope core is not yet ready");
}
return
waRestClient.getSyncopeClient().getService(WebAuthnRegistrationService.class);
}