Skip to content

zhangkong828/oidc.example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of content

OIDC Servers

  1. 1-src/web.oidc.server.ids4 : ids4 (https://github.com/IdentityServer/IdentityServer4) example (with qqconnect external login).

OIDC Clients

  1. 1-src/web.oidc.client.hybrid : web site, hybrid flow.
  2. 1-src/web.oidc.client.implicit : web site, implicit flow.
  3. 1-src/web.oidc.client.js : web site(static), implicit flow .
  4. 1-src/uwp.oidc.client.authorization-code : uwp app, authorization code flow.
  5. 1-src/wpf.oidc.client.authorization-code : wpf app, authorization code flow.
  6. 1-src/console.oidc.client.client-credentials :console app,client credentials flow(oauth2).

OAuth2 Protected API Resources

  1. 1-src/web.oauth2.resources.aspnetcore: asp.net core 2.
  2. 1-src/web.oauth2.resources.owin: asp.net owin.
  3. 1-src/web.oauth2.resources.nodejs: node.js.

OAuth2 Clients

  1. 1-src/web.oauth2.client.aspnetcore : asp.net core 2.
  2. 1-src/web.oauth2.client.owin : asp.net owin.

OAuth2 Middleware

  1. 1-src/oauth2.github.aspnetcore: asp.net core 2.
  2. 1-src/oauth2.qqconnect.aspnetcore: asp.net core 2.
  3. 1-src/oauth2.qqconnect.owin: asp.net owin.

Global Config

If you want use QQ Connect or Github, please replace ClientId and ClientSercet in 1-src/_shared/GlobalConfig.cs file.

public static class GlobalConfig
{
    public static class QQConnect
    {
        public static readonly string ClientId = "You App Id";
        public static readonly string ClientSecret = "You App Secret";
    }

    public static class Github
    {
        public static readonly string ClientId = "You App Id";
        public static readonly string ClientSecret = "You App Secret";
    }
}

Deployed web site

web site docker windows note
http://localhost:8080 reverse proxy :traefik
http://oidc-server.test oidc server : asp.net core 2.1
http://oidc-client-hybrid.test oidc client : asp.net core 2.1
http://oidc-client-implicit.test oidc client : owin 4
http://oidc-client-js.test oidc client : html js css( use oidc login and use access_token call api)
http://oauth2-resources-aspnetcore.test oauth2 resources api : asp.net core 2
http://oauth2-resources-nodejs.test oauth2 resources api : node.js
http://oauth2-resources-owin.test oauth2 resources api : asp.net webapi 2
http://oauth2-client-aspnetcore.test oauth2 client : asp.net core 2
http://oauth2-client-owin.test oauth2 client : owin 4

How to run?

docker-compose.yml (docker platform)

## start docker
docker-compose up --detach --build

## stop docker
docker-compose down

Update local /etc/hosts.

cat <<EOF >> /etc/hosts
127.0.0.1 oidc-server.test
127.0.0.1 oidc-client-hybrid.test
127.0.0.1 oidc-client-js.test
127.0.0.1 oauth2-resources-nodejs.test
127.0.0.1 oauth2-resources-aspnetcore.test
127.0.0.1 oauth2-client-aspnetcore.test
EOF

build.ps1 (windows platform)

Use administrator run build.ps1 to deploy demo web site to local IIS. (Need install vs 2017 with .net framework 4.5+ sdk and .net core 2.1 sdk )

build.ps1 -help

build.ps1 -target {Task}

Task                          Description
================================================================================
clean                         清理项目缓存
restore                       还原项目依赖
build                         编译项目
publish                       发布项目
deploy                        部署到本机IIS
open-browser                  用浏览器打开部署的站点
default                       默认执行open-browser

Blog

Authentication and Authorization: http://www.cnblogs.com/linianhui/category/929878.html

OIDC in Action: http://www.cnblogs.com/linianhui/category/1121078.html

Old version(ids3 and owin)

  1. ids3: https://github.com/linianhui/oidc.example/tree/ids3
  2. ids4 and owin: https://github.com/linianhui/oidc.example/tree/owin

About

OIDC (OpenID Connect) Example for http://openid.net/connect/

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 84.9%
  • HTML 8.6%
  • PowerShell 4.7%
  • Dockerfile 1.2%
  • Other 0.6%