Captai-N
Captai-N

Reputation: 1514

Use OAuth library for Spring Boot

I'm trying to include the oauth library in Spring Boot. I don't know why, but it doesn't seem to be working. In any case, I cannot use the following libraries:

ProtectedResourceDetails cannot be resolved to a type

OAuthConsumerSupport cannot be resolved to a type

BaseProtectedResourceDetails cannot be resolved to a type

Pom.xml:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.security.oauth</groupId>
        <artifactId>spring-security-oauth2</artifactId>
        <version>2.5.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-oauth2-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-webflux</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-test</artifactId>
        <scope>test</scope>
    </dependency>

required libraries to use the following classes:

    OAuthConsumerSupport oAuthConsumerSupport = new CoreOAuthConsumerSupport();
    ProtectedResourceDetails is24ClientKeyDetails = createIs24ClientKeyDetails();
    BaseProtectedResourceDetails protectedResourceDetails = new BaseProtectedResourceDetails();

Upvotes: 0

Views: 292

Answers (1)

Andrew
Andrew

Reputation: 66

These libraries are deprecated and most likely not compatible with your version of spring boot:

<dependency>
<groupId>org.springframework.security.oauth</groupId>
   <artifactId>spring-security-oauth2</artifactId>
   <version>2.5.2.RELEASE</version>
</dependency>
<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
</dependency>

Here is the stack overflow post about this: What is the replacement for the deprecated AuthorizationServer in Spring Security?

Here is a video on how to use the new spring security: https://www.youtube.com/watch?v=b9O9NI-RJ3o

Upvotes: 1

Related Questions