All Projects → heyuxian → mcloud-oauth2-server

heyuxian / mcloud-oauth2-server

Licence: other
使用Spring OAuth2实现的OAuth2 资源服务器以及认证服务器

Programming Languages

java
68154 projects - #9 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to mcloud-oauth2-server

Taroco-Authentication
Taroco-Authentication 统一认证服务
Stars: ✭ 49 (-14.04%)
Mutual labels:  oauth2-server, spring-oauth2
Springcloud Oauth2
本项目基于spring-cloud-starter-oauth2搭建的认证中心和资源服务器的微服务项目,项目不仅仅简单的demo,项目的出发点在于实战应用。本项目为笔者花了不少时间和精力整理出来的,只需要稍微调整就可应用于实际项目当中,并且项目包含大量注释,不仅可以让你会用,也可让你了解到一些流程、一些原理上的东西。认证中心完成密码模式、授权码模式、刷新token模式、简化模式、以及自定义的手机号验证码模式。
Stars: ✭ 154 (+170.18%)
Mutual labels:  oauth2-server, springcloud
spring-boot-oauth2-server
Sample standalone OAuth2 authorization server using Spring Boot
Stars: ✭ 29 (-49.12%)
Mutual labels:  oauth2-server, spring-oauth2
QuickStart-admin-Cloud
基于spring boot 2.0.8 目前集成了spring security oauth2 (server and client)、springboot-admin、openfeign、hystrix,zuul(后续会替换成gateway),config.....等组件
Stars: ✭ 25 (-56.14%)
Mutual labels:  oauth2-server, springcloud
MicroServiceExample
针对微服务的各种例子实现
Stars: ✭ 25 (-56.14%)
Mutual labels:  springcloud
oauth2-server
A spec compliant, secure by default PHP OAuth 2.0 Server
Stars: ✭ 6,128 (+10650.88%)
Mutual labels:  oauth2-server
Java-CS-Record
记录准备春招实习过程中,学习与复习的知识(模块化整理,非面试题速成)。注:暂停更新,后续请移步博客
Stars: ✭ 73 (+28.07%)
Mutual labels:  springcloud
spring-boot-microservices
this is a solution based on micro-service architecture to easily add / remove services providers without effecting other providers and without affecting the main services consumers
Stars: ✭ 15 (-73.68%)
Mutual labels:  springcloud
smart-cloud
基于springboot && springcloud的脚手架,支持服务合并部署与拆分部署、接口加解密签名、日志数据 脱敏、接口数据mock、接口文档自动生成、请求幂等校验、接口日志&&sql日志切面打印、分表分库分布式事务、国际化语言等
Stars: ✭ 167 (+192.98%)
Mutual labels:  springcloud
springboot
🌿 springboot 分析与学习 & 入门示例 & 图文教程,本 Spring Boot 系列文章基于 Spring Boot 版本 v2.x 进行学习分析。 所有项目示例都有对应的文章介绍,可以直接点击 https://www.wdbyte.com 阅读。
Stars: ✭ 104 (+82.46%)
Mutual labels:  springcloud
jpsite-security-oauth2-open
微服务开放API授权平台
Stars: ✭ 21 (-63.16%)
Mutual labels:  oauth2-server
spring-cloud-examples
🎏 Personal learning use cases.
Stars: ✭ 33 (-42.11%)
Mutual labels:  spring-oauth2
genkan
🔑 The future of Kitsu's Authentication
Stars: ✭ 13 (-77.19%)
Mutual labels:  oauth2-server
shik
shik项目基于springcloud微服务搭建的分布式项目。搭建了shik-config云公共配置,通过shik-RA服务注册发现各个模块,通过shik-zuul路由转发与统一接口。并整合了包括mybatis,jpa,jedis,quartz,freemarker和layui等多个模块,支持spring-session二级域名共享session,使用了RESTful方式提供api接口
Stars: ✭ 89 (+56.14%)
Mutual labels:  springcloud
angular2-social-login
Angular 2 OAuth social login facebook, google, LinkedIn etc using NodeJS server
Stars: ✭ 40 (-29.82%)
Mutual labels:  oauth2-server
springcloud-course
Spring Cloud 入门教程
Stars: ✭ 48 (-15.79%)
Mutual labels:  springcloud
spark-platform
Spark 开发平台基于 Spring Cloud Hoxton 、Spring Boot 2.3、 OAuth2 、Security、Nacos、flowable、vue-element前后端分离的脚手架平台。平台包含系统管理(组织机构、角色用户、菜单及按钮授权、数据权限、文件管理、定时任务管理、日志管理),协同管理(待办、已办任务、流程设计、流程管理),代码生成器,分布式事务,完善的系统监控。功能模块采用插拔方式,方便根据自己的业务引入需要的模块。
Stars: ✭ 67 (+17.54%)
Mutual labels:  springcloud
phoenix oauth2 provider
Get an OAuth 2 provider running in your phoenix with controllers, views and models in just two minutes
Stars: ✭ 72 (+26.32%)
Mutual labels:  oauth2-server
seckill parent
基于springboot+springcloud的高并发和商品秒杀项目,通过redis,rabbitmq等技术实现秒杀的高并发。
Stars: ✭ 59 (+3.51%)
Mutual labels:  springcloud
mars-config
springmvc 、springboot、springcloud 动态配置系统。http 轮询方式 更新 动态配置
Stars: ✭ 17 (-70.18%)
Mutual labels:  springcloud

