springboot使用Spring Security OAuth2做权限控制

更新时间:2024-04-22 13:22:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

springboot使用Spring Security+OAuth2做权限控制

源码地址:

https://github.com/li5454yong/springboot-security-oauth2.git

首先来看项目结构这个项目中用到了三张表,运行项目会自动在数据库建立这三张表。

1、pom依赖XHTML

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 <parent>

<groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.4.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <repositories> <repository>

<id>aliyunRepository</id> <name>myRepository</name> <url>http://maven.aliyun.com/nexus/content/groups/public

/</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <properties>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<java.version>1.7</java.version> <spring-security-oauth2.version>2.0.3.RELEASE</spring-security-oauth2.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-redis</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <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> </dependency> <dependency> <groupId>mysql</groupId>

<artifactId>mysql-connector-java</artifactId> <scope>runtime</scope>

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

本文来源:https://www.bwwdw.com/article/opwp.html

Top