From fd54f5c5fe55490e6012bdcd94cb2d657cccdfd9 Mon Sep 17 00:00:00 2001 From: "agile.zhou" Date: Mon, 10 Jul 2023 02:44:41 +0800 Subject: [PATCH] add a oidc controller --- .../Controllers/HomeController.cs | 6 ------ .../Controllers/OIDCController.cs | 19 +++++++++++++++++++ .../appsettings.Development.json | 4 ++-- 3 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 AgileConfig.Server.Apisite/Controllers/OIDCController.cs diff --git a/AgileConfig.Server.Apisite/Controllers/HomeController.cs b/AgileConfig.Server.Apisite/Controllers/HomeController.cs index f48fd92..a658fb7 100644 --- a/AgileConfig.Server.Apisite/Controllers/HomeController.cs +++ b/AgileConfig.Server.Apisite/Controllers/HomeController.cs @@ -41,12 +41,6 @@ namespace AgileConfig.Server.Apisite.Controllers return Redirect(Request.PathBase + "/ui"); } - [AllowAnonymous] - public async Task OIDC(string code) - { - return Redirect("http://localhost:8000/ui/#/oidc/login?code=" + code); - } - public async Task Current() { string userName = this.GetCurrentUserName(); diff --git a/AgileConfig.Server.Apisite/Controllers/OIDCController.cs b/AgileConfig.Server.Apisite/Controllers/OIDCController.cs new file mode 100644 index 0000000..227c886 --- /dev/null +++ b/AgileConfig.Server.Apisite/Controllers/OIDCController.cs @@ -0,0 +1,19 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace AgileConfig.Server.Apisite.Controllers +{ + public class OIDCController : Controller + { + /// + /// pass the oidc code to frontend + /// + /// + /// + [AllowAnonymous] + public IActionResult Index(string code) + { + return Redirect("http://localhost:8000/ui/#/oidc/login?code=" + code); + } + } +} diff --git a/AgileConfig.Server.Apisite/appsettings.Development.json b/AgileConfig.Server.Apisite/appsettings.Development.json index 3a14211..2a7a4e8 100644 --- a/AgileConfig.Server.Apisite/appsettings.Development.json +++ b/AgileConfig.Server.Apisite/appsettings.Development.json @@ -42,8 +42,8 @@ }, "OIDC": { "clientId": "64a925a9642cc515dceccdfb", - "clientSecret": "e7c908f12ff64ab35de93bbd6973f5ed", - "redirectUri": "http://localhost:5000/home/oidc", + "clientSecret": "", + "redirectUri": "http://localhost:5000/oidc", "tokenEndpoint": "https://agileconfig.authing.cn/oidc/token", "authorizationEndpoint": "https://agileconfig.authing.cn" }