MCloud - OAuth2 认证中心

Build Status Coverage Status License

Deprecated

认证模块将使用 keycloak 替代

简介

mcloud-oauth-server 基于Spring OAuth2,实现了OAuth2认证服务器以及资源服务器,并以 Restful API 的方式提供了OAuth 客户端以及用户的管理功能。

项目中主要使用了以下技术:

  • Java8
  • Spring 相关 Spring, Spring Mvc, Spring Cloud, Spring data jpa, Spring Boot,Hibernate
  • mapstruct 主要用于DTO 与 Entity 之间的转换
  • flywaydb 以版本化的方式管理数据库脚本
  • thymeleaf 模板框架,用于实现后台管理界面
  • Redis 主要用作缓存实现 (暂未实现)
  • lombok

认证流程

OAuth2认证流程可参考博客 理解OAuth 2.0 ,此处不再赘述。

Features

  • 认证服务器 使用Spring Security 结合 JWT Token 实现认证服务,提供了功能完整的 OAuth2 认证服务器。

  • 资源服务器 实现了以下两种方式进行OAuth2 相关资源的管理

    • 以 RestAPI 形式提供服务来管理资源:http://localhost:8043/uaa/swagger-ui.html
    • 以 Thymeleaf + AdminBSBMaterialDesign 实现的管理端:

    用户端

    image

管理员

image

快速使用

创建数据库

请使用 mysql 客户端或是其他你喜欢的工具创建数据库,默认的数据库名称为 db_oauth

使用flywaydb初始化数据库

修改 pom.xmlflywaydb 插件的数据库名,用户名以及密码:

pom.xml

<plugin>
  <groupId>org.flywaydb</groupId>
  <artifactId>flyway-maven-plugin</artifactId>
  <version>4.2.0</version>
  <configuration>
    <user>root</user>
    <password>你的数据库密码</password>
    <driver>com.mysql.jdbc.Driver</driver>
    <url>jdbc:mysql://localhost:3306/数据库名称</url>
  </configuration>
</plugin>

修改相关配置之后,请在项目根目录下执行maven命令:

mvn flyway:clean flyway:migrate

修改项目的数据库配置:

application.yml

spring:
  datasource:
    url: jdbc:mysql://localhost/数据库名称
    username: 用户
    password: 密码
    driver-class-name: com.mysql.jdbc.Driver

启动OAuth2认证服务

所有准备工作已经完成,现在,让我们启动服务,在项目根目录下运行maven命令:

mvn clean install
mvn spring-boot:run

如果你使用的是 Idea 或 eclipse 开发,请直接运行 OAuthServerApplication 这个方法即可启动服务。

访问地址

http://localhost:8043/uaa/swagger-ui.html

uaa

使用 Postman 调试API

前提:

了解Postman并且安装了 ChromePostman 插件

首先自然是启动服务,然后我们在Postman中请求 http://localhost:8043/uaa/api/v1/users/me ,此时因为还未进行认证,所以服务器返回的是 401 的状态码:

OAuth fail

现在我们通过Postman 自带的OAuth认证功能进行认证:

qq 20171022011928

qq 20171022012054

相关项:

qq 20171126221612

默认用户:

  • 用户名 mcloud-user
  • 密码 123456

qq 20171022012701

当我们授权之后,就可以得到 access_token,此时选中并点击 Use Token,然后我们再次访问之前无权限的 API

qq 20171022013209

服务器已成功返回 200 的状态码,并返回了用户列表。

其他

  1. 因本项目使用了 lombok 进行开发,在开发之前需要安装插件,若使用的是 IDEA 进行开发,请自行搜索并安装 lombok 插件,否则会导致编译错误
  2. 若是进行二次开发,请替换 keystore.jks (非常重要) ,否则会导致安全风险,keystore.jks 可使用jdk 工具生成,也可自行使用其他工具生成非对称密钥对。

问题及建议

如果你有任何好的意见以及建议,请提 Issue

如果你觉得此项目对你有所帮助,欢迎点赞支持。

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].