├── .babelrc ├── OidcDebugger ├── Views │ ├── _ViewStart.cshtml │ ├── _ViewImports.cshtml │ ├── Shared │ │ ├── CodeCard.vue │ │ ├── _Favicons.cshtml │ │ ├── CopyButton.vue │ │ ├── InfoCard.vue │ │ ├── Error.cshtml │ │ ├── DecodedTokenCard.vue │ │ ├── utils.js │ │ └── _Layout.cshtml │ ├── Debug │ │ ├── _ServerInfo.cshtml │ │ ├── index.js │ │ └── Index.cshtml │ └── Home │ │ ├── RequestUriCodeCard.vue │ │ ├── index.js │ │ └── Index.cshtml ├── .DS_Store ├── wwwroot │ ├── favicon.ico │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── images │ │ ├── gear-lg.png │ │ ├── gear-sm.png │ │ └── computer-setup.jpg │ ├── mstile-150x150.png │ ├── apple-touch-icon.png │ ├── android-chrome-192x192.png │ ├── android-chrome-512x512.png │ ├── browserconfig.xml │ ├── manifest.json │ ├── safari-pinned-tab.svg │ └── css │ │ └── site.css ├── MultitenancyOptions.cs ├── Controllers │ ├── HomeController.cs │ └── DebugController.cs ├── ViewModels │ └── DebugViewModel.cs ├── AppTenant.cs ├── Helpers.cs ├── appsettings.Development.json ├── Program.cs ├── appsettings.json ├── Properties │ └── launchSettings.json ├── OidcDebugger.csproj ├── UrlHelperExtensions.cs ├── AppTenantResolver.cs └── Startup.cs ├── .vscode ├── settings.json ├── tasks.json └── launch.json ├── OidcDebugger.BackendTests ├── OidcDebugger.BackendTests.csproj └── DebugControllerShould.cs ├── package.json ├── LICENSE ├── OidcDebugger.sln ├── README.md ├── webpack.config.js └── .gitignore /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env"] 3 | } 4 | -------------------------------------------------------------------------------- /OidcDebugger/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /OidcDebugger/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronpk/oidc-debugger/master/OidcDebugger/.DS_Store -------------------------------------------------------------------------------- /OidcDebugger/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using OidcDebugger 2 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 3 | -------------------------------------------------------------------------------- /OidcDebugger/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronpk/oidc-debugger/master/OidcDebugger/wwwroot/favicon.ico -------------------------------------------------------------------------------- /OidcDebugger/wwwroot/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronpk/oidc-debugger/master/OidcDebugger/wwwroot/favicon-16x16.png -------------------------------------------------------------------------------- /OidcDebugger/wwwroot/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronpk/oidc-debugger/master/OidcDebugger/wwwroot/favicon-32x32.png -------------------------------------------------------------------------------- /OidcDebugger/wwwroot/images/gear-lg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronpk/oidc-debugger/master/OidcDebugger/wwwroot/images/gear-lg.png -------------------------------------------------------------------------------- /OidcDebugger/wwwroot/images/gear-sm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronpk/oidc-debugger/master/OidcDebugger/wwwroot/images/gear-sm.png -------------------------------------------------------------------------------- /OidcDebugger/wwwroot/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronpk/oidc-debugger/master/OidcDebugger/wwwroot/mstile-150x150.png -------------------------------------------------------------------------------- /OidcDebugger/wwwroot/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronpk/oidc-debugger/master/OidcDebugger/wwwroot/apple-touch-icon.png -------------------------------------------------------------------------------- /OidcDebugger/wwwroot/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronpk/oidc-debugger/master/OidcDebugger/wwwroot/android-chrome-192x192.png -------------------------------------------------------------------------------- /OidcDebugger/wwwroot/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronpk/oidc-debugger/master/OidcDebugger/wwwroot/android-chrome-512x512.png -------------------------------------------------------------------------------- /OidcDebugger/wwwroot/images/computer-setup.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronpk/oidc-debugger/master/OidcDebugger/wwwroot/images/computer-setup.jpg -------------------------------------------------------------------------------- /OidcDebugger/MultitenancyOptions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace OidcDebugger 4 | { 5 | public class MultitenancyOptions 6 | { 7 | public IEnumerable Tenants { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /OidcDebugger/wwwroot/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #2d89ef 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /OidcDebugger/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | 3 | namespace OidcDebugger.Controllers 4 | { 5 | public class HomeController : Controller 6 | { 7 | [HttpGet("~/")] 8 | public IActionResult Index() 9 | { 10 | return View(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /OidcDebugger/ViewModels/DebugViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace OidcDebugger.ViewModels 4 | { 5 | public class DebugViewModel 6 | { 7 | public string Method { get; set; } 8 | 9 | public string Referer { get; set; } 10 | 11 | public KeyValuePair[] Form { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.tabSize": 4, 3 | "editor.insertSpaces": true, 4 | "editor.detectIndentation": false, 5 | "[html]": { 6 | "editor.tabSize": 2 7 | }, 8 | "[razor]": { 9 | "editor.tabSize": 2 10 | }, 11 | "[javascript]": { 12 | "editor.tabSize": 2 13 | }, 14 | "[vue]": { 15 | "editor.tabSize": 2 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /OidcDebugger/Views/Shared/CodeCard.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | -------------------------------------------------------------------------------- /OidcDebugger/AppTenant.cs: -------------------------------------------------------------------------------- 1 | namespace OidcDebugger 2 | { 3 | public class AppTenant 4 | { 5 | public string Shortname { get; set; } 6 | 7 | public string Name { get; set; } 8 | 9 | public string Description { get; set; } 10 | 11 | public string[] Hostnames { get; set; } 12 | 13 | public string GoogleTrackingId { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | "command": "dotnet", 4 | "isShellCommand": true, 5 | "args": [], 6 | "tasks": [ 7 | { 8 | "taskName": "build", 9 | "args": [ 10 | "${workspaceRoot}/OidcDebugger/OidcDebugger.csproj" 11 | ], 12 | "isBuildCommand": true, 13 | "problemMatcher": "$msCompile" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /OidcDebugger/Views/Shared/_Favicons.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /OidcDebugger/Views/Shared/CopyButton.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 18 | -------------------------------------------------------------------------------- /OidcDebugger/wwwroot/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "OAuth Debugger", 3 | "icons": [ 4 | { 5 | "src": "/android-chrome-192x192.png", 6 | "sizes": "192x192", 7 | "type": "image/png" 8 | }, 9 | { 10 | "src": "/android-chrome-512x512.png", 11 | "sizes": "512x512", 12 | "type": "image/png" 13 | } 14 | ], 15 | "theme_color": "#ffffff", 16 | "background_color": "#ffffff" 17 | } -------------------------------------------------------------------------------- /OidcDebugger/Helpers.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using Microsoft.Extensions.Primitives; 4 | 5 | namespace OidcDebugger 6 | { 7 | public static class Helpers 8 | { 9 | public static IEnumerable> Flatten( 10 | IEnumerable> source) 11 | => source.SelectMany(x => x.Value, (orig, value) => new KeyValuePair(orig.Key, value)); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /OidcDebugger/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | }, 10 | "Multitenancy": { 11 | "Tenants": [{ 12 | "Shortname": "oauth", 13 | "Name": "OAuth 2.0", 14 | "Hostnames": [ "oauth.local" ] 15 | }, 16 | { 17 | "Shortname": "oidc", 18 | "Name": "OpenID Connect", 19 | "Hostnames": [ "oidc.local", "localhost" ] 20 | }] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /OidcDebugger/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore; 2 | using Microsoft.AspNetCore.Hosting; 3 | 4 | namespace OidcDebugger 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | BuildWebHost(args).Run(); 11 | } 12 | 13 | public static IWebHost BuildWebHost(string[] args) => 14 | WebHost.CreateDefaultBuilder(args) 15 | .UseKestrel(opt => opt.AddServerHeader = false) 16 | .UseStartup() 17 | .Build(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /OidcDebugger/Views/Debug/_ServerInfo.cshtml: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /OidcDebugger/Views/Shared/InfoCard.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | -------------------------------------------------------------------------------- /OidcDebugger.BackendTests/OidcDebugger.BackendTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /OidcDebugger/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ApplicationInsights": { 3 | "InstrumentationKey": "aa630223-7cf1-44c9-937b-6a86fbf109f8" 4 | }, 5 | "Logging": { 6 | "IncludeScopes": false, 7 | "LogLevel": { 8 | "Default": "Warning" 9 | } 10 | }, 11 | "Multitenancy": { 12 | "Tenants": [{ 13 | "Shortname": "oauth", 14 | "Name": "OAuth 2.0", 15 | "Hostnames": [ "oauthdebugger.com" ], 16 | "GoogleTrackingId": "UA-106432346-2" 17 | }, 18 | { 19 | "Shortname": "oidc", 20 | "Name": "OpenID Connect", 21 | "Hostnames": [ "oidcdebugger.com", "openidconnectdebugger.azurewebsites.net", "oidc-debugger.herokuapp.com" ], 22 | "GoogleTrackingId": "UA-106432346-1" 23 | }] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /OidcDebugger/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:52128/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "OidcDebugger": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "applicationUrl": "http://localhost:5000" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /OidcDebugger/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Error"; 3 | } 4 | 5 |

Error.

6 |

An error occurred while processing your request.

7 | 8 |

Development Mode

9 |

10 | Swapping to Development environment will display more detailed information about the error that occurred. 11 |

12 |

13 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. 14 |

15 | -------------------------------------------------------------------------------- /OidcDebugger/Controllers/DebugController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using Microsoft.AspNetCore.Mvc; 4 | using OidcDebugger.ViewModels; 5 | 6 | namespace OidcDebugger.Controllers 7 | { 8 | public class DebugController : Controller 9 | { 10 | [HttpGet("~/debug"), HttpPost("~/debug")] 11 | public IActionResult Index() 12 | { 13 | var viewModel = new DebugViewModel 14 | { 15 | Method = Request.Method, 16 | Referer = HttpContext.Request.Headers["Referer"], 17 | Form = Request.HasFormContentType 18 | ? Helpers.Flatten(Request.Form).ToArray() 19 | : new KeyValuePair[0] 20 | }; 21 | 22 | return View(viewModel); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "oidc-debugger", 3 | "description": "OAuth 2.0 and OpenID Connect debugging tool", 4 | "version": "1.0.0", 5 | "license": "MIT", 6 | "scripts": { 7 | "clean": "", 8 | "build": "cross-env NODE_ENV=production webpack --progress --hide-modules" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/nbarbettini/oidc-debugger.git" 13 | }, 14 | "dependencies": { 15 | "vue": "^2.6.14", 16 | "vue-clipboard2": "^0.1.1" 17 | }, 18 | "devDependencies": { 19 | "aspnet-webpack": "^2.0.3", 20 | "babel-core": "^6.26.0", 21 | "babel-loader": "^7.1.4", 22 | "babel-preset-env": "^1.6.1", 23 | "babel-preset-vue-app": "^2.0.0", 24 | "cross-env": "^5.2.0", 25 | "css-loader": "^0.28.11", 26 | "file-loader": "^1.1.11", 27 | "vue-loader": "^14.2.4", 28 | "vue-template-compiler": "^2.6.14", 29 | "webpack": "^3.12.0", 30 | "webpack-dev-server": "^2.11.3", 31 | "webpack-hot-middleware": "^2.23.1" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /OidcDebugger/OidcDebugger.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netcoreapp2.1 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /OidcDebugger/UrlHelperExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.AspNetCore.Http; 3 | 4 | // Thanks to https://stackoverflow.com/a/40649583/3191599 5 | namespace Microsoft.AspNetCore.Mvc 6 | { 7 | /// 8 | /// extension methods. 9 | /// 10 | public static partial class UrlHelperExtensions 11 | { 12 | /// 13 | /// Generates a fully qualified URL to the specified content by using the specified content path. Converts a 14 | /// virtual (relative) path to an application absolute path. 15 | /// 16 | /// The URL helper. 17 | /// The content path. 18 | /// The absolute URL. 19 | public static string AbsoluteContent(this IUrlHelper url, string contentPath) 20 | { 21 | var request = url.ActionContext.HttpContext.Request; 22 | return new Uri(new Uri(request.Scheme + "://" + request.Host.Value), url.Content(contentPath)).ToString(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /OidcDebugger/AppTenantResolver.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading.Tasks; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.Extensions.Options; 5 | using SaasKit.Multitenancy; 6 | 7 | namespace OidcDebugger 8 | { 9 | public class AppTenantResolver : ITenantResolver 10 | { 11 | private readonly AppTenant[] _tenants; 12 | 13 | public AppTenantResolver(IOptions options) 14 | { 15 | _tenants = options?.Value?.Tenants?.ToArray() ?? new AppTenant[0]; 16 | } 17 | 18 | public Task> ResolveAsync(HttpContext context) 19 | { 20 | TenantContext tenantContext = null; 21 | 22 | var tenant = _tenants.FirstOrDefault(t => 23 | t.Hostnames.Any(h => h.Equals(context.Request.Host.Host.ToLower()))); 24 | 25 | if (tenant != null) 26 | { 27 | tenantContext = new TenantContext(tenant); 28 | } 29 | 30 | return Task.FromResult(tenantContext); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /OidcDebugger/Views/Home/RequestUriCodeCard.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Nate Barbettini 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /OidcDebugger/Views/Shared/DecodedTokenCard.vue: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /OidcDebugger.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27004.2005 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OidcDebugger", "OidcDebugger\OidcDebugger.csproj", "{82EF4A34-93CE-40FA-B575-62B564651A17}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OidcDebugger.BackendTests", "OidcDebugger.BackendTests\OidcDebugger.BackendTests.csproj", "{C00B9A26-B9D2-4216-BF66-25D1626CBFD2}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {82EF4A34-93CE-40FA-B575-62B564651A17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {82EF4A34-93CE-40FA-B575-62B564651A17}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {82EF4A34-93CE-40FA-B575-62B564651A17}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {82EF4A34-93CE-40FA-B575-62B564651A17}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {C00B9A26-B9D2-4216-BF66-25D1626CBFD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {C00B9A26-B9D2-4216-BF66-25D1626CBFD2}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {C00B9A26-B9D2-4216-BF66-25D1626CBFD2}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {C00B9A26-B9D2-4216-BF66-25D1626CBFD2}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {27253E08-135B-4915-8CA6-F02F0936BE26} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to find out which attributes exist for C# debugging 3 | // Use hover for the description of the existing attributes 4 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": ".NET Core Launch (web)", 9 | "type": "coreclr", 10 | "request": "launch", 11 | "preLaunchTask": "build", 12 | // If you have changed target frameworks, make sure to update the program path. 13 | "program": "${workspaceRoot}/OidcDebugger/bin/Debug/netcoreapp2.0/OidcDebugger.dll", 14 | "args": [], 15 | "cwd": "${workspaceRoot}/OidcDebugger", 16 | "stopAtEntry": false, 17 | "internalConsoleOptions": "openOnSessionStart", 18 | "launchBrowser": { 19 | "enabled": true, 20 | "args": "${auto-detect-url}", 21 | "windows": { 22 | "command": "cmd.exe", 23 | "args": "/C start ${auto-detect-url}" 24 | }, 25 | "osx": { 26 | "command": "open" 27 | }, 28 | "linux": { 29 | "command": "xdg-open" 30 | } 31 | }, 32 | "env": { 33 | "ASPNETCORE_ENVIRONMENT": "Development" 34 | }, 35 | "sourceFileMap": { 36 | "/Views": "${workspaceRoot}/Views" 37 | } 38 | }, 39 | { 40 | "name": ".NET Core Attach", 41 | "type": "coreclr", 42 | "request": "attach", 43 | "processId": "${command:pickProcess}" 44 | } 45 | ] 46 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OAuth 2.0 and OpenID Connect Debugger 2 | 3 | :earth_americas: Live here: https://oauthdebugger.com or https://oidcdebugger.com 4 | 5 | ## What is this? 6 | 7 | Read the blog post: [Introducing the OpenID Connect Debugger](https://www.recaffeinate.co/post/introducing-openid-connect-debugger/) 8 | 9 | Getting an OAuth or OpenID Connect flow working properly can be tricky. There's a bunch of parameters you need to get right, and it's not always easy to capture or parse errors. I wrote this little web tool to make the process easier. 10 | 11 | ## How to use the debugger 12 | 13 | All you need to do is temporarily set your OAuth client redirect URI to `https://oidcdebugger.com/debug` (or `https://oauthdebugger.com/debug`): 14 | 15 | Temporarily change client redirect URI to debugger 16 | 17 | Then, build a request to your authorization server using the debugger, and fire it off: 18 | 19 | Choose response mode and click Send Request 20 | 21 | The debugger will capture the callback and help you understand what happened (whether success or failure): 22 | 23 | Decode the error message, or view the successful callback information 24 | 25 | ## Contributing 26 | 27 | Issues and PRs are welcome! The project is built with ASP.NET Core and Vue.js. 28 | 29 | To build and run locally, 30 | 31 | ``` 32 | git clone https://github.com/nbarbettini/oidc-debugger 33 | cd oidc-debugger 34 | dotnet build 35 | dotnet run 36 | ``` 37 | -------------------------------------------------------------------------------- /OidcDebugger/Views/Shared/utils.js: -------------------------------------------------------------------------------- 1 | export function removeTrailingSlash(s) { 2 | if (!s || !s.length) return s; 3 | 4 | return s.substr(-1) === '/' 5 | ? s.substr(0, s.length - 1) 6 | : s; 7 | } 8 | 9 | export function randomness() { 10 | return Math.random().toString(36).substring(2); 11 | } 12 | 13 | export function randomString(length) { 14 | var result = ''; 15 | var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; 16 | var charactersLength = characters.length; 17 | for (var i = 0; i < length; i++) { 18 | result += characters.charAt(Math.floor(Math.random() * 19 | charactersLength)); 20 | } 21 | return result; 22 | } 23 | 24 | export function hash(codeChallengeMethod, plainText) { 25 | if (codeChallengeMethod == 'plain') 26 | return Promise.resolve(plainText); 27 | 28 | else if (codeChallengeMethod == 'disabled') 29 | return Promise.resolve('disabled'); 30 | 31 | else { 32 | var encoder = new TextEncoder(); 33 | var algorithm = getAlgorithm(codeChallengeMethod); 34 | 35 | return window.crypto.subtle.digest(algorithm, encoder.encode(plainText)) 36 | .then(digest => { 37 | var hash = String.fromCharCode.apply(null, new Uint8Array(digest)); 38 | const b64 = btoa(hash); 39 | return b64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, ''); 40 | }).catch(err => { 41 | console.log(err) 42 | }); 43 | } 44 | } 45 | 46 | function getAlgorithm(codeChallengeMethod) { 47 | switch (codeChallengeMethod) { 48 | case 'S256': 49 | return 'SHA-256'; 50 | default: 51 | return null; 52 | } 53 | } 54 | 55 | // Courtesy of https://stackoverflow.com/a/21152762/3191599 56 | export function querystringAsDictionary(qs) { 57 | var dict = {}; 58 | if (qs) qs.substr(1).split("&").forEach(function (item) { 59 | var s = item.split("="), 60 | k = s[0], 61 | v = s[1] && decodeURIComponent(s[1]); 62 | (dict[k] = dict[k] || []).push(v) 63 | }); 64 | return dict; 65 | } 66 | 67 | // Unescapes a limited number of known HTML entity codes 68 | export function safeUnescape(s) { 69 | return s.replace(new RegExp(''', 'g'), "'"); 70 | } 71 | 72 | export default { 73 | hash, 74 | removeTrailingSlash, 75 | randomness, 76 | randomString, 77 | querystringAsDictionary, 78 | safeUnescape 79 | } 80 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var webpack = require('webpack') 3 | var fs = require('fs') 4 | 5 | var appBasePath = './OidcDebugger/Views/' 6 | 7 | var jsEntries = {} 8 | // We search for index.js files inside basePath folder and make those as entries 9 | fs.readdirSync(appBasePath).forEach(function (name) { 10 | var indexFile = appBasePath + name + '/index.js' 11 | if (fs.existsSync(indexFile)) { 12 | jsEntries[name] = indexFile 13 | } 14 | }) 15 | 16 | module.exports = { 17 | entry: jsEntries, 18 | output: { 19 | path: path.resolve(__dirname, './OidcDebugger/wwwroot/bundle/'), 20 | publicPath: '/OidcDebugger/wwwroot/bundle/', 21 | filename: '[name].js' 22 | }, 23 | resolve: { 24 | extensions: ['.js', '.vue', '.json'], 25 | alias: { 26 | 'vue$': 'vue/dist/vue.esm.js', 27 | '@': path.join(__dirname, appBasePath) 28 | } 29 | }, 30 | module: { 31 | loaders: [ 32 | { 33 | test: /\.vue$/, 34 | loader: 'vue-loader', 35 | options: { 36 | loaders: { 37 | scss: 'vue-style-loader!css-loader!sass-loader', //