开源软件名称:IdentityServer4 统一授权认证系统
开源软件地址:https://gitee.com/wangqianlong1993/IdentityServer4
开源软件介绍:
IdentityServer4 统一授权认证系统 介绍在学习授权认证的过程中,发现了IdentityServer4框架。官方的例程大多是基于本地或者内存配置。没有一个完整的后台界面。github上有一些优秀的管理系统,大多都是基于MPA开发。于是基于.NET5和vue开发了这一套授权管理系统。 界面- 服务端
- 客户端
仓库地址码云github 演示地址API地址:统一授权认证登录客户端:vue客户端。管理界面 默认账户:admin/123456云服务配置欠费,后面再购买部署.
文档待完善..... 软件架构- dotNet5:后台webapi
- vue: 前端显示
- Autofac
- AutoMapper
- IdentityServer4
- Swashbuckle
- MiniProfiler...
环境要求- Visual Studio 2019 16.9 +
- .NET 5 SDK +
- .Net Standard 2.1 +
- VUE 2.6
- node 12.15
支持平台 Stars 趋势图
开发说明后台 最新功能在IdentityServer4_v4.0分支进行开发,请切换IdentityServer4_v4.0查看 git checkout IdentityServer4_v4.0 还原 - nuget会自动还原
- 前端js包,使用了node进行还原,需要安装node包。有需要修改增加的可以看下面的指令.
//package.json文件.在项目目录下面。 //可以在vs【工具】-【选项】-【web包管理】-【程序包还原】里面设置保存时还原。vs会根据里面的版本自动下载 { "version": "1.0.0", "name": "asp.net", "private": true, "dependencies": { "bootstrap": "4.6.0", "jquery": "3.6.0" }, "devDependencies": { "gulp": "^4.0.2", "gulp-watch": "5.0.1", "gulp-concat": "2.6.1", "gulp-clean-css": "^4.2.0", "gulp-concat-css": "^3.1.0", "gulp-less": "^4.0.1", "gulp-rename": "^2.0.0", "gulp-sourcemaps": "^2.6.5", "gulp-uglify": "^3.0.2", "del": "6.0.0" } } - node下载的npm包,通过gulp自动清理合并。详细可了解gulp.
数据迁移采用EF完成orm功能。目前支持sqlserver和mysql两种功能。 注意:删除迁移数据库之前需要先删除已经生成的迁移Migrations文件夹。或者依次更新已经生成的Migration。迁移数据库 #sqlserver 默认项目选择(WQLIdentity.Infra.Data)Add-Migration InitialCreate -Context CustomConfigurationDbContext -OutputDir Migrations\Configuration\SqlServerAdd-Migration InitialCreate -Context CustomPersistedGrantDbContext -OutputDir Migrations\PersistedGrant\SqlServerAdd-Migration InitialCreate -Context ApplicationDbContext -OutputDir Migrations\Application\SqlServer#mysql 默认项目选择(WQLIdentity.Infra.Data.Mysql)Add-Migration InitialCreate -Context MysqlConfigurationDbContext -OutputDir Migrations\Configuration\MysqlAdd-Migration InitialCreate -Context MysqlPersistedGrantDbContext -OutputDir Migrations\PersistedGrant\MysqlAdd-Migration InitialCreate -Context MysqlApplicationDbContext -OutputDir Migrations\Application\Mysql 更新数据库 #sqlserverupdate-database -context CustomConfigurationDbContextupdate-database -context CustomPersistedGrantDbContextupdate-database -context ApplicationDbContext#mysqlupdate-database -context MysqlConfigurationDbContextupdate-database -context MysqlPersistedGrantDbContextupdate-database -context MysqlApplicationDbContext 生成种子数据 dotnet run seed //运行项目dotnet WQLIdentityServerAPI.dll seed //运行程序 切换配置 { "urls": "http://localhost:5001;https://localhost:5002", "IdentityServer4": { "authUrls": "http://localhost:5001",//swagger认证地址,如果nginx更改了,需要配置为服务端发布地址 "Audience": "IdentityServer4" }, "Logging": { "LogLevel": { "Default": "Warning" } }, "AllowedHosts": "*", //切换数据库地址 "Settings": { //mysql or sqlserver "DatabaseType": "mysql", //数据库连接字符串 "SqlServerConnection": "Server=.;Database=IdentityServer ;Trusted_Connection=True;MultipleActiveResultSets=true", //"MySqlConnection": "Server=localhost;Port=3306;Database=IdentityServer;Uid=root;Pwd=xiucaibbx0528;" "MySqlConnection": "Server=localhost;Port=3306;Database=IdentityServer;Uid=wql;Pwd=asdfghjkl;", "UseMinProfiler": false //是否启用miniprofiler }}
前端前端使用 VUE cli3搭建 - 修改认证配置文件
{ "authority": "http://47.119.119.183:8081",//认证地址 "clientId": "IdentityServer4", //认证客户端id "redirectUri": "http://localhost:8082/oidc-callback",//回调地址 "popupRedirectUri": "http://localhost:8082/oidc-popup-callback", "responseType": "id_token token", //认证类型 "scope": "openid profile offline_access IdentityServer.API", "automaticSilentRenew": true, "automaticSilentSignin": false, "silentRedirectUri": "http://localhost:8082/silent-renew-oidc.html" , "post_logout_redirect_uri": "http://localhost:8082" //退出回调地址} - 运行
鸣谢 |
请发表评论