Update samples to use Spring Security 6

Issue gh-46
This commit is contained in:
Marcus Da Coregio 2022-03-17 14:44:26 -03:00
parent 545ffedea3
commit bce2126fd1
101 changed files with 347 additions and 306 deletions

View File

@ -4,5 +4,5 @@
<component name="FrameworkDetectionExcludesConfiguration"> <component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" /> <file type="web" url="file://$PROJECT_DIR$" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="temurin-17" project-jdk-type="JavaSDK" />
</project> </project>

View File

@ -1,5 +1,5 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT
org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError
org.gradle.parallel=true org.gradle.parallel=true
org.gradle.caching=true org.gradle.caching=true

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '2.6.4'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=5.7.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=5.7.0-SNAPSHOT

View File

@ -70,8 +70,10 @@ public class LoginPage {
private WebDriver driver; private WebDriver driver;
@FindBy(id = "username")
private WebElement username; private WebElement username;
@FindBy(id = "password")
private WebElement password; private WebElement password;
@FindBy(css = "button[type=submit]") @FindBy(css = "button[type=submit]")

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -51,8 +51,10 @@ public class LoginPage {
private WebDriver webDriver; private WebDriver webDriver;
@FindBy(id = "username")
private WebElement username; private WebElement username;
@FindBy(id = "password")
private WebElement password; private WebElement password;
@FindBy(css = "button[type=submit]") @FindBy(css = "button[type=submit]")

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }
@ -15,7 +15,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-webflux' implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test' testImplementation 'org.springframework.security:spring-security-test'

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }
@ -15,7 +15,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework:spring-webflux' implementation 'org.springframework:spring-webflux'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
implementation 'io.projectreactor.netty:reactor-netty' implementation 'io.projectreactor.netty:reactor-netty'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,8 +1,8 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
id("org.springframework.boot") version "2.5.0" id("org.springframework.boot") version "3.0.0-M1"
id("io.spring.dependency-management") version "1.0.9.RELEASE" id("io.spring.dependency-management") version "1.0.11.RELEASE"
kotlin("jvm") version "1.6.0" kotlin("jvm") version "1.6.0"
kotlin("plugin.spring") version "1.6.0" kotlin("plugin.spring") version "1.6.0"
} }
@ -12,13 +12,16 @@ repositories {
maven { maven {
url = uri("https://repo.spring.io/snapshot") url = uri("https://repo.spring.io/snapshot")
} }
maven {
url = uri("https://repo.spring.io/milestone")
}
} }
dependencies { dependencies {
implementation("org.springframework.boot:spring-boot-starter-security") implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-thymeleaf") implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
implementation("org.springframework.boot:spring-boot-starter-webflux") implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.thymeleaf.extras:thymeleaf-extras-springsecurity5") implementation("org.thymeleaf.extras:thymeleaf-extras-springsecurity6")
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions") implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
implementation("org.jetbrains.kotlin:kotlin-reflect") implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")

View File

@ -1 +1 @@
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,7 +1,7 @@
plugins { plugins {
id "java" id "java"
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id "org.gretty" version "3.0.6" id "org.gretty" version "4.0.0"
id "war" id "war"
} }
@ -14,14 +14,14 @@ repositories {
} }
dependencies { dependencies {
implementation platform("org.springframework:spring-framework-bom:5.3.0") implementation platform("org.springframework:spring-framework-bom:6.0.0-SNAPSHOT")
implementation platform("org.springframework.security:spring-security-bom:5.5.0-SNAPSHOT") implementation platform("org.springframework.security:spring-security-bom:6.0.0-SNAPSHOT")
implementation platform("org.junit:junit-bom:5.7.0") implementation platform("org.junit:junit-bom:5.7.0")
implementation "org.springframework.security:spring-security-config" implementation "org.springframework.security:spring-security-config"
implementation "org.springframework.security:spring-security-web" implementation "org.springframework.security:spring-security-web"
implementation "org.springframework:spring-webmvc" implementation "org.springframework:spring-webmvc"
implementation "org.thymeleaf:thymeleaf-spring5:3.0.11.RELEASE" implementation "org.thymeleaf:thymeleaf-spring6:3.1.0.M1"
testImplementation "org.assertj:assertj-core:3.18.0" testImplementation "org.assertj:assertj-core:3.18.0"
testImplementation "org.springframework:spring-test" testImplementation "org.springframework:spring-test"

View File

@ -1,5 +1,5 @@
gretty { gretty {
servletContainer = "tomcat9" servletContainer = "tomcat10"
contextPath = "/" contextPath = "/"
fileLogEnabled = false fileLogEnabled = false
integrationTestTask = 'integrationTest' integrationTestTask = 'integrationTest'

View File

@ -16,7 +16,7 @@
package example; package example;
import javax.servlet.Filter; import jakarta.servlet.Filter;
import org.springframework.web.filter.HiddenHttpMethodFilter; import org.springframework.web.filter.HiddenHttpMethodFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

View File

@ -16,10 +16,10 @@
package example; package example;
import org.thymeleaf.spring5.ISpringTemplateEngine; import org.thymeleaf.spring6.ISpringTemplateEngine;
import org.thymeleaf.spring5.SpringTemplateEngine; import org.thymeleaf.spring6.SpringTemplateEngine;
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver; import org.thymeleaf.spring6.templateresolver.SpringResourceTemplateResolver;
import org.thymeleaf.spring5.view.ThymeleafViewResolver; import org.thymeleaf.spring6.view.ThymeleafViewResolver;
import org.thymeleaf.templatemode.TemplateMode; import org.thymeleaf.templatemode.TemplateMode;
import org.thymeleaf.templateresolver.ITemplateResolver; import org.thymeleaf.templateresolver.ITemplateResolver;

View File

@ -1,6 +1,6 @@
plugins { plugins {
id "java" id "java"
id "nebula.integtest" version "8.2.0" // id "nebula.integtest" version "8.2.0"
id "org.gretty" version "3.0.6" id "org.gretty" version "3.0.6"
id "war" id "war"
} }

View File

@ -1,7 +1,7 @@
plugins { plugins {
id "java" id "java"
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id "org.gretty" version "3.0.6" id "org.gretty" version "4.0.0"
id "war" id "war"
} }
@ -14,14 +14,14 @@ repositories {
} }
dependencies { dependencies {
implementation platform("org.springframework:spring-framework-bom:5.3.0") implementation platform("org.springframework:spring-framework-bom:6.0.0-SNAPSHOT")
implementation platform("org.springframework.security:spring-security-bom:5.5.0-SNAPSHOT") implementation platform("org.springframework.security:spring-security-bom:6.0.0-SNAPSHOT")
implementation platform("org.junit:junit-bom:5.7.0") implementation platform("org.junit:junit-bom:5.7.0")
implementation "org.springframework.security:spring-security-config" implementation "org.springframework.security:spring-security-config"
implementation "org.springframework.security:spring-security-web" implementation "org.springframework.security:spring-security-web"
implementation "org.springframework:spring-webmvc" implementation "org.springframework:spring-webmvc"
implementation "org.thymeleaf:thymeleaf-spring5:3.0.11.RELEASE" implementation "org.thymeleaf:thymeleaf-spring6:3.1.0.M1"
testImplementation "org.assertj:assertj-core:3.18.0" testImplementation "org.assertj:assertj-core:3.18.0"
testImplementation "org.springframework:spring-test" testImplementation "org.springframework:spring-test"

View File

@ -1,5 +1,5 @@
gretty { gretty {
servletContainer = "tomcat9" servletContainer = "tomcat10"
contextPath = "/" contextPath = "/"
fileLogEnabled = false fileLogEnabled = false
integrationTestTask = 'integrationTest' integrationTestTask = 'integrationTest'

View File

@ -51,8 +51,10 @@ public class LoginPage {
private WebDriver webDriver; private WebDriver webDriver;
@FindBy(id = "username")
private WebElement username; private WebElement username;
@FindBy(id = "password")
private WebElement password; private WebElement password;
@FindBy(css = "button[type=submit]") @FindBy(css = "button[type=submit]")

View File

@ -16,7 +16,7 @@
package example; package example;
import javax.servlet.Filter; import jakarta.servlet.Filter;
import org.springframework.web.filter.HiddenHttpMethodFilter; import org.springframework.web.filter.HiddenHttpMethodFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

View File

@ -16,10 +16,10 @@
package example; package example;
import org.thymeleaf.spring5.ISpringTemplateEngine; import org.thymeleaf.spring6.ISpringTemplateEngine;
import org.thymeleaf.spring5.SpringTemplateEngine; import org.thymeleaf.spring6.SpringTemplateEngine;
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver; import org.thymeleaf.spring6.templateresolver.SpringResourceTemplateResolver;
import org.thymeleaf.spring5.view.ThymeleafViewResolver; import org.thymeleaf.spring6.view.ThymeleafViewResolver;
import org.thymeleaf.templatemode.TemplateMode; import org.thymeleaf.templatemode.TemplateMode;
import org.thymeleaf.templateresolver.ITemplateResolver; import org.thymeleaf.templateresolver.ITemplateResolver;

View File

@ -51,8 +51,10 @@ public class LoginPage {
private WebDriver webDriver; private WebDriver webDriver;
@FindBy(id = "username")
private WebElement username; private WebElement username;
@FindBy(id = "password")
private WebElement password; private WebElement password;
@FindBy(css = "button[type=submit]") @FindBy(css = "button[type=submit]")

View File

@ -36,21 +36,19 @@ dependencies {
implementation "org.opensaml:opensaml-saml-api:4.1.1" implementation "org.opensaml:opensaml-saml-api:4.1.1"
implementation "org.opensaml:opensaml-saml-impl:4.1.1" implementation "org.opensaml:opensaml-saml-impl:4.1.1"
} }
implementation platform("org.springframework:spring-framework-bom:5.3.11") implementation platform("org.springframework:spring-framework-bom:6.0.0-SNAPSHOT")
implementation platform("org.springframework.security:spring-security-bom:5.6.0-SNAPSHOT") implementation platform("org.springframework.security:spring-security-bom:6.0.0-SNAPSHOT")
implementation platform("org.junit:junit-bom:5.7.0") implementation platform("org.junit:junit-bom:5.7.0")
implementation "org.springframework.security:spring-security-config" implementation "org.springframework.security:spring-security-config"
implementation "org.springframework.security:spring-security-web" implementation "org.springframework.security:spring-security-web"
implementation "org.springframework:spring-webmvc" implementation "org.springframework:spring-webmvc"
implementation "org.springframework.security:spring-security-saml2-service-provider" implementation "org.springframework.security:spring-security-saml2-service-provider"
implementation "javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.2" implementation "org.thymeleaf:thymeleaf-spring6:3.1.0.M1"
implementation "org.apache.taglibs:taglibs-standard-jstlel:1.2.5" implementation "org.thymeleaf.extras:thymeleaf-extras-springsecurity6:3.1.0.M1"
implementation "org.thymeleaf:thymeleaf-spring5:3.0.11.RELEASE"
implementation "org.thymeleaf.extras:thymeleaf-extras-springsecurity5:3.0.4.RELEASE"
providedCompile "javax.servlet:javax.servlet-api:4.0.1" providedCompile "jakarta.servlet:jakarta.servlet-api:5.0.0"
providedCompile "javax.servlet.jsp:javax.servlet.jsp-api:2.3.3" providedCompile "org.glassfish.web:jakarta.servlet.jsp.jstl:2.0.0"
testImplementation "org.assertj:assertj-core:3.18.0" testImplementation "org.assertj:assertj-core:3.18.0"
testImplementation "org.springframework:spring-test" testImplementation "org.springframework:spring-test"
@ -58,6 +56,7 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api") testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation "org.seleniumhq.selenium:htmlunit-driver:2.44.0" testImplementation "org.seleniumhq.selenium:htmlunit-driver:2.44.0"
testImplementation 'org.hamcrest:hamcrest:2.2' testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.awaitility:awaitility:4.2.0'
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
} }

View File

@ -16,15 +16,16 @@
package example; package example;
import java.io.IOException; import java.util.concurrent.TimeUnit;
import com.gargoylesoftware.htmlunit.ElementNotFoundException;
import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlElement; import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlForm; import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlInput; import com.gargoylesoftware.htmlunit.html.HtmlInput;
import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlPasswordInput;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput; import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -40,6 +41,9 @@ import org.springframework.test.web.servlet.htmlunit.MockMvcWebClientBuilder;
import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.WebApplicationContext;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
@ExtendWith(SpringExtension.class) @ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = ApplicationConfiguration.class) @ContextConfiguration(classes = ApplicationConfiguration.class)
@WebAppConfiguration @WebAppConfiguration
@ -66,35 +70,47 @@ public class Saml2JavaConfigurationITests {
@Test @Test
void authenticationAttemptWhenValidThenShowsUserEmailAddress() throws Exception { void authenticationAttemptWhenValidThenShowsUserEmailAddress() throws Exception {
HtmlPage relyingParty = performLogin(); performLogin();
Assertions.assertThat(relyingParty.asText()).contains("You're email address is testuser@spring.security.saml"); HtmlPage home = (HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage();
assertThat(home.asText()).contains("You're email address is testuser@spring.security.saml");
} }
@Test @Test
void logoutWhenRelyingPartyInitiatedLogoutThenLoginPageWithLogoutParam() throws Exception { void logoutWhenRelyingPartyInitiatedLogoutThenLoginPageWithLogoutParam() throws Exception {
HtmlPage relyingParty = performLogin(); performLogin();
HtmlElement rpLogoutButton = relyingParty.getHtmlElementById("rp_logout_button"); HtmlPage home = (HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage();
HtmlElement rpLogoutButton = home.getHtmlElementById("rp_logout_button");
HtmlPage loginPage = rpLogoutButton.click(); HtmlPage loginPage = rpLogoutButton.click();
Assertions.assertThat(loginPage.getUrl().getFile()).isEqualTo("/login?logout"); assertThat(loginPage.getUrl().getFile()).isEqualTo("/login?logout");
} }
@Test private void performLogin() throws Exception {
void logoutWhenAssertingPartyInitiatedLogoutThenLoginPageWithLogoutParam() throws Exception {
HtmlPage relyingParty = performLogin();
HtmlElement apLogoutButton = relyingParty.getHtmlElementById("ap_logout_button");
HtmlPage loginPage = apLogoutButton.click();
Assertions.assertThat(loginPage.getUrl().getFile()).isEqualTo("/login?logout");
}
private HtmlPage performLogin() throws IOException {
HtmlPage login = this.webClient.getPage("/"); HtmlPage login = this.webClient.getPage("/");
HtmlForm form = login.getFormByName("f"); this.webClient.waitForBackgroundJavaScript(10000);
HtmlForm form = findForm(login);
HtmlInput username = form.getInputByName("username"); HtmlInput username = form.getInputByName("username");
HtmlInput password = form.getInputByName("password"); HtmlPasswordInput password = form.getInputByName("password");
HtmlSubmitInput submit = login.getHtmlElementById("submit_button"); HtmlSubmitInput submit = login.getHtmlElementById("okta-signin-submit");
username.setValueAttribute("user"); username.type("testuser@spring.security.saml");
password.setValueAttribute("password"); password.type("12345678");
return submit.click(); submit.click();
this.webClient.waitForBackgroundJavaScript(10000);
}
private HtmlForm findForm(HtmlPage login) {
await().atMost(10, TimeUnit.SECONDS)
.until(() -> login.getForms().stream().map(HtmlForm::getId).anyMatch("form19"::equals));
for (HtmlForm form : login.getForms()) {
try {
if (form.getId().equals("form19")) {
return form;
}
}
catch (ElementNotFoundException ex) {
// Continue
}
}
throw new IllegalStateException("Could not resolve login form");
} }
} }

View File

@ -16,7 +16,7 @@
package example; package example;
import javax.servlet.Filter; import jakarta.servlet.Filter;
import org.springframework.web.filter.HiddenHttpMethodFilter; import org.springframework.web.filter.HiddenHttpMethodFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

View File

@ -16,11 +16,11 @@
package example; package example;
import org.thymeleaf.extras.springsecurity5.dialect.SpringSecurityDialect; import org.thymeleaf.extras.springsecurity6.dialect.SpringSecurityDialect;
import org.thymeleaf.spring5.ISpringTemplateEngine; import org.thymeleaf.spring6.ISpringTemplateEngine;
import org.thymeleaf.spring5.SpringTemplateEngine; import org.thymeleaf.spring6.SpringTemplateEngine;
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver; import org.thymeleaf.spring6.templateresolver.SpringResourceTemplateResolver;
import org.thymeleaf.spring5.view.ThymeleafViewResolver; import org.thymeleaf.spring6.view.ThymeleafViewResolver;
import org.thymeleaf.templatemode.TemplateMode; import org.thymeleaf.templatemode.TemplateMode;
import org.thymeleaf.templateresolver.ITemplateResolver; import org.thymeleaf.templateresolver.ITemplateResolver;

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -18,9 +18,9 @@ package example;
import java.io.IOException; import java.io.IOException;
import javax.servlet.ServletException; import jakarta.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;

View File

@ -18,8 +18,8 @@ package example;
import java.security.SecureRandom; import java.security.SecureRandom;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;

View File

@ -15,9 +15,8 @@
*/ */
package example; package example;
import javax.servlet.http.HttpSession;
import com.j256.twofactorauth.TimeBasedOneTimePasswordUtil; import com.j256.twofactorauth.TimeBasedOneTimePasswordUtil;
import jakarta.servlet.http.HttpSession;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'org.springframework.boot' version '3.0.0-M1'
id 'org.springframework.boot' version '2.5.2' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -51,8 +51,10 @@ public class LoginPage {
private WebDriver webDriver; private WebDriver webDriver;
@FindBy(id = "username")
private WebElement username; private WebElement username;
@FindBy(id = "password")
private WebElement password; private WebElement password;
@FindBy(css = "button[type=submit]") @FindBy(css = "button[type=submit]")

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'org.springframework.boot' version '3.0.0-M1'
id 'org.springframework.boot' version '2.5.2' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '2.6.4'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=5.7.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=5.7.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }
@ -15,7 +15,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test' testImplementation 'org.springframework.security:spring-security-test'

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -225,7 +225,7 @@ public class OAuth2LoginApplicationTests {
HtmlElement errorElement = page.getBody().getFirstByXPath("div"); HtmlElement errorElement = page.getBody().getFirstByXPath("div");
assertThat(errorElement).isNotNull(); assertThat(errorElement).isNotNull();
assertThat(errorElement.asText()).contains("authorization_request_not_found"); assertThat(errorElement.asNormalizedText()).contains("authorization_request_not_found");
} }
@Test @Test
@ -253,7 +253,7 @@ public class OAuth2LoginApplicationTests {
HtmlElement errorElement = page.getBody().getFirstByXPath("div"); HtmlElement errorElement = page.getBody().getFirstByXPath("div");
assertThat(errorElement).isNotNull(); assertThat(errorElement).isNotNull();
assertThat(errorElement.asText()).contains("authorization_request_not_found"); assertThat(errorElement.asNormalizedText()).contains("authorization_request_not_found");
} }
@Test @Test
@ -291,7 +291,7 @@ public class OAuth2LoginApplicationTests {
assertThat(clientAnchorElements.get(i).getAttribute("href")).isIn(googleClientAuthorizeUri, assertThat(clientAnchorElements.get(i).getAttribute("href")).isIn(googleClientAuthorizeUri,
githubClientAuthorizeUri, facebookClientAuthorizeUri, oktaClientAuthorizeUri, githubClientAuthorizeUri, facebookClientAuthorizeUri, oktaClientAuthorizeUri,
springClientAuthorizeUri); springClientAuthorizeUri);
assertThat(clientAnchorElements.get(i).asText()).isIn(googleClientRegistration.getClientName(), assertThat(clientAnchorElements.get(i).asNormalizedText()).isIn(googleClientRegistration.getClientName(),
githubClientRegistration.getClientName(), facebookClientRegistration.getClientName(), githubClientRegistration.getClientName(), facebookClientRegistration.getClientName(),
oktaClientRegistration.getClientName(), springClientRegistration.getClientName()); oktaClientRegistration.getClientName(), springClientRegistration.getClientName());
} }
@ -301,13 +301,14 @@ public class OAuth2LoginApplicationTests {
assertThat(page.getTitleText()).isEqualTo("Spring Security - OAuth 2.0 Login"); assertThat(page.getTitleText()).isEqualTo("Spring Security - OAuth 2.0 Login");
DomNodeList<HtmlElement> divElements = page.getBody().getElementsByTagName("div"); DomNodeList<HtmlElement> divElements = page.getBody().getElementsByTagName("div");
assertThat(divElements.get(1).asText()).contains("User: joeg@springsecurity.io"); assertThat(divElements.get(1).asNormalizedText()).contains("User: joeg@springsecurity.io");
assertThat(divElements.get(4).asText()).contains("You are successfully logged in joeg@springsecurity.io"); assertThat(divElements.get(4).asNormalizedText())
.contains("You are successfully logged in joeg@springsecurity.io");
} }
private HtmlAnchor getClientAnchorElement(HtmlPage page, ClientRegistration clientRegistration) { private HtmlAnchor getClientAnchorElement(HtmlPage page, ClientRegistration clientRegistration) {
Optional<HtmlAnchor> clientAnchorElement = page.getAnchors().stream() Optional<HtmlAnchor> clientAnchorElement = page.getAnchors().stream()
.filter((e) -> e.asText().equals(clientRegistration.getClientName())).findFirst(); .filter((e) -> e.asNormalizedText().equals(clientRegistration.getClientName())).findFirst();
return (clientAnchorElement.orElse(null)); return (clientAnchorElement.orElse(null));
} }

View File

@ -18,10 +18,10 @@ package example.filter;
import java.io.IOException; import java.io.IOException;
import javax.servlet.FilterChain; import jakarta.servlet.FilterChain;
import javax.servlet.ServletException; import jakarta.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -15,8 +15,8 @@
*/ */
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -15,8 +15,8 @@
*/ */
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '2.6.4'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }
@ -31,7 +31,7 @@ dependencies {
implementation 'com.squareup.okhttp3:mockwebserver' implementation 'com.squareup.okhttp3:mockwebserver'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'com.nimbusds:oauth2-oidc-sdk' implementation 'com.nimbusds:oauth2-oidc-sdk:9.29'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test' testImplementation 'org.springframework.security:spring-security-test'

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=5.7.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=5.7.0-SNAPSHOT

View File

@ -8,3 +8,6 @@ spring:
introspection-uri: ${mockwebserver.url}/introspect introspection-uri: ${mockwebserver.url}/introspect
client-id: client client-id: client
client-secret: secret client-secret: secret
mvc:
pathmatch:
matching-strategy: ant_path_matcher

View File

@ -15,8 +15,8 @@
*/ */
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }
@ -31,7 +31,7 @@ dependencies {
implementation 'com.squareup.okhttp3:mockwebserver' implementation 'com.squareup.okhttp3:mockwebserver'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'com.nimbusds:oauth2-oidc-sdk' implementation 'com.nimbusds:oauth2-oidc-sdk:9.29'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test' testImplementation 'org.springframework.security:spring-security-test'

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -15,8 +15,8 @@
*/ */
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -15,8 +15,8 @@
*/ */
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }
@ -32,7 +32,7 @@ dependencies {
implementation 'org.springframework:spring-webflux' implementation 'org.springframework:spring-webflux'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
implementation 'io.projectreactor.netty:reactor-netty' implementation 'io.projectreactor.netty:reactor-netty'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }
@ -22,7 +22,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.security:spring-security-saml2-service-provider' implementation 'org.springframework.security:spring-security-saml2-service-provider'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
testImplementation 'net.sourceforge.htmlunit:htmlunit' testImplementation 'net.sourceforge.htmlunit:htmlunit'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.2' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }
@ -22,11 +22,12 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.security:spring-security-saml2-service-provider' implementation 'org.springframework.security:spring-security-saml2-service-provider'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
testImplementation 'net.sourceforge.htmlunit:htmlunit' testImplementation 'net.sourceforge.htmlunit:htmlunit'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test' testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.awaitility:awaitility:4.2.0'
} }
tasks.withType(Test).configureEach { tasks.withType(Test).configureEach {

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,6 @@
plugins { plugins {
id 'org.springframework.boot' version '2.5.6' id 'org.springframework.boot' version '3.0.0-M1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "nebula.integtest" version "8.2.0" id "nebula.integtest" version "8.2.0"
id 'java' id 'java'
} }
@ -22,7 +22,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.security:spring-security-saml2-service-provider' implementation 'org.springframework.security:spring-security-saml2-service-provider'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
testImplementation 'net.sourceforge.htmlunit:htmlunit' testImplementation 'net.sourceforge.htmlunit:htmlunit'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'

View File

@ -1,2 +1,2 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -1,8 +1,8 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
id("org.springframework.boot") version "2.5.0" id("org.springframework.boot") version "3.0.0-M1"
id("io.spring.dependency-management") version "1.0.9.RELEASE" id("io.spring.dependency-management") version "1.0.11.RELEASE"
kotlin("jvm") version "1.6.0" kotlin("jvm") version "1.6.0"
kotlin("plugin.spring") version "1.6.0" kotlin("plugin.spring") version "1.6.0"
} }
@ -12,15 +12,16 @@ repositories {
maven { maven {
url = uri("https://repo.spring.io/snapshot") url = uri("https://repo.spring.io/snapshot")
} }
maven {
url = uri("https://repo.spring.io/milestone")
}
} }
dependencies { dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.springframework.boot:spring-boot-starter-security") implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-thymeleaf") implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.thymeleaf.extras:thymeleaf-extras-springsecurity5") implementation("org.thymeleaf.extras:thymeleaf-extras-springsecurity6")
testImplementation("org.springframework.boot:spring-boot-starter-test") testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.security:spring-security-test") testImplementation("org.springframework.security:spring-security-test")
} }

View File

@ -1 +1 @@
spring-security.version=5.6.0-SNAPSHOT spring-security.version=6.0.0-SNAPSHOT

View File

@ -19,7 +19,6 @@ package org.springframework.security.samples.config
import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Bean
import org.springframework.security.config.annotation.web.builders.HttpSecurity import org.springframework.security.config.annotation.web.builders.HttpSecurity
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
import org.springframework.security.config.web.servlet.invoke
import org.springframework.security.core.userdetails.User import org.springframework.security.core.userdetails.User
import org.springframework.security.core.userdetails.UserDetailsService import org.springframework.security.core.userdetails.UserDetailsService
import org.springframework.security.provisioning.InMemoryUserDetailsManager import org.springframework.security.provisioning.InMemoryUserDetailsManager
@ -33,15 +32,11 @@ class SecurityConfig {
@Bean @Bean
fun filterChain(http: HttpSecurity): SecurityFilterChain { fun filterChain(http: HttpSecurity): SecurityFilterChain {
http { http.authorizeRequests()
authorizeRequests { .antMatchers("/css/**").permitAll()
authorize("/css/**", permitAll) .antMatchers("/user/**").hasAuthority("ROLE_USER")
authorize("/user/**", hasAuthority("ROLE_USER")) .and()
} .formLogin().loginPage("/log-in")
formLogin {
loginPage = "/log-in"
}
}
return http.build() return http.build()
} }

View File

@ -1 +1 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT

View File

@ -1 +1 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT

View File

@ -1 +1 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT

View File

@ -1 +1 @@
version=5.6.0-SNAPSHOT version=6.0.0-SNAPSHOT

View File

@ -1,6 +1,7 @@
plugins { plugins {
id "java" id "java"
id "org.gretty" version "3.0.6" id "nebula.integtest" version "8.2.0"
id "org.gretty" version "4.0.0"
id "war" id "war"
} }
@ -34,7 +35,7 @@ dependencies {
testImplementation "org.springframework:spring-test" testImplementation "org.springframework:spring-test"
testImplementation "org.springframework.security:spring-security-test" testImplementation "org.springframework.security:spring-security-test"
testImplementation "org.junit.jupiter:junit-jupiter-api" testImplementation "org.junit.jupiter:junit-jupiter-api"
testImplementation 'net.sourceforge.htmlunit:htmlunit:2.49.1' testImplementation 'net.sourceforge.htmlunit:htmlunit:2.44.0'
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")

View File

@ -1 +1 @@
version=5.7.0-SNAPSHOT version=6.0.0-SNAPSHOT

View File

@ -1,5 +1,5 @@
gretty { gretty {
servletContainer = "tomcat9" servletContainer = "tomcat10"
contextPath = "/" contextPath = "/"
fileLogEnabled = false fileLogEnabled = false
integrationTestTask = 'integrationTest' integrationTestTask = 'integrationTest'

Some files were not shown because too many files have changed in this diff Show More