Hi,
I have created a sample spring-boot with okta application by following the instruction from https://dzone.com/articles/build-an-oauth-20-authorization-server-with-spring
When I run the application in my local network ( without any network proxy) it works fine.
It redirected to my okta login page and on successful login it shown my home page also.
But when I ran the same build in my test environment ( with network proxy) it is showing 404 page instead of my home page.
It redirected to my okta login page and on successful login it redirected to my home page but instead of home page it is showing 404 page
NOTE: the same build is working fine in my local but when I ran in test environment with proxy settings it is showing 404 page instead of home page on successful login of okta.
Here is my code base:
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
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
<html>
<body>
<h1> secured home page </h1>
</body>
</html>
Pom.xml
<?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>