Okta Integration with Angular & Spring fails

Hi,

I am creating an SPA(Angular 10) that would get the access token from OKTA using Okat-Auth-JS, as we want to use Material login form.

I’m sending the access token received in the Authorization header to a SPRING API(Spring boot 2.2).
I was following along with these two articles:
https://developer.okta.com/blog/2018/08/22/basic-crud-angular-7-and-spring-boot-2

https://developer.okta.com/blog/2020/01/06/crud-angular-9-spring-boot-2?_ga=2.128378060.1926823053.1613551459-533042367.1608649403

However, I’m facing the below mentioned issue:


APPLICATION FAILED TO START


Description:

Parameter 0 of method oauth2SecurityFilterChain in com.okta.spring.boot.oauth.OktaOAuth2AutoConfig$OAuth2SecurityFilterChainConfiguration required a bean of type ‘org.springframework.security.config.annotation.web.builders.HttpSecurity’ that could not be found.

Action:

Consider defining a bean of type ‘org.springframework.security.config.annotation.web.builders.HttpSecurity’ in your configuration.

PFB the pom.xml(Spring boot 2.2 is a technical constraint I have to follow).

<?xml version="1.0" encoding="UTF-8"?>


4.0.0

org.springframework.boot
spring-boot-starter-parent
2.2.13.RELEASE


com.trade
orderhistoryservice
0.0.1-SNAPSHOT
orderhistoryservice
Spring Boot Service to return order related details

<java.version>11</java.version>



org.springframework.data
spring-data-couchbase
3.2.6.RELEASE

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>2.2.13.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
        <version>2.2.13.RELEASE</version>
    </dependency>

    <!--	Swagger	-->
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.9.2</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>2.9.2</version>
        <scope>compile</scope>
    </dependency>
    <!--	Swagger	-->

    <!--	Okta	-->
    <dependency>
        <groupId>com.okta.spring</groupId>
        <artifactId>okta-spring-boot-starter</artifactId>
        <version>2.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security.oauth.boot</groupId>
        <artifactId>spring-security-oauth2-autoconfigure</artifactId>
        <version>2.2.13.RELEASE</version>
    </dependency>

    <!--	Okta	-->

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

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

It was working with the latest Spring boot version but isn’t with version 2.2. Since Spring boot 2.2 is a technical constraint for me, request you to please help me out with this.

If you look at the README for the Okta Spring Boot starter, you’ll find a compatibility table:

Okta Spring Boot SDK Versions Compatible Spring Boot Versions
1.2.x 2.1.x
1.4.x 2.2.x
1.5.x 2.4.x
2.0.x 2.4.x

Can you try using v1.4.0 of the Okta Spring Boot starter?

@mraible,

Thanks a tonn!

It’s working now.

1 Like

Excellent! I’m glad you got it working. :blush:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.