• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

IdentityServer4 统一授权认证系统: 基于.NET 5+IdentityServer4+Vue+Sqlserver 的统 ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

IdentityServer4 统一授权认证系统

开源软件地址:

https://gitee.com/wangqianlong1993/IdentityServer4

开源软件介绍:

star fork

:smile: IdentityServer4 统一授权认证系统

:pencil2: 介绍

在学习授权认证的过程中,发现了IdentityServer4框架。官方的例程大多是基于本地或者内存配置。没有一个完整的后台界面。github上有一些优秀的管理系统,大多都是基于MPA开发。于是基于.NET5和vue开发了这一套授权管理系统。

:surfer: 界面

  • 服务端服务端
  • 客户端服务端

:bow: 仓库地址

码云github

:surfer: 演示地址

API地址:统一授权认证登录客户端:vue客户端。管理界面

默认账户:admin/123456云服务配置欠费,后面再购买部署.

:orange_book: 文档

待完善.....

:pushpin: 软件架构

  • dotNet5:后台webapi
  • vue: 前端显示
  • Autofac
  • AutoMapper
  • IdentityServer4
  • Swashbuckle
  • MiniProfiler...

:bomb: 环境要求

  • Visual Studio 2019 16.9 +
  • .NET 5 SDK +
  • .Net Standard 2.1 +
  • VUE 2.6
  • node 12.15

:dart: 支持平台

  • 运行环境
    • Windows
    • Linux
    • 其余待测试
  • 数据库
    • SqlServer
    • MySql
  • 应用部署
    • Kestrel
    • Nginx

:video_game: Stars 趋势图

Stargazers over time

:smiling_imp: 开发说明

:heart:后台

  1. :sweat_drops: 最新功能在IdentityServer4_v4.0分支进行开发,请切换IdentityServer4_v4.0查看

    git checkout IdentityServer4_v4.0
  2. :sweat_drops: 还原

    • 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.
  3. :sweat_drops: 数据迁移采用EF完成orm功能。目前支持sqlserver和mysql两种功能。
    :smiling_imp: 注意:删除迁移数据库之前需要先删除已经生成的迁移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    }}

:green_heart: 前端

前端使用 VUE cli3搭建

  1. :sweat_drops: 修改认证配置文件
    {    "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" //退出回调地址}
  2. :sweat_drops: 运行
    npm install npm run dev

:heart: 鸣谢


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap