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
commit cb34368513af1912152851192fa6e9cb38d00896 Author: Francesco Chicchiriccò <[email protected]> AuthorDate: Tue May 11 09:34:00 2021 +0200 Upgrading CAS + fixing dependencies --- fit/wa-reference/src/main/webapp/WEB-INF/web.xml | 3 ++ pom.xml | 42 +++++++++++++++++++++- wa/starter/pom.xml | 14 ++++++++ .../syncope/wa/starter/SyncopeWAApplication.java | 34 +++--------------- .../SyncopeWAWebAuthnCredentialRepository.java | 2 +- .../apache/syncope/wa/starter/AbstractTest.java | 19 +++++----- 6 files changed, 72 insertions(+), 42 deletions(-) diff --git a/fit/wa-reference/src/main/webapp/WEB-INF/web.xml b/fit/wa-reference/src/main/webapp/WEB-INF/web.xml index 34b536e..ff8ca74 100644 --- a/fit/wa-reference/src/main/webapp/WEB-INF/web.xml +++ b/fit/wa-reference/src/main/webapp/WEB-INF/web.xml @@ -26,4 +26,7 @@ under the License. <display-name>Apache Syncope ${syncope.version} WA</display-name> + <session-config> + <tracking-mode>COOKIE</tracking-mode> + </session-config> </web-app> diff --git a/pom.xml b/pom.xml index 3bd02f2..7b31e09 100644 --- a/pom.xml +++ b/pom.xml @@ -451,7 +451,7 @@ under the License. <pac4j.version>5.0.1</pac4j.version> - <cas.version>6.4.0-SNAPSHOT</cas.version> + <cas.version>6.4.0-RC4</cas.version> <cas-client.version>3.6.2</cas-client.version> <h2.version>1.4.200</h2.version> @@ -1653,6 +1653,18 @@ under the License. <groupId>org.glassfish.jersey.containers</groupId> <artifactId>jersey-container-servlet-core</artifactId> </exclusion> + <exclusion> + <groupId>com.yubico</groupId> + <artifactId>webauthn-server-core</artifactId> + </exclusion> + <exclusion> + <groupId>com.yubico</groupId> + <artifactId>webauthn-server-attestation</artifactId> + </exclusion> + <exclusion> + <groupId>com.yubico</groupId> + <artifactId>yubico-util</artifactId> + </exclusion> </exclusions> </dependency> <dependency> @@ -1676,8 +1688,36 @@ under the License. <groupId>com.google.code.findbugs</groupId> <artifactId>jsr305</artifactId> </exclusion> + <exclusion> + <groupId>com.yubico</groupId> + <artifactId>webauthn-server-core</artifactId> + </exclusion> + <exclusion> + <groupId>com.yubico</groupId> + <artifactId>webauthn-server-attestation</artifactId> + </exclusion> + <exclusion> + <groupId>com.yubico</groupId> + <artifactId>yubico-util</artifactId> + </exclusion> </exclusions> </dependency> + <!-- TMP until CAS 6.4.0-RC5 --> + <dependency> + <groupId>com.yubico</groupId> + <artifactId>webauthn-server-core</artifactId> + <version>1.9.1-RC2</version> + </dependency> + <dependency> + <groupId>com.yubico</groupId> + <artifactId>webauthn-server-attestation</artifactId> + <version>1.9.1-RC2</version> + </dependency> + <dependency> + <groupId>com.yubico</groupId> + <artifactId>yubico-util</artifactId> + <version>1.9.1-RC2</version> + </dependency> <dependency> <groupId>org.apereo.cas</groupId> <artifactId>cas-server-support-gauth</artifactId> diff --git a/wa/starter/pom.xml b/wa/starter/pom.xml index 65fd2a9..09defb8 100644 --- a/wa/starter/pom.xml +++ b/wa/starter/pom.xml @@ -218,6 +218,7 @@ under the License. <groupId>org.apereo.cas</groupId> <artifactId>cas-server-support-aup-webflow</artifactId> </dependency> + <dependency> <groupId>org.apereo.cas</groupId> <artifactId>cas-server-support-webauthn</artifactId> @@ -226,6 +227,19 @@ under the License. <groupId>org.apereo.cas</groupId> <artifactId>cas-server-support-webauthn-core</artifactId> </dependency> + <!-- TMP until CAS 6.4.0-RC5 --> + <dependency> + <groupId>com.yubico</groupId> + <artifactId>webauthn-server-core</artifactId> + </dependency> + <dependency> + <groupId>com.yubico</groupId> + <artifactId>webauthn-server-attestation</artifactId> + </dependency> + <dependency> + <groupId>com.yubico</groupId> + <artifactId>yubico-util</artifactId> + </dependency> <dependency> <groupId>org.apereo.cas</groupId> <artifactId>cas-server-support-u2f</artifactId> diff --git a/wa/starter/src/main/java/org/apache/syncope/wa/starter/SyncopeWAApplication.java b/wa/starter/src/main/java/org/apache/syncope/wa/starter/SyncopeWAApplication.java index 7aa8a93..a181c47 100644 --- a/wa/starter/src/main/java/org/apache/syncope/wa/starter/SyncopeWAApplication.java +++ b/wa/starter/src/main/java/org/apache/syncope/wa/starter/SyncopeWAApplication.java @@ -18,10 +18,12 @@ */ package org.apache.syncope.wa.starter; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Date; +import org.apache.syncope.wa.starter.config.SyncopeWARefreshContextJob; import org.apereo.cas.configuration.CasConfigurationProperties; import org.apereo.cas.configuration.CasConfigurationPropertiesValidator; - -import org.apache.syncope.wa.starter.config.SyncopeWARefreshContextJob; import org.quartz.JobBuilder; import org.quartz.JobDetail; import org.quartz.JobKey; @@ -45,12 +47,10 @@ import org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration; import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration; import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; -import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.context.annotation.PropertySource; import org.springframework.context.event.EventListener; @@ -58,15 +58,6 @@ import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.quartz.SchedulerFactoryBean; import org.springframework.transaction.annotation.EnableTransactionManagement; -import org.springframework.web.WebApplicationInitializer; - -import javax.servlet.SessionTrackingMode; - -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.Date; -import java.util.Set; -import java.util.stream.Collectors; @PropertySource("classpath:wa.properties") @PropertySource(value = "file:${conf.directory}/wa.properties", ignoreResourceNotFound = true) @@ -84,7 +75,7 @@ import java.util.stream.Collectors; DataSourceTransactionManagerAutoConfiguration.class, RedisRepositoriesAutoConfiguration.class }) -@EnableConfigurationProperties({CasConfigurationProperties.class, ServerProperties.class}) +@EnableConfigurationProperties({ CasConfigurationProperties.class }) @EnableAsync @EnableAspectJAutoProxy(proxyTargetClass = true) @EnableTransactionManagement(proxyTargetClass = true) @@ -96,9 +87,6 @@ public class SyncopeWAApplication extends SpringBootServletInitializer { @Autowired private SchedulerFactoryBean scheduler; - @Autowired - private ServerProperties serverProperties; - @Value("${contextRefreshDelay:15}") private long contextRefreshDelay; @@ -121,18 +109,6 @@ public class SyncopeWAApplication extends SpringBootServletInitializer { scheduleJobToRefreshContext(); } - @Bean - public WebApplicationInitializer syncopeWebApplicationInitializer() { - return servletContext -> { - Set<SessionTrackingMode> trackingModes = serverProperties.getServlet().getSession().getTrackingModes(). - stream(). - map(mode -> SessionTrackingMode.valueOf(mode.name())). - collect(Collectors.toSet()); - servletContext.setSessionTrackingModes(trackingModes); - LOG.debug("Set session tracking modes to {}", trackingModes); - }; - } - private void scheduleJobToRefreshContext() { try { Date date = Date.from(LocalDateTime.now().plusSeconds(this.contextRefreshDelay). 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 4639edd..52aab5c 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 @@ -65,7 +65,7 @@ public class SyncopeWAWebAuthnCredentialRepository extends BaseWebAuthnCredentia } @Override - protected Stream<CredentialRegistration> load() { + public Stream<? extends CredentialRegistration> stream() { return getService().list(). stream(). map(WebAuthnAccount::getCredentials). diff --git a/wa/starter/src/test/java/org/apache/syncope/wa/starter/AbstractTest.java b/wa/starter/src/test/java/org/apache/syncope/wa/starter/AbstractTest.java index 79284d7..7c4b798 100644 --- a/wa/starter/src/test/java/org/apache/syncope/wa/starter/AbstractTest.java +++ b/wa/starter/src/test/java/org/apache/syncope/wa/starter/AbstractTest.java @@ -19,9 +19,6 @@ package org.apache.syncope.wa.starter; import java.util.UUID; - -import org.springframework.boot.autoconfigure.web.ServerProperties; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.web.server.LocalServerPort; @@ -30,15 +27,14 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.test.context.ContextConfiguration; @SpringBootTest( - classes = AbstractTest.SyncopeTestConfiguration.class, - webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, - properties = { - "cas.authn.accept.users=mrossi::password", - "cas.authn.syncope.url=http://localhost:8080", - "cas.sso.allow-missing-service-parameter=true" -}) + classes = AbstractTest.SyncopeTestConfiguration.class, + webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, + properties = { + "cas.authn.accept.users=mrossi::password", + "cas.authn.syncope.url=http://localhost:8080", + "cas.sso.allow-missing-service-parameter=true" + }) @ContextConfiguration(initializers = ZookeeperTestingServer.class) -@EnableConfigurationProperties(ServerProperties.class) public abstract class AbstractTest { @LocalServerPort @@ -51,6 +47,7 @@ public abstract class AbstractTest { @TestConfiguration @ComponentScan("org.apache.syncope.wa.starter") public static class SyncopeTestConfiguration { + @Bean public SyncopeCoreTestingServer syncopeCoreTestingServer() { return new SyncopeCoreTestingServer();
