Spring boot 404 okta认证后的页面

Spring boot 404 okta认证后的页面,spring-boot,spring-security,spring-security-oauth2,okta,Spring Boot,Spring Security,Spring Security Oauth2,Okta,我已经按照 当我在本地网络(没有任何网络代理)中运行应用程序时,它工作正常 它重定向到我的okta登录页面,成功登录后,它也显示了我的主页 但是,当我在测试环境中运行相同的构建(使用网络代理)时,它显示的是404页面,而不是我的主页 它重定向到我的okta登录页面,成功登录后,它重定向到我的主页,但不是主页,而是显示404页面 注意:相同的构建在我的本地环境中运行良好,但是当我在带有代理设置的测试环境中运行时,在成功登录okta时,它显示的是404页面而不是主页 以下是我的代码库: applic

我已经按照

当我在本地网络(没有任何网络代理)中运行应用程序时,它工作正常

它重定向到我的okta登录页面,成功登录后,它也显示了我的主页

但是,当我在测试环境中运行相同的构建(使用网络代理)时,它显示的是404页面,而不是我的主页

它重定向到我的okta登录页面,成功登录后,它重定向到我的主页,但不是主页,而是显示404页面

注意:相同的构建在我的本地环境中运行良好,但是当我在带有代理设置的测试环境中运行时,在成功登录okta时,它显示的是404页面而不是主页

以下是我的代码库: application.yml

server:
  port: 8080

okta:
  oauth2:
    issuer: https://dev-XXXXXX.okta.com/oauth2/default
    client-id: XXXXXX               
    client-secret: XXXXXX
spring:
  thymeleaf:
    cache: false
<html>
<body>
<h1> secured home page </h1>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.2.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.baji.okta</groupId>
    <artifactId>OktaOAuthClient</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>OktaOAuthClient</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>com.okta.spring</groupId>
            <artifactId>okta-spring-boot-starter</artifactId>
            <version>1.3.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.thymeleaf.extras/thymeleaf-extras-springsecurity5 -->
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity5</artifactId>
            <version>3.0.4.RELEASE</version>
        </dependency>


        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>
SecurityConfiguration.java

@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
    @Override
    public void configure(HttpSecurity http) throws Exception {
        http.antMatcher("/**").authorizeRequests()
            .antMatchers("/").permitAll()
            .anyRequest().authenticated()
            .and()
            .oauth2Login();
    }
}
home.html

server:
  port: 8080

okta:
  oauth2:
    issuer: https://dev-XXXXXX.okta.com/oauth2/default
    client-id: XXXXXX               
    client-secret: XXXXXX
spring:
  thymeleaf:
    cache: false
<html>
<body>
<h1> secured home page </h1>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.2.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.baji.okta</groupId>
    <artifactId>OktaOAuthClient</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>OktaOAuthClient</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>com.okta.spring</groupId>
            <artifactId>okta-spring-boot-starter</artifactId>
            <version>1.3.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.thymeleaf.extras/thymeleaf-extras-springsecurity5 -->
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity5</artifactId>
            <version>3.0.4.RELEASE</version>
        </dependency>


        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

安全主页
Pom.xml

server:
  port: 8080

okta:
  oauth2:
    issuer: https://dev-XXXXXX.okta.com/oauth2/default
    client-id: XXXXXX               
    client-secret: XXXXXX
spring:
  thymeleaf:
    cache: false
<html>
<body>
<h1> secured home page </h1>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.2.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.baji.okta</groupId>
    <artifactId>OktaOAuthClient</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>OktaOAuthClient</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>com.okta.spring</groupId>
            <artifactId>okta-spring-boot-starter</artifactId>
            <version>1.3.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.thymeleaf.extras/thymeleaf-extras-springsecurity5 -->
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity5</artifactId>
            <version>3.0.4.RELEASE</version>
        </dependency>


        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

4.0.0
org.springframework.boot
spring启动程序父级
2.2.2.1发布
com.baji.okta
OktaOAuthClient
0.0.1-快照
OktaOAuthClient
SpringBoot的演示项目
1.8
org.springframework.boot
弹簧启动装置
org.springframework.boot
SpringBootStarterWeb
com.okta.spring
奥克塔弹簧启动机
1.3.0
org.thymeleaf.extras
thymeleaf-extras-springsecurity5
3.0.4.1发布
org.springframework.boot
弹簧起动试验
测试
org.junit.vintage
朱尼特老式发动机
org.springframework.boot
springbootmaven插件

成功登录后,Okta将请求重定向回登录后重新定向的url。在您的示例中,似乎已将localhost配置为重定向url,但在test env中,情况并非如此

成功登录后,Okta将请求重定向回登录后重新定向url。在您的示例中,似乎已将localhost配置为重定向url,但在test env中,情况并非如此