Code Monkey home page Code Monkey logo

magusappgateway's Introduction

MagusAppGateway

集成IdentityServer4的Ocelot网关
IdentityServer4的服务可以单独使用作为授权中心

账号

用户名:admin

密码:123456

ClientId:mvc

ClientSerect:123

项目结构

MagusAppGateway.Auth:IdentityServer4授权站点

MagusAppGateway.ConfigWebApi:配置中心

MagusAppGateway.Contexts:数据库上下文类库

MagusAppGateway.Gateway:Ocelot网关站点

MagusAppGateway.Models:数据实体类和Dto

MagusAppGateway.Services:服务类库

GoodsService:测试用的Demo服务

OrderService:测试用的Demo服务

开发环境

Viusal Studio 2019

数据库

PostgreSQL

其他数据库的支持以后再做(实在是来不及啦啦啦)

怎样配置

数据库配置

在Auth和ConfigWebApi中的appsetting.json里,DBConnection属性

请运行项目中的db.sql文件

Ocelot授权配置

在Gateway项目中的ocelot.json中配置,AuthenticationProviderKey要和IdentityServer4中的APIScope表中的Name属性一致

授权端点配置

在appsettings.json中的IdentityAddress属性

关于Ocelot和IdentityServer4的配置

请去看官网,谢谢

关于发布

请自己生成SSL秘钥,生成方式自行必应(强烈不建议用百度搜索)

用户表

在生产过程中请勿使用这个项目里的用户表,密码都是明文存储的

怎样运行

1.同时运行Auth、ConfigWebApi、Gateway和两个Demo服务。

2.调用http://localhost:5001/api/Users/ApplyToken 获取AccessToken

3.用PostMan请求http://localhost:5002/api/Value

4.返回401

5.把AccessToken加到Authorization中,Type选择OAth2.0或者Bearer Token

6.再次用PostMan请求http://localhost:5002/api/Value

7.能正常返回数据

关于作者

渣渣小开发一枚,邮箱:[email protected]

magusappgateway's People

Contributors

shadowgb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.