Reputation: 39
I want to secure my REST API with authentication using OAuth2, but on beginning of my journey i faced some problems like "Cannot resolve symbol 'AuthorizationServerConfigurerAdapter'"
didn't find any solution on the internet so i asking you. I simply cannot import it and with i write something like import org.springframework.security.oauth2.client.OAuth2ClientContext;
it says that in cannot resolve oauth2.
My pom.xml file is look's like:
<groupId>com.bsuir</groupId>
<artifactId>buspark</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>buspark</name>
<description>labs</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--SECURITY-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth2</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>
<!--SECURITY-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--SWAGGER-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.8.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version>
<scope>compile</scope>
</dependency>
<!--SWAGGER-->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<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>
Thanks in advance.
Upvotes: 0
Views: 1528
Reputation: 11
Group id contains an error. It must be oauth without 2. The final version looks like this:
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.3.6.RELEASE</version>
</dependency>
Upvotes: 1
Reputation: 39
I downloaded libraries (http://central.maven.org/maven2/org/springframework/security/oauth/spring-security-oauth2/2.3.0.RELEASE/) manually and installed them in "Project Setting" -> "Libraries"
Upvotes: 0