├── .gitattributes ├── .gitignore ├── .vscode ├── launch.json └── tasks.json ├── 01-02.pptx ├── 01. Client Credentials Grant - ConsoleClient ├── 01-02.pptx ├── Api1Resource │ ├── .gitignore │ ├── Api1Resource.csproj │ ├── Api1Resource.sln │ ├── Controllers │ │ └── IdentityController.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Startup.cs │ ├── appsettings.Development.json │ └── appsettings.json ├── ConsoleClient │ ├── .gitignore │ ├── ConsoleClient.sln │ └── ConsoleClient │ │ ├── ConsoleClient.csproj │ │ └── Program.cs └── Idp │ ├── Config.cs │ ├── Idp.csproj │ ├── Idp.sln │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── Quickstart │ ├── Account │ │ ├── AccountController.cs │ │ ├── AccountOptions.cs │ │ ├── ExternalController.cs │ │ ├── ExternalProvider.cs │ │ ├── LoggedOutViewModel.cs │ │ ├── LoginInputModel.cs │ │ ├── LoginViewModel.cs │ │ ├── LogoutInputModel.cs │ │ ├── LogoutViewModel.cs │ │ └── RedirectViewModel.cs │ ├── Consent │ │ ├── ConsentController.cs │ │ ├── ConsentInputModel.cs │ │ ├── ConsentOptions.cs │ │ ├── ConsentViewModel.cs │ │ ├── ProcessConsentResult.cs │ │ └── ScopeViewModel.cs │ ├── Device │ │ ├── DeviceAuthorizationInputModel.cs │ │ ├── DeviceAuthorizationViewModel.cs │ │ └── DeviceController.cs │ ├── Diagnostics │ │ ├── DiagnosticsController.cs │ │ └── DiagnosticsViewModel.cs │ ├── Extensions.cs │ ├── Grants │ │ ├── GrantsController.cs │ │ └── GrantsViewModel.cs │ ├── Home │ │ ├── ErrorViewModel.cs │ │ └── HomeController.cs │ ├── SecurityHeadersAttribute.cs │ └── TestUsers.cs │ ├── Startup.cs │ ├── Views │ ├── Account │ │ ├── LoggedOut.cshtml │ │ ├── Login.cshtml │ │ └── Logout.cshtml │ ├── Consent │ │ ├── Index.cshtml │ │ └── _ScopeListItem.cshtml │ ├── Device │ │ ├── Success.cshtml │ │ ├── UserCodeCapture.cshtml │ │ └── UserCodeConfirmation.cshtml │ ├── Diagnostics │ │ └── Index.cshtml │ ├── Grants │ │ └── Index.cshtml │ ├── Home │ │ └── Index.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ ├── Redirect.cshtml │ │ ├── _Layout.cshtml │ │ ├── _ScopeListItem.cshtml │ │ └── _ValidationSummary.cshtml │ ├── _ViewImports.cshtml │ └── _ViewStart.cshtml │ ├── appsettings.json │ ├── tempkey.rsa │ ├── updateUI.ps1 │ └── wwwroot │ ├── css │ ├── site.css │ ├── site.less │ └── site.min.css │ ├── favicon.ico │ ├── icon.jpg │ ├── icon.png │ ├── js │ ├── signin-redirect.js │ └── signout-redirect.js │ └── lib │ ├── bootstrap │ ├── css │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ └── bootstrap.min.css │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ └── js │ │ ├── bootstrap.js │ │ └── bootstrap.min.js │ └── jquery │ ├── jquery.js │ ├── jquery.min.js │ └── jquery.min.map ├── 02. Password Grant - WpfClient ├── Idp │ ├── .gitignore │ ├── Config.cs │ ├── Idp.csproj │ ├── Idp.sln │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Quickstart │ │ ├── Account │ │ │ ├── AccountController.cs │ │ │ ├── AccountOptions.cs │ │ │ ├── ExternalController.cs │ │ │ ├── ExternalProvider.cs │ │ │ ├── LoggedOutViewModel.cs │ │ │ ├── LoginInputModel.cs │ │ │ ├── LoginViewModel.cs │ │ │ ├── LogoutInputModel.cs │ │ │ ├── LogoutViewModel.cs │ │ │ └── RedirectViewModel.cs │ │ ├── Consent │ │ │ ├── ConsentController.cs │ │ │ ├── ConsentInputModel.cs │ │ │ ├── ConsentOptions.cs │ │ │ ├── ConsentViewModel.cs │ │ │ ├── ProcessConsentResult.cs │ │ │ └── ScopeViewModel.cs │ │ ├── Device │ │ │ ├── DeviceAuthorizationInputModel.cs │ │ │ ├── DeviceAuthorizationViewModel.cs │ │ │ └── DeviceController.cs │ │ ├── Diagnostics │ │ │ ├── DiagnosticsController.cs │ │ │ └── DiagnosticsViewModel.cs │ │ ├── Extensions.cs │ │ ├── Grants │ │ │ ├── GrantsController.cs │ │ │ └── GrantsViewModel.cs │ │ ├── Home │ │ │ ├── ErrorViewModel.cs │ │ │ └── HomeController.cs │ │ ├── SecurityHeadersAttribute.cs │ │ └── TestUsers.cs │ ├── Startup.cs │ ├── Views │ │ ├── Account │ │ │ ├── LoggedOut.cshtml │ │ │ ├── Login.cshtml │ │ │ └── Logout.cshtml │ │ ├── Consent │ │ │ ├── Index.cshtml │ │ │ └── _ScopeListItem.cshtml │ │ ├── Device │ │ │ ├── Success.cshtml │ │ │ ├── UserCodeCapture.cshtml │ │ │ └── UserCodeConfirmation.cshtml │ │ ├── Diagnostics │ │ │ └── Index.cshtml │ │ ├── Grants │ │ │ └── Index.cshtml │ │ ├── Home │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── Redirect.cshtml │ │ │ ├── _Layout.cshtml │ │ │ ├── _ScopeListItem.cshtml │ │ │ └── _ValidationSummary.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── appsettings.json │ ├── identityserver4_log.txt │ ├── tempkey.rsa │ ├── updateUI.ps1 │ └── wwwroot │ │ ├── css │ │ ├── site.css │ │ ├── site.less │ │ └── site.min.css │ │ ├── favicon.ico │ │ ├── icon.jpg │ │ ├── icon.png │ │ └── js │ │ ├── signin-redirect.js │ │ └── signout-redirect.js └── WpfClient │ ├── .gitignore │ ├── WpfClient.sln │ ├── WpfClient.sln.DotSettings │ └── WpfClient │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── Properties │ ├── Annotations.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── WpfClient.csproj │ └── packages.config ├── 03-04. Authorization Code Flow - MVC Client ├── Idp │ ├── .gitignore │ ├── Config.cs │ ├── Idp.csproj │ ├── Idp.sln │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Quickstart │ │ ├── Account │ │ │ ├── AccountController.cs │ │ │ ├── AccountOptions.cs │ │ │ ├── ExternalController.cs │ │ │ ├── ExternalProvider.cs │ │ │ ├── LoggedOutViewModel.cs │ │ │ ├── LoginInputModel.cs │ │ │ ├── LoginViewModel.cs │ │ │ ├── LogoutInputModel.cs │ │ │ ├── LogoutViewModel.cs │ │ │ └── RedirectViewModel.cs │ │ ├── Consent │ │ │ ├── ConsentController.cs │ │ │ ├── ConsentInputModel.cs │ │ │ ├── ConsentOptions.cs │ │ │ ├── ConsentViewModel.cs │ │ │ ├── ProcessConsentResult.cs │ │ │ └── ScopeViewModel.cs │ │ ├── Device │ │ │ ├── DeviceAuthorizationInputModel.cs │ │ │ ├── DeviceAuthorizationViewModel.cs │ │ │ └── DeviceController.cs │ │ ├── Diagnostics │ │ │ ├── DiagnosticsController.cs │ │ │ └── DiagnosticsViewModel.cs │ │ ├── Extensions.cs │ │ ├── Grants │ │ │ ├── GrantsController.cs │ │ │ └── GrantsViewModel.cs │ │ ├── Home │ │ │ ├── ErrorViewModel.cs │ │ │ └── HomeController.cs │ │ ├── SecurityHeadersAttribute.cs │ │ └── TestUsers.cs │ ├── Startup.cs │ ├── Views │ │ ├── Account │ │ │ ├── LoggedOut.cshtml │ │ │ ├── Login.cshtml │ │ │ └── Logout.cshtml │ │ ├── Consent │ │ │ ├── Index.cshtml │ │ │ └── _ScopeListItem.cshtml │ │ ├── Device │ │ │ ├── Success.cshtml │ │ │ ├── UserCodeCapture.cshtml │ │ │ └── UserCodeConfirmation.cshtml │ │ ├── Diagnostics │ │ │ └── Index.cshtml │ │ ├── Grants │ │ │ └── Index.cshtml │ │ ├── Home │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── Redirect.cshtml │ │ │ ├── _Layout.cshtml │ │ │ ├── _ScopeListItem.cshtml │ │ │ └── _ValidationSummary.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── appsettings.json │ ├── identityserver4_log.txt │ ├── tempkey.rsa │ ├── updateUI.ps1 │ └── wwwroot │ │ ├── css │ │ ├── site.css │ │ ├── site.less │ │ └── site.min.css │ │ ├── favicon.ico │ │ ├── icon.jpg │ │ ├── icon.png │ │ └── js │ │ ├── signin-redirect.js │ │ └── signout-redirect.js └── MvcClient │ ├── MvcClient.sln │ └── MvcClient │ ├── Controllers │ └── HomeController.cs │ ├── Models │ └── ErrorViewModel.cs │ ├── MvcClient.csproj │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── Startup.cs │ ├── Views │ ├── Home │ │ ├── Index.cshtml │ │ └── Privacy.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ ├── _CookieConsentPartial.cshtml │ │ ├── _Layout.cshtml │ │ └── _ValidationScriptsPartial.cshtml │ ├── _ViewImports.cshtml │ └── _ViewStart.cshtml │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ ├── css │ └── site.css │ ├── favicon.ico │ ├── js │ └── site.js │ └── lib │ ├── bootstrap │ ├── LICENSE │ └── dist │ │ ├── css │ │ ├── bootstrap-grid.css │ │ ├── bootstrap-grid.css.map │ │ ├── bootstrap-grid.min.css │ │ ├── bootstrap-grid.min.css.map │ │ ├── bootstrap-reboot.css │ │ ├── bootstrap-reboot.css.map │ │ ├── bootstrap-reboot.min.css │ │ ├── bootstrap-reboot.min.css.map │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ │ └── js │ │ ├── bootstrap.bundle.js │ │ ├── bootstrap.bundle.js.map │ │ ├── bootstrap.bundle.min.js │ │ ├── bootstrap.bundle.min.js.map │ │ ├── bootstrap.js │ │ ├── bootstrap.js.map │ │ ├── bootstrap.min.js │ │ └── bootstrap.min.js.map │ ├── jquery-validation-unobtrusive │ ├── LICENSE.txt │ ├── jquery.validate.unobtrusive.js │ └── jquery.validate.unobtrusive.min.js │ ├── jquery-validation │ ├── LICENSE.md │ └── dist │ │ ├── additional-methods.js │ │ ├── additional-methods.min.js │ │ ├── jquery.validate.js │ │ └── jquery.validate.min.js │ └── jquery │ ├── LICENSE.txt │ └── dist │ ├── jquery.js │ ├── jquery.min.js │ └── jquery.min.map ├── 03-04.pptx ├── 05-06.pptx ├── 05. Implicit Flow - Angular Client Start ├── Api1Resource │ ├── .gitignore │ ├── Api1Resource.csproj │ ├── Api1Resource.sln │ ├── Controllers │ │ ├── IdentityController.cs │ │ └── ToDoController.cs │ ├── Models │ │ ├── ToDo.cs │ │ └── ToDoEdit.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Startup.cs │ ├── appsettings.Development.json │ └── appsettings.json ├── Idp │ ├── .gitignore │ ├── Config.cs │ ├── Idp.csproj │ ├── Idp.sln │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Quickstart │ │ ├── Account │ │ │ ├── AccountController.cs │ │ │ ├── AccountOptions.cs │ │ │ ├── ExternalController.cs │ │ │ ├── ExternalProvider.cs │ │ │ ├── LoggedOutViewModel.cs │ │ │ ├── LoginInputModel.cs │ │ │ ├── LoginViewModel.cs │ │ │ ├── LogoutInputModel.cs │ │ │ ├── LogoutViewModel.cs │ │ │ └── RedirectViewModel.cs │ │ ├── Consent │ │ │ ├── ConsentController.cs │ │ │ ├── ConsentInputModel.cs │ │ │ ├── ConsentOptions.cs │ │ │ ├── ConsentViewModel.cs │ │ │ ├── ProcessConsentResult.cs │ │ │ └── ScopeViewModel.cs │ │ ├── Device │ │ │ ├── DeviceAuthorizationInputModel.cs │ │ │ ├── DeviceAuthorizationViewModel.cs │ │ │ └── DeviceController.cs │ │ ├── Diagnostics │ │ │ ├── DiagnosticsController.cs │ │ │ └── DiagnosticsViewModel.cs │ │ ├── Extensions.cs │ │ ├── Grants │ │ │ ├── GrantsController.cs │ │ │ └── GrantsViewModel.cs │ │ ├── Home │ │ │ ├── ErrorViewModel.cs │ │ │ └── HomeController.cs │ │ ├── SecurityHeadersAttribute.cs │ │ └── TestUsers.cs │ ├── Startup.cs │ ├── Views │ │ ├── Account │ │ │ ├── LoggedOut.cshtml │ │ │ ├── Login.cshtml │ │ │ └── Logout.cshtml │ │ ├── Consent │ │ │ ├── Index.cshtml │ │ │ └── _ScopeListItem.cshtml │ │ ├── Device │ │ │ ├── Success.cshtml │ │ │ ├── UserCodeCapture.cshtml │ │ │ └── UserCodeConfirmation.cshtml │ │ ├── Diagnostics │ │ │ └── Index.cshtml │ │ ├── Grants │ │ │ └── Index.cshtml │ │ ├── Home │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── Redirect.cshtml │ │ │ ├── _Layout.cshtml │ │ │ ├── _ScopeListItem.cshtml │ │ │ └── _ValidationSummary.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── appsettings.json │ ├── identityserver4_log.txt │ ├── tempkey.rsa │ ├── updateUI.ps1 │ └── wwwroot │ │ ├── css │ │ ├── site.css │ │ ├── site.less │ │ └── site.min.css │ │ ├── favicon.ico │ │ ├── icon.jpg │ │ ├── icon.png │ │ └── js │ │ ├── signin-redirect.js │ │ └── signout-redirect.js └── angular-client │ ├── .editorconfig │ ├── .gitignore │ ├── README.md │ ├── angular.json │ ├── e2e │ ├── protractor.conf.js │ ├── src │ │ ├── app.e2e-spec.ts │ │ └── app.po.ts │ └── tsconfig.e2e.json │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── app │ │ ├── app-routing.module.ts │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── components │ │ │ ├── add-todo │ │ │ │ ├── add-todo.component.css │ │ │ │ ├── add-todo.component.html │ │ │ │ ├── add-todo.component.spec.ts │ │ │ │ └── add-todo.component.ts │ │ │ ├── dashboard │ │ │ │ ├── dashboard.component.css │ │ │ │ ├── dashboard.component.html │ │ │ │ ├── dashboard.component.spec.ts │ │ │ │ └── dashboard.component.ts │ │ │ ├── navbar │ │ │ │ ├── navbar.component.html │ │ │ │ ├── navbar.component.scss │ │ │ │ ├── navbar.component.spec.ts │ │ │ │ └── navbar.component.ts │ │ │ └── todo-table │ │ │ │ ├── todo-table.component.html │ │ │ │ ├── todo-table.component.scss │ │ │ │ ├── todo-table.component.spec.ts │ │ │ │ └── todo-table.component.ts │ │ ├── models │ │ │ ├── todo-add.ts │ │ │ └── todo.ts │ │ └── services │ │ │ ├── todo.service.spec.ts │ │ │ └── todo.service.ts │ ├── assets │ │ └── .gitkeep │ ├── browserslist │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── karma.conf.js │ ├── main.ts │ ├── polyfills.ts │ ├── styles.scss │ ├── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ └── tslint.json │ ├── tsconfig.json │ └── tslint.json ├── 06. Implicit Flow - Angular Client Finish ├── Api1Resource │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── Api1Resource.csproj │ ├── Api1Resource.sln │ ├── Controllers │ │ ├── IdentityController.cs │ │ └── ToDoController.cs │ ├── Models │ │ ├── ToDo.cs │ │ └── ToDoEdit.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Startup.cs │ ├── appsettings.Development.json │ └── appsettings.json ├── Idp │ ├── .gitignore │ ├── Config.cs │ ├── Idp.csproj │ ├── Idp.sln │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Quickstart │ │ ├── Account │ │ │ ├── AccountController.cs │ │ │ ├── AccountOptions.cs │ │ │ ├── ExternalController.cs │ │ │ ├── ExternalProvider.cs │ │ │ ├── LoggedOutViewModel.cs │ │ │ ├── LoginInputModel.cs │ │ │ ├── LoginViewModel.cs │ │ │ ├── LogoutInputModel.cs │ │ │ ├── LogoutViewModel.cs │ │ │ └── RedirectViewModel.cs │ │ ├── Consent │ │ │ ├── ConsentController.cs │ │ │ ├── ConsentInputModel.cs │ │ │ ├── ConsentOptions.cs │ │ │ ├── ConsentViewModel.cs │ │ │ ├── ProcessConsentResult.cs │ │ │ └── ScopeViewModel.cs │ │ ├── Device │ │ │ ├── DeviceAuthorizationInputModel.cs │ │ │ ├── DeviceAuthorizationViewModel.cs │ │ │ └── DeviceController.cs │ │ ├── Diagnostics │ │ │ ├── DiagnosticsController.cs │ │ │ └── DiagnosticsViewModel.cs │ │ ├── Extensions.cs │ │ ├── Grants │ │ │ ├── GrantsController.cs │ │ │ └── GrantsViewModel.cs │ │ ├── Home │ │ │ ├── ErrorViewModel.cs │ │ │ └── HomeController.cs │ │ ├── SecurityHeadersAttribute.cs │ │ └── TestUsers.cs │ ├── Startup.cs │ ├── Views │ │ ├── Account │ │ │ ├── LoggedOut.cshtml │ │ │ ├── Login.cshtml │ │ │ └── Logout.cshtml │ │ ├── Consent │ │ │ ├── Index.cshtml │ │ │ └── _ScopeListItem.cshtml │ │ ├── Device │ │ │ ├── Success.cshtml │ │ │ ├── UserCodeCapture.cshtml │ │ │ └── UserCodeConfirmation.cshtml │ │ ├── Diagnostics │ │ │ └── Index.cshtml │ │ ├── Grants │ │ │ └── Index.cshtml │ │ ├── Home │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── Redirect.cshtml │ │ │ ├── _Layout.cshtml │ │ │ ├── _ScopeListItem.cshtml │ │ │ └── _ValidationSummary.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── appsettings.json │ ├── identityserver4_log.txt │ ├── tempkey.rsa │ ├── updateUI.ps1 │ └── wwwroot │ │ ├── css │ │ ├── site.css │ │ ├── site.less │ │ └── site.min.css │ │ ├── favicon.ico │ │ ├── icon.jpg │ │ ├── icon.png │ │ └── js │ │ ├── signin-redirect.js │ │ └── signout-redirect.js └── angular-client │ ├── .editorconfig │ ├── .gitignore │ ├── README.md │ ├── angular.json │ ├── e2e │ ├── protractor.conf.js │ ├── src │ │ ├── app.e2e-spec.ts │ │ └── app.po.ts │ └── tsconfig.e2e.json │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── app │ │ ├── app-routing.module.ts │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── components │ │ │ ├── add-todo │ │ │ │ ├── add-todo.component.css │ │ │ │ ├── add-todo.component.html │ │ │ │ ├── add-todo.component.spec.ts │ │ │ │ └── add-todo.component.ts │ │ │ ├── dashboard │ │ │ │ ├── dashboard.component.css │ │ │ │ ├── dashboard.component.html │ │ │ │ ├── dashboard.component.spec.ts │ │ │ │ └── dashboard.component.ts │ │ │ ├── navbar │ │ │ │ ├── navbar.component.html │ │ │ │ ├── navbar.component.scss │ │ │ │ ├── navbar.component.spec.ts │ │ │ │ └── navbar.component.ts │ │ │ └── todo-table │ │ │ │ ├── todo-table.component.html │ │ │ │ ├── todo-table.component.scss │ │ │ │ ├── todo-table.component.spec.ts │ │ │ │ └── todo-table.component.ts │ │ ├── models │ │ │ ├── todo-add.ts │ │ │ └── todo.ts │ │ ├── oidc │ │ │ ├── authorization-header.interceptor.ts │ │ │ ├── open-id-connect.service.spec.ts │ │ │ ├── open-id-connect.service.ts │ │ │ ├── redirect-silent-renew │ │ │ │ ├── redirect-silent-renew.component.html │ │ │ │ ├── redirect-silent-renew.component.scss │ │ │ │ ├── redirect-silent-renew.component.spec.ts │ │ │ │ └── redirect-silent-renew.component.ts │ │ │ └── signin-oidc │ │ │ │ ├── signin-oidc.component.html │ │ │ │ ├── signin-oidc.component.scss │ │ │ │ ├── signin-oidc.component.spec.ts │ │ │ │ └── signin-oidc.component.ts │ │ └── services │ │ │ ├── todo.service.spec.ts │ │ │ └── todo.service.ts │ ├── assets │ │ └── .gitkeep │ ├── browserslist │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── karma.conf.js │ ├── main.ts │ ├── polyfills.ts │ ├── styles.scss │ ├── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ └── tslint.json │ ├── tsconfig.json │ └── tslint.json ├── 07-08. Hybrid Flow - MVC Client ├── Api1Resource │ ├── .gitignore │ ├── Api1Resource.csproj │ ├── Api1Resource.sln │ ├── Controllers │ │ ├── IdentityController.cs │ │ └── ToDoController.cs │ ├── Models │ │ ├── ToDo.cs │ │ └── ToDoEdit.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Startup.cs │ ├── appsettings.Development.json │ └── appsettings.json ├── HybridMvcClient │ ├── .gitignore │ ├── HybridClient.sln │ └── HybridClient │ │ ├── Auths │ │ ├── SmithInSomewareRequirement.cs │ │ └── SmithInSomewhereHandler.cs │ │ ├── Controllers │ │ ├── AuthorizationController.cs │ │ └── HomeController.cs │ │ ├── HybridClient.csproj │ │ ├── Models │ │ └── ErrorViewModel.cs │ │ ├── Program.cs │ │ ├── Properties │ │ └── launchSettings.json │ │ ├── Startup.cs │ │ ├── Views │ │ ├── Authorization │ │ │ └── AccessDenied.cshtml │ │ ├── Home │ │ │ ├── AccessApi1.cshtml │ │ │ ├── Index.cshtml │ │ │ └── Privacy.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _CookieConsentPartial.cshtml │ │ │ ├── _Layout.cshtml │ │ │ └── _ValidationScriptsPartial.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ └── wwwroot │ │ ├── css │ │ └── site.css │ │ ├── favicon.ico │ │ ├── js │ │ └── site.js │ │ └── lib │ │ ├── bootstrap │ │ ├── LICENSE │ │ └── dist │ │ │ ├── css │ │ │ ├── bootstrap-grid.css │ │ │ ├── bootstrap-grid.css.map │ │ │ ├── bootstrap-grid.min.css │ │ │ ├── bootstrap-grid.min.css.map │ │ │ ├── bootstrap-reboot.css │ │ │ ├── bootstrap-reboot.css.map │ │ │ ├── bootstrap-reboot.min.css │ │ │ ├── bootstrap-reboot.min.css.map │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ │ └── js │ │ │ ├── bootstrap.bundle.js │ │ │ ├── bootstrap.bundle.js.map │ │ │ ├── bootstrap.bundle.min.js │ │ │ ├── bootstrap.bundle.min.js.map │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.js.map │ │ │ ├── bootstrap.min.js │ │ │ └── bootstrap.min.js.map │ │ ├── jquery-validation-unobtrusive │ │ ├── LICENSE.txt │ │ ├── jquery.validate.unobtrusive.js │ │ └── jquery.validate.unobtrusive.min.js │ │ ├── jquery-validation │ │ ├── LICENSE.md │ │ └── dist │ │ │ ├── additional-methods.js │ │ │ ├── additional-methods.min.js │ │ │ ├── jquery.validate.js │ │ │ └── jquery.validate.min.js │ │ └── jquery │ │ ├── LICENSE.txt │ │ └── dist │ │ ├── jquery.js │ │ ├── jquery.min.js │ │ └── jquery.min.map └── Idp │ ├── .gitignore │ ├── Config.cs │ ├── Idp.csproj │ ├── Idp.sln │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── Quickstart │ ├── Account │ │ ├── AccountController.cs │ │ ├── AccountOptions.cs │ │ ├── ExternalController.cs │ │ ├── ExternalProvider.cs │ │ ├── LoggedOutViewModel.cs │ │ ├── LoginInputModel.cs │ │ ├── LoginViewModel.cs │ │ ├── LogoutInputModel.cs │ │ ├── LogoutViewModel.cs │ │ └── RedirectViewModel.cs │ ├── Consent │ │ ├── ConsentController.cs │ │ ├── ConsentInputModel.cs │ │ ├── ConsentOptions.cs │ │ ├── ConsentViewModel.cs │ │ ├── ProcessConsentResult.cs │ │ └── ScopeViewModel.cs │ ├── Device │ │ ├── DeviceAuthorizationInputModel.cs │ │ ├── DeviceAuthorizationViewModel.cs │ │ └── DeviceController.cs │ ├── Diagnostics │ │ ├── DiagnosticsController.cs │ │ └── DiagnosticsViewModel.cs │ ├── Extensions.cs │ ├── Grants │ │ ├── GrantsController.cs │ │ └── GrantsViewModel.cs │ ├── Home │ │ ├── ErrorViewModel.cs │ │ └── HomeController.cs │ ├── SecurityHeadersAttribute.cs │ └── TestUsers.cs │ ├── Startup.cs │ ├── Views │ ├── Account │ │ ├── LoggedOut.cshtml │ │ ├── Login.cshtml │ │ └── Logout.cshtml │ ├── Consent │ │ ├── Index.cshtml │ │ └── _ScopeListItem.cshtml │ ├── Device │ │ ├── Success.cshtml │ │ ├── UserCodeCapture.cshtml │ │ └── UserCodeConfirmation.cshtml │ ├── Diagnostics │ │ └── Index.cshtml │ ├── Grants │ │ └── Index.cshtml │ ├── Home │ │ └── Index.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ ├── Redirect.cshtml │ │ ├── _Layout.cshtml │ │ ├── _ScopeListItem.cshtml │ │ └── _ValidationSummary.cshtml │ ├── _ViewImports.cshtml │ └── _ViewStart.cshtml │ ├── appsettings.json │ ├── identityserver4_log.txt │ ├── tempkey.rsa │ ├── updateUI.ps1 │ └── wwwroot │ ├── css │ ├── site.css │ ├── site.less │ └── site.min.css │ ├── favicon.ico │ ├── icon.jpg │ ├── icon.png │ └── js │ ├── signin-redirect.js │ └── signout-redirect.js ├── 07-08.pptx ├── 09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs ├── Api1Resource │ ├── .gitignore │ ├── Api1Resource.csproj │ ├── Api1Resource.sln │ ├── Controllers │ │ ├── IdentityController.cs │ │ └── ToDoController.cs │ ├── Models │ │ ├── ToDo.cs │ │ └── ToDoEdit.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Startup.cs │ ├── appsettings.Development.json │ └── appsettings.json ├── ConsoleClient │ ├── .gitignore │ ├── ConsoleClient.sln │ └── ConsoleClient │ │ ├── ConsoleClient.csproj │ │ └── Program.cs ├── FlaskClient │ ├── client_secrets.json │ └── hello.py ├── HybridMvcClient │ ├── .gitignore │ ├── HybridClient.sln │ └── HybridClient │ │ ├── Auths │ │ ├── SmithInSomewareRequirement.cs │ │ └── SmithInSomewhereHandler.cs │ │ ├── Controllers │ │ ├── AuthorizationController.cs │ │ └── HomeController.cs │ │ ├── HybridClient.csproj │ │ ├── Models │ │ └── ErrorViewModel.cs │ │ ├── Program.cs │ │ ├── Properties │ │ └── launchSettings.json │ │ ├── Startup.cs │ │ ├── Views │ │ ├── Authorization │ │ │ └── AccessDenied.cshtml │ │ ├── Home │ │ │ ├── AccessApi1.cshtml │ │ │ ├── Index.cshtml │ │ │ └── Privacy.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _CookieConsentPartial.cshtml │ │ │ ├── _Layout.cshtml │ │ │ └── _ValidationScriptsPartial.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ └── wwwroot │ │ ├── css │ │ └── site.css │ │ ├── favicon.ico │ │ ├── js │ │ └── site.js │ │ └── lib │ │ ├── bootstrap │ │ ├── LICENSE │ │ └── dist │ │ │ ├── css │ │ │ ├── bootstrap-grid.css │ │ │ ├── bootstrap-grid.css.map │ │ │ ├── bootstrap-grid.min.css │ │ │ ├── bootstrap-grid.min.css.map │ │ │ ├── bootstrap-reboot.css │ │ │ ├── bootstrap-reboot.css.map │ │ │ ├── bootstrap-reboot.min.css │ │ │ ├── bootstrap-reboot.min.css.map │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ │ └── js │ │ │ ├── bootstrap.bundle.js │ │ │ ├── bootstrap.bundle.js.map │ │ │ ├── bootstrap.bundle.min.js │ │ │ ├── bootstrap.bundle.min.js.map │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.js.map │ │ │ ├── bootstrap.min.js │ │ │ └── bootstrap.min.js.map │ │ ├── jquery-validation-unobtrusive │ │ ├── LICENSE.txt │ │ ├── jquery.validate.unobtrusive.js │ │ └── jquery.validate.unobtrusive.min.js │ │ ├── jquery-validation │ │ ├── LICENSE.md │ │ └── dist │ │ │ ├── additional-methods.js │ │ │ ├── additional-methods.min.js │ │ │ ├── jquery.validate.js │ │ │ └── jquery.validate.min.js │ │ └── jquery │ │ ├── LICENSE.txt │ │ └── dist │ │ ├── jquery.js │ │ ├── jquery.min.js │ │ └── jquery.min.map ├── Idp │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── Config.cs │ ├── Idp.csproj │ ├── Idp.sln │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Quickstart │ │ ├── Account │ │ │ ├── AccountController.cs │ │ │ ├── AccountOptions.cs │ │ │ ├── ExternalController.cs │ │ │ ├── ExternalProvider.cs │ │ │ ├── LoggedOutViewModel.cs │ │ │ ├── LoginInputModel.cs │ │ │ ├── LoginViewModel.cs │ │ │ ├── LogoutInputModel.cs │ │ │ ├── LogoutViewModel.cs │ │ │ └── RedirectViewModel.cs │ │ ├── Consent │ │ │ ├── ConsentController.cs │ │ │ ├── ConsentInputModel.cs │ │ │ ├── ConsentOptions.cs │ │ │ ├── ConsentViewModel.cs │ │ │ ├── ProcessConsentResult.cs │ │ │ └── ScopeViewModel.cs │ │ ├── Device │ │ │ ├── DeviceAuthorizationInputModel.cs │ │ │ ├── DeviceAuthorizationViewModel.cs │ │ │ └── DeviceController.cs │ │ ├── Diagnostics │ │ │ ├── DiagnosticsController.cs │ │ │ └── DiagnosticsViewModel.cs │ │ ├── Extensions.cs │ │ ├── Grants │ │ │ ├── GrantsController.cs │ │ │ └── GrantsViewModel.cs │ │ ├── Home │ │ │ ├── ErrorViewModel.cs │ │ │ └── HomeController.cs │ │ ├── SecurityHeadersAttribute.cs │ │ └── TestUsers.cs │ ├── Startup.cs │ ├── Views │ │ ├── Account │ │ │ ├── LoggedOut.cshtml │ │ │ ├── Login.cshtml │ │ │ └── Logout.cshtml │ │ ├── Consent │ │ │ ├── Index.cshtml │ │ │ └── _ScopeListItem.cshtml │ │ ├── Device │ │ │ ├── Success.cshtml │ │ │ ├── UserCodeCapture.cshtml │ │ │ └── UserCodeConfirmation.cshtml │ │ ├── Diagnostics │ │ │ └── Index.cshtml │ │ ├── Grants │ │ │ └── Index.cshtml │ │ ├── Home │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── Redirect.cshtml │ │ │ ├── _Layout.cshtml │ │ │ ├── _ScopeListItem.cshtml │ │ │ └── _ValidationSummary.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── appsettings.json │ ├── identityserver4_log.txt │ ├── tempkey.rsa │ ├── updateUI.ps1 │ └── wwwroot │ │ ├── css │ │ ├── site.css │ │ ├── site.less │ │ └── site.min.css │ │ ├── favicon.ico │ │ ├── icon.jpg │ │ ├── icon.png │ │ └── js │ │ ├── signin-redirect.js │ │ └── signout-redirect.js ├── MvcClient │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── MvcClient.sln │ └── MvcClient │ │ ├── Controllers │ │ └── HomeController.cs │ │ ├── Models │ │ └── ErrorViewModel.cs │ │ ├── MvcClient.csproj │ │ ├── Program.cs │ │ ├── Properties │ │ └── launchSettings.json │ │ ├── Startup.cs │ │ ├── Views │ │ ├── Home │ │ │ ├── AccessApis.cshtml │ │ │ ├── Index.cshtml │ │ │ └── Privacy.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _CookieConsentPartial.cshtml │ │ │ ├── _Layout.cshtml │ │ │ └── _ValidationScriptsPartial.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ └── wwwroot │ │ ├── css │ │ └── site.css │ │ ├── favicon.ico │ │ ├── js │ │ └── site.js │ │ └── lib │ │ ├── bootstrap │ │ ├── LICENSE │ │ └── dist │ │ │ ├── css │ │ │ ├── bootstrap-grid.css │ │ │ ├── bootstrap-grid.css.map │ │ │ ├── bootstrap-grid.min.css │ │ │ ├── bootstrap-grid.min.css.map │ │ │ ├── bootstrap-reboot.css │ │ │ ├── bootstrap-reboot.css.map │ │ │ ├── bootstrap-reboot.min.css │ │ │ ├── bootstrap-reboot.min.css.map │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ ├── bootstrap.min.css │ │ │ └── bootstrap.min.css.map │ │ │ └── js │ │ │ ├── bootstrap.bundle.js │ │ │ ├── bootstrap.bundle.js.map │ │ │ ├── bootstrap.bundle.min.js │ │ │ ├── bootstrap.bundle.min.js.map │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.js.map │ │ │ ├── bootstrap.min.js │ │ │ └── bootstrap.min.js.map │ │ ├── jquery-validation-unobtrusive │ │ ├── LICENSE.txt │ │ ├── jquery.validate.unobtrusive.js │ │ └── jquery.validate.unobtrusive.min.js │ │ ├── jquery-validation │ │ ├── LICENSE.md │ │ └── dist │ │ │ ├── additional-methods.js │ │ │ ├── additional-methods.min.js │ │ │ ├── jquery.validate.js │ │ │ └── jquery.validate.min.js │ │ └── jquery │ │ ├── LICENSE.txt │ │ └── dist │ │ ├── jquery.js │ │ ├── jquery.min.js │ │ └── jquery.min.map ├── WpfClient │ ├── .gitignore │ ├── WpfClient.sln │ ├── WpfClient.sln.DotSettings │ └── WpfClient │ │ ├── App.config │ │ ├── App.xaml │ │ ├── App.xaml.cs │ │ ├── MainWindow.xaml │ │ ├── MainWindow.xaml.cs │ │ ├── Properties │ │ ├── Annotations.cs │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ │ ├── WpfClient.csproj │ │ └── packages.config ├── angular-client │ ├── .editorconfig │ ├── .gitignore │ ├── README.md │ ├── angular.json │ ├── e2e │ │ ├── protractor.conf.js │ │ ├── src │ │ │ ├── app.e2e-spec.ts │ │ │ └── app.po.ts │ │ └── tsconfig.e2e.json │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── app │ │ │ ├── app-routing.module.ts │ │ │ ├── app.component.html │ │ │ ├── app.component.scss │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ ├── app.module.ts │ │ │ ├── components │ │ │ │ ├── add-todo │ │ │ │ │ ├── add-todo.component.css │ │ │ │ │ ├── add-todo.component.html │ │ │ │ │ ├── add-todo.component.spec.ts │ │ │ │ │ └── add-todo.component.ts │ │ │ │ ├── dashboard │ │ │ │ │ ├── dashboard.component.css │ │ │ │ │ ├── dashboard.component.html │ │ │ │ │ ├── dashboard.component.spec.ts │ │ │ │ │ └── dashboard.component.ts │ │ │ │ ├── navbar │ │ │ │ │ ├── navbar.component.html │ │ │ │ │ ├── navbar.component.scss │ │ │ │ │ ├── navbar.component.spec.ts │ │ │ │ │ └── navbar.component.ts │ │ │ │ └── todo-table │ │ │ │ │ ├── todo-table.component.html │ │ │ │ │ ├── todo-table.component.scss │ │ │ │ │ ├── todo-table.component.spec.ts │ │ │ │ │ └── todo-table.component.ts │ │ │ ├── models │ │ │ │ ├── todo-add.ts │ │ │ │ └── todo.ts │ │ │ ├── oidc │ │ │ │ ├── authorization-header.interceptor.ts │ │ │ │ ├── open-id-connect.service.spec.ts │ │ │ │ ├── open-id-connect.service.ts │ │ │ │ ├── redirect-silent-renew │ │ │ │ │ ├── redirect-silent-renew.component.html │ │ │ │ │ ├── redirect-silent-renew.component.scss │ │ │ │ │ ├── redirect-silent-renew.component.spec.ts │ │ │ │ │ └── redirect-silent-renew.component.ts │ │ │ │ └── signin-oidc │ │ │ │ │ ├── signin-oidc.component.html │ │ │ │ │ ├── signin-oidc.component.scss │ │ │ │ │ ├── signin-oidc.component.spec.ts │ │ │ │ │ └── signin-oidc.component.ts │ │ │ └── services │ │ │ │ ├── todo.service.spec.ts │ │ │ │ └── todo.service.ts │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── browserslist │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── karma.conf.js │ │ ├── main.ts │ │ ├── polyfills.ts │ │ ├── styles.scss │ │ ├── test.ts │ │ ├── tsconfig.app.json │ │ ├── tsconfig.spec.json │ │ └── tslint.json │ ├── tsconfig.json │ └── tslint.json └── expressAPI │ ├── index.js │ ├── package-lock.json │ └── package.json └── README.md /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dotnet", 7 | "type": "process", 8 | "args": [ 9 | "build", 10 | "${workspaceFolder}/01. Client Credentials Grant - ConsoleClient/ConsoleClient/ConsoleClient/ConsoleClient.csproj" 11 | ], 12 | "problemMatcher": "$msCompile" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /01-02.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/01-02.pptx -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/01-02.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/01. Client Credentials Grant - ConsoleClient/01-02.pptx -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Api1Resource/Api1Resource.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.2 5 | InProcess 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Api1Resource/Controllers/IdentityController.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Microsoft.AspNetCore.Authorization; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace Api1Resource.Controllers 6 | { 7 | [Route("identity")] 8 | [Authorize] 9 | public class IdentityController : ControllerBase 10 | { 11 | [HttpGet] 12 | public IActionResult Get() 13 | { 14 | return new JsonResult( 15 | from c in User.Claims select new { c.Type, c.Value }); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Api1Resource/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace Api1Resource 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | CreateWebHostBuilder(args).Build().Run(); 18 | } 19 | 20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Api1Resource/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Api1Resource": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "applicationUrl": "http://localhost:5001", 7 | "environmentVariables": { 8 | "ASPNETCORE_ENVIRONMENT": "Development" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Api1Resource/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Api1Resource/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning" 5 | } 6 | }, 7 | "AllowedHosts": "*" 8 | } 9 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/ConsoleClient/ConsoleClient/ConsoleClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | netcoreapp2.2 6 | latest 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Idp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "SelfHost": { 4 | "commandName": "Project", 5 | "environmentVariables": { 6 | "ASPNETCORE_ENVIRONMENT": "Development" 7 | }, 8 | "applicationUrl": "http://localhost:5000" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Quickstart/Account/ExternalProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ExternalProvider 8 | { 9 | public string DisplayName { get; set; } 10 | public string AuthenticationScheme { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Quickstart/Account/LoginInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class LoginInputModel 10 | { 11 | [Required] 12 | public string Username { get; set; } 13 | [Required] 14 | public string Password { get; set; } 15 | public bool RememberLogin { get; set; } 16 | public string ReturnUrl { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Quickstart/Account/LogoutInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class LogoutInputModel 8 | { 9 | public string LogoutId { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Quickstart/Account/LogoutViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class LogoutViewModel : LogoutInputModel 8 | { 9 | public bool ShowLogoutPrompt { get; set; } = true; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Quickstart/Account/RedirectViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | 6 | namespace IdentityServer4.Quickstart.UI 7 | { 8 | public class RedirectViewModel 9 | { 10 | public string RedirectUrl { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Quickstart/Consent/ConsentInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.Collections.Generic; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ConsentInputModel 10 | { 11 | public string Button { get; set; } 12 | public IEnumerable ScopesConsented { get; set; } 13 | public bool RememberConsent { get; set; } 14 | public string ReturnUrl { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Quickstart/Consent/ProcessConsentResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ProcessConsentResult 8 | { 9 | public bool IsRedirect => RedirectUri != null; 10 | public string RedirectUri { get; set; } 11 | public string ClientId { get; set; } 12 | 13 | public bool ShowView => ViewModel != null; 14 | public ConsentViewModel ViewModel { get; set; } 15 | 16 | public bool HasValidationError => ValidationError != null; 17 | public string ValidationError { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Quickstart/Consent/ScopeViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ScopeViewModel 8 | { 9 | public string Name { get; set; } 10 | public string DisplayName { get; set; } 11 | public string Description { get; set; } 12 | public bool Emphasize { get; set; } 13 | public bool Required { get; set; } 14 | public bool Checked { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Quickstart/Device/DeviceAuthorizationInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI.Device 6 | { 7 | public class DeviceAuthorizationInputModel : ConsentInputModel 8 | { 9 | public string UserCode { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Quickstart/Device/DeviceAuthorizationViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI.Device 6 | { 7 | public class DeviceAuthorizationViewModel : ConsentViewModel 8 | { 9 | public string UserCode { get; set; } 10 | public bool ConfirmUserCode { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Quickstart/Home/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using IdentityServer4.Models; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ErrorViewModel 10 | { 11 | public ErrorMessage Error { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Views/Account/Logout.cshtml: -------------------------------------------------------------------------------- 1 | @model LogoutViewModel 2 | 3 |
4 | 7 | 8 |
9 |
10 |

Would you like to logout of IdentityServer?

11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 |
19 |
20 |
21 |
-------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Views/Device/Success.cshtml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Views/Device/UserCodeCapture.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Views/Diagnostics/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model DiagnosticsViewModel 2 | 3 |

Authentication cookie

4 | 5 |

Claims

6 |
7 | @foreach (var claim in Model.AuthenticateResult.Principal.Claims) 8 | { 9 |
@claim.Type
10 |
@claim.Value
11 | } 12 |
13 | 14 |

Properties

15 |
16 | @foreach (var prop in Model.AuthenticateResult.Properties.Items) 17 | { 18 |
@prop.Key
19 |
@prop.Value
20 | } 21 |
22 | 23 | @if (Model.Clients.Any()) 24 | { 25 |

Clients

26 | 32 | } -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Views/Shared/Redirect.cshtml: -------------------------------------------------------------------------------- 1 | @model RedirectViewModel 2 | 3 |

You are now being returned to the application.

4 |

Once complete, you may close this tab

5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Views/Shared/_ValidationSummary.cshtml: -------------------------------------------------------------------------------- 1 | @if (ViewContext.ModelState.IsValid == false) 2 | { 3 |
4 | Error 5 |
6 |
7 | } -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using IdentityServer4.Quickstart.UI 2 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 3 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/favicon.ico -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/icon.jpg -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/icon.png -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/js/signin-redirect.js: -------------------------------------------------------------------------------- 1 | window.location.href = document.querySelector("meta[http-equiv=refresh]").getAttribute("data-url"); 2 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/js/signout-redirect.js: -------------------------------------------------------------------------------- 1 | window.addEventListener("load", function () { 2 | var a = document.querySelector("a.PostLogoutRedirectUri"); 3 | if (a) { 4 | window.location = a.href; 5 | } 6 | }); 7 | -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/01. Client Credentials Grant - ConsoleClient/Idp/wwwroot/lib/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Idp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "SelfHost": { 4 | "commandName": "Project", 5 | "environmentVariables": { 6 | "ASPNETCORE_ENVIRONMENT": "Development" 7 | }, 8 | "applicationUrl": "http://localhost:5000" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Quickstart/Account/ExternalProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ExternalProvider 8 | { 9 | public string DisplayName { get; set; } 10 | public string AuthenticationScheme { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Quickstart/Account/LoginInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class LoginInputModel 10 | { 11 | [Required] 12 | public string Username { get; set; } 13 | [Required] 14 | public string Password { get; set; } 15 | public bool RememberLogin { get; set; } 16 | public string ReturnUrl { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Quickstart/Account/LogoutInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class LogoutInputModel 8 | { 9 | public string LogoutId { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Quickstart/Account/LogoutViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class LogoutViewModel : LogoutInputModel 8 | { 9 | public bool ShowLogoutPrompt { get; set; } = true; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Quickstart/Account/RedirectViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | 6 | namespace IdentityServer4.Quickstart.UI 7 | { 8 | public class RedirectViewModel 9 | { 10 | public string RedirectUrl { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Quickstart/Consent/ConsentInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.Collections.Generic; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ConsentInputModel 10 | { 11 | public string Button { get; set; } 12 | public IEnumerable ScopesConsented { get; set; } 13 | public bool RememberConsent { get; set; } 14 | public string ReturnUrl { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Quickstart/Consent/ConsentViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.Collections.Generic; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ConsentViewModel : ConsentInputModel 10 | { 11 | public string ClientName { get; set; } 12 | public string ClientUrl { get; set; } 13 | public string ClientLogoUrl { get; set; } 14 | public bool AllowRememberConsent { get; set; } 15 | 16 | public IEnumerable IdentityScopes { get; set; } 17 | public IEnumerable ResourceScopes { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Quickstart/Consent/ProcessConsentResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ProcessConsentResult 8 | { 9 | public bool IsRedirect => RedirectUri != null; 10 | public string RedirectUri { get; set; } 11 | public string ClientId { get; set; } 12 | 13 | public bool ShowView => ViewModel != null; 14 | public ConsentViewModel ViewModel { get; set; } 15 | 16 | public bool HasValidationError => ValidationError != null; 17 | public string ValidationError { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Quickstart/Consent/ScopeViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ScopeViewModel 8 | { 9 | public string Name { get; set; } 10 | public string DisplayName { get; set; } 11 | public string Description { get; set; } 12 | public bool Emphasize { get; set; } 13 | public bool Required { get; set; } 14 | public bool Checked { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Quickstart/Device/DeviceAuthorizationInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI.Device 6 | { 7 | public class DeviceAuthorizationInputModel : ConsentInputModel 8 | { 9 | public string UserCode { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Quickstart/Device/DeviceAuthorizationViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI.Device 6 | { 7 | public class DeviceAuthorizationViewModel : ConsentViewModel 8 | { 9 | public string UserCode { get; set; } 10 | public bool ConfirmUserCode { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Quickstart/Home/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using IdentityServer4.Models; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ErrorViewModel 10 | { 11 | public ErrorMessage Error { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Views/Account/Logout.cshtml: -------------------------------------------------------------------------------- 1 | @model LogoutViewModel 2 | 3 |
4 | 7 | 8 |
9 |
10 |

Would you like to logout of IdentityServer?

11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 |
19 |
20 |
21 |
-------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Views/Device/Success.cshtml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Views/Device/UserCodeCapture.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Views/Diagnostics/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model DiagnosticsViewModel 2 | 3 |

Authentication cookie

4 | 5 |

Claims

6 |
7 | @foreach (var claim in Model.AuthenticateResult.Principal.Claims) 8 | { 9 |
@claim.Type
10 |
@claim.Value
11 | } 12 |
13 | 14 |

Properties

15 |
16 | @foreach (var prop in Model.AuthenticateResult.Properties.Items) 17 | { 18 |
@prop.Key
19 |
@prop.Value
20 | } 21 |
22 | 23 | @if (Model.Clients.Any()) 24 | { 25 |

Clients

26 |
    27 | @foreach (var client in Model.Clients) 28 | { 29 |
  • @client
  • 30 | } 31 |
32 | } -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Views/Shared/Redirect.cshtml: -------------------------------------------------------------------------------- 1 | @model RedirectViewModel 2 | 3 |

You are now being returned to the application.

4 |

Once complete, you may close this tab

5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Views/Shared/_ValidationSummary.cshtml: -------------------------------------------------------------------------------- 1 | @if (ViewContext.ModelState.IsValid == false) 2 | { 3 |
4 | Error 5 |
6 |
7 | } -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using IdentityServer4.Quickstart.UI 2 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 3 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/02. Password Grant - WpfClient/Idp/wwwroot/favicon.ico -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/wwwroot/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/02. Password Grant - WpfClient/Idp/wwwroot/icon.jpg -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/wwwroot/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/02. Password Grant - WpfClient/Idp/wwwroot/icon.png -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/wwwroot/js/signin-redirect.js: -------------------------------------------------------------------------------- 1 | window.location.href = document.querySelector("meta[http-equiv=refresh]").getAttribute("data-url"); 2 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/Idp/wwwroot/js/signout-redirect.js: -------------------------------------------------------------------------------- 1 | window.addEventListener("load", function () { 2 | var a = document.querySelector("a.PostLogoutRedirectUri"); 3 | if (a) { 4 | window.location = a.href; 5 | } 6 | }); 7 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/WpfClient/WpfClient.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/WpfClient/WpfClient/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/WpfClient/WpfClient/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/WpfClient/WpfClient/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace WpfClient 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/WpfClient/WpfClient/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /02. Password Grant - WpfClient/WpfClient/WpfClient/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Idp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "SelfHost": { 4 | "commandName": "Project", 5 | "environmentVariables": { 6 | "ASPNETCORE_ENVIRONMENT": "Development" 7 | }, 8 | "applicationUrl": "http://localhost:5000" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Quickstart/Account/ExternalProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ExternalProvider 8 | { 9 | public string DisplayName { get; set; } 10 | public string AuthenticationScheme { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Quickstart/Account/LoginInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class LoginInputModel 10 | { 11 | [Required] 12 | public string Username { get; set; } 13 | [Required] 14 | public string Password { get; set; } 15 | public bool RememberLogin { get; set; } 16 | public string ReturnUrl { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Quickstart/Account/LogoutInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class LogoutInputModel 8 | { 9 | public string LogoutId { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Quickstart/Account/LogoutViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class LogoutViewModel : LogoutInputModel 8 | { 9 | public bool ShowLogoutPrompt { get; set; } = true; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Quickstart/Account/RedirectViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | 6 | namespace IdentityServer4.Quickstart.UI 7 | { 8 | public class RedirectViewModel 9 | { 10 | public string RedirectUrl { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Quickstart/Consent/ConsentInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.Collections.Generic; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ConsentInputModel 10 | { 11 | public string Button { get; set; } 12 | public IEnumerable ScopesConsented { get; set; } 13 | public bool RememberConsent { get; set; } 14 | public string ReturnUrl { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Quickstart/Consent/ProcessConsentResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ProcessConsentResult 8 | { 9 | public bool IsRedirect => RedirectUri != null; 10 | public string RedirectUri { get; set; } 11 | public string ClientId { get; set; } 12 | 13 | public bool ShowView => ViewModel != null; 14 | public ConsentViewModel ViewModel { get; set; } 15 | 16 | public bool HasValidationError => ValidationError != null; 17 | public string ValidationError { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Quickstart/Consent/ScopeViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ScopeViewModel 8 | { 9 | public string Name { get; set; } 10 | public string DisplayName { get; set; } 11 | public string Description { get; set; } 12 | public bool Emphasize { get; set; } 13 | public bool Required { get; set; } 14 | public bool Checked { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Quickstart/Device/DeviceAuthorizationInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI.Device 6 | { 7 | public class DeviceAuthorizationInputModel : ConsentInputModel 8 | { 9 | public string UserCode { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Quickstart/Device/DeviceAuthorizationViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI.Device 6 | { 7 | public class DeviceAuthorizationViewModel : ConsentViewModel 8 | { 9 | public string UserCode { get; set; } 10 | public bool ConfirmUserCode { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Quickstart/Home/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using IdentityServer4.Models; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ErrorViewModel 10 | { 11 | public ErrorMessage Error { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Views/Account/Logout.cshtml: -------------------------------------------------------------------------------- 1 | @model LogoutViewModel 2 | 3 |
4 | 7 | 8 |
9 |
10 |

Would you like to logout of IdentityServer?

11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 |
19 |
20 |
21 |
-------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Views/Device/Success.cshtml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Views/Device/UserCodeCapture.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Views/Diagnostics/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model DiagnosticsViewModel 2 | 3 |

Authentication cookie

4 | 5 |

Claims

6 |
7 | @foreach (var claim in Model.AuthenticateResult.Principal.Claims) 8 | { 9 |
@claim.Type
10 |
@claim.Value
11 | } 12 |
13 | 14 |

Properties

15 |
16 | @foreach (var prop in Model.AuthenticateResult.Properties.Items) 17 | { 18 |
@prop.Key
19 |
@prop.Value
20 | } 21 |
22 | 23 | @if (Model.Clients.Any()) 24 | { 25 |

Clients

26 |
    27 | @foreach (var client in Model.Clients) 28 | { 29 |
  • @client
  • 30 | } 31 |
32 | } -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Views/Shared/Redirect.cshtml: -------------------------------------------------------------------------------- 1 | @model RedirectViewModel 2 | 3 |

You are now being returned to the application.

4 |

Once complete, you may close this tab

5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Views/Shared/_ValidationSummary.cshtml: -------------------------------------------------------------------------------- 1 | @if (ViewContext.ModelState.IsValid == false) 2 | { 3 |
4 | Error 5 |
6 |
7 | } -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using IdentityServer4.Quickstart.UI 2 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 3 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/03-04. Authorization Code Flow - MVC Client/Idp/wwwroot/favicon.ico -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/wwwroot/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/03-04. Authorization Code Flow - MVC Client/Idp/wwwroot/icon.jpg -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/wwwroot/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/03-04. Authorization Code Flow - MVC Client/Idp/wwwroot/icon.png -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/wwwroot/js/signin-redirect.js: -------------------------------------------------------------------------------- 1 | window.location.href = document.querySelector("meta[http-equiv=refresh]").getAttribute("data-url"); 2 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/Idp/wwwroot/js/signout-redirect.js: -------------------------------------------------------------------------------- 1 | window.addEventListener("load", function () { 2 | var a = document.querySelector("a.PostLogoutRedirectUri"); 3 | if (a) { 4 | window.location = a.href; 5 | } 6 | }); 7 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/MvcClient/MvcClient/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MvcClient.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/MvcClient/MvcClient/MvcClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.2 5 | InProcess 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/MvcClient/MvcClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace MvcClient 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | CreateWebHostBuilder(args).Build().Run(); 18 | } 19 | 20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/MvcClient/MvcClient/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "MvcClient": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "applicationUrl": "http://localhost:5002", 7 | "environmentVariables": { 8 | "ASPNETCORE_ENVIRONMENT": "Development" 9 | } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/MvcClient/MvcClient/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | @{ 4 | ViewData["Title"] = "Home Page"; 5 | } 6 | 7 |
8 |

Api1 Resource Respose:

9 |

@Model

10 |
11 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/MvcClient/MvcClient/Views/Home/Privacy.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Privacy Policy"; 3 | } 4 |

@ViewData["Title"]

5 | 6 |

Access Token:

7 |

@ViewData["accessToken"]

8 | 9 |

Id Token:

10 |

@ViewData["idToken"]

11 | 12 |

Refresh Token:

13 |

@ViewData["refreshToken"]

14 | 15 |
16 | @foreach (var claim in User.Claims) 17 | { 18 |
@claim.Type
19 |
@claim.Value
20 | } 21 |
-------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/MvcClient/MvcClient/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using MvcClient 2 | @using MvcClient.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/MvcClient/MvcClient/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/MvcClient/MvcClient/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/MvcClient/MvcClient/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning" 5 | } 6 | }, 7 | "AllowedHosts": "*" 8 | } 9 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/MvcClient/MvcClient/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/03-04. Authorization Code Flow - MVC Client/MvcClient/MvcClient/wwwroot/favicon.ico -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/MvcClient/MvcClient/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification 2 | // for details on configuring this project to bundle and minify static web assets. 3 | 4 | // Write your JavaScript code. 5 | -------------------------------------------------------------------------------- /03-04. Authorization Code Flow - MVC Client/MvcClient/MvcClient/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) .NET Foundation. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4 | these files except in compliance with the License. You may obtain a copy of the 5 | License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed 10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 | specific language governing permissions and limitations under the License. 13 | -------------------------------------------------------------------------------- /03-04.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/03-04.pptx -------------------------------------------------------------------------------- /05-06.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/05-06.pptx -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Api1Resource/Api1Resource.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.2 5 | InProcess 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Api1Resource/Controllers/IdentityController.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Microsoft.AspNetCore.Authorization; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace Api1Resource.Controllers 6 | { 7 | [Route("identity")] 8 | [Authorize] 9 | public class IdentityController : ControllerBase 10 | { 11 | [HttpGet] 12 | public IActionResult Get() 13 | { 14 | return new JsonResult( 15 | from c in User.Claims select new { c.Type, c.Value }); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Api1Resource/Models/ToDo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Api1Resource.Models 4 | { 5 | public class ToDo 6 | { 7 | public Guid Id { get; set; } 8 | public string Title { get; set; } 9 | public bool Completed { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Api1Resource/Models/ToDoEdit.cs: -------------------------------------------------------------------------------- 1 | namespace Api1Resource.Models 2 | { 3 | public class ToDoEdit 4 | { 5 | public string Title { get; set; } 6 | public bool Completed { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Api1Resource/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace Api1Resource 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | CreateWebHostBuilder(args).Build().Run(); 18 | } 19 | 20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Api1Resource/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Api1Resource": { 4 | "commandName": "Project", 5 | "launchBrowser": false, 6 | "applicationUrl": "http://localhost:5001", 7 | "environmentVariables": { 8 | "ASPNETCORE_ENVIRONMENT": "Development" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Api1Resource/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Api1Resource/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning" 5 | } 6 | }, 7 | "AllowedHosts": "*" 8 | } 9 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Idp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "SelfHost": { 4 | "commandName": "Project", 5 | "environmentVariables": { 6 | "ASPNETCORE_ENVIRONMENT": "Development" 7 | }, 8 | "applicationUrl": "http://localhost:5000" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Quickstart/Account/ExternalProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ExternalProvider 8 | { 9 | public string DisplayName { get; set; } 10 | public string AuthenticationScheme { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Quickstart/Account/LoginInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class LoginInputModel 10 | { 11 | [Required] 12 | public string Username { get; set; } 13 | [Required] 14 | public string Password { get; set; } 15 | public bool RememberLogin { get; set; } 16 | public string ReturnUrl { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Quickstart/Account/LogoutInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class LogoutInputModel 8 | { 9 | public string LogoutId { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Quickstart/Account/LogoutViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class LogoutViewModel : LogoutInputModel 8 | { 9 | public bool ShowLogoutPrompt { get; set; } = true; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Quickstart/Account/RedirectViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | 6 | namespace IdentityServer4.Quickstart.UI 7 | { 8 | public class RedirectViewModel 9 | { 10 | public string RedirectUrl { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Quickstart/Consent/ConsentInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.Collections.Generic; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ConsentInputModel 10 | { 11 | public string Button { get; set; } 12 | public IEnumerable ScopesConsented { get; set; } 13 | public bool RememberConsent { get; set; } 14 | public string ReturnUrl { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Quickstart/Consent/ProcessConsentResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ProcessConsentResult 8 | { 9 | public bool IsRedirect => RedirectUri != null; 10 | public string RedirectUri { get; set; } 11 | public string ClientId { get; set; } 12 | 13 | public bool ShowView => ViewModel != null; 14 | public ConsentViewModel ViewModel { get; set; } 15 | 16 | public bool HasValidationError => ValidationError != null; 17 | public string ValidationError { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Quickstart/Consent/ScopeViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ScopeViewModel 8 | { 9 | public string Name { get; set; } 10 | public string DisplayName { get; set; } 11 | public string Description { get; set; } 12 | public bool Emphasize { get; set; } 13 | public bool Required { get; set; } 14 | public bool Checked { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Quickstart/Device/DeviceAuthorizationInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI.Device 6 | { 7 | public class DeviceAuthorizationInputModel : ConsentInputModel 8 | { 9 | public string UserCode { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Quickstart/Device/DeviceAuthorizationViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI.Device 6 | { 7 | public class DeviceAuthorizationViewModel : ConsentViewModel 8 | { 9 | public string UserCode { get; set; } 10 | public bool ConfirmUserCode { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Quickstart/Home/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using IdentityServer4.Models; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ErrorViewModel 10 | { 11 | public ErrorMessage Error { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Views/Account/Logout.cshtml: -------------------------------------------------------------------------------- 1 | @model LogoutViewModel 2 | 3 |
4 | 7 | 8 |
9 |
10 |

Would you like to logout of IdentityServer?

11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 |
19 |
20 |
21 |
-------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Views/Device/Success.cshtml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Views/Device/UserCodeCapture.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Views/Diagnostics/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model DiagnosticsViewModel 2 | 3 |

Authentication cookie

4 | 5 |

Claims

6 |
7 | @foreach (var claim in Model.AuthenticateResult.Principal.Claims) 8 | { 9 |
@claim.Type
10 |
@claim.Value
11 | } 12 |
13 | 14 |

Properties

15 |
16 | @foreach (var prop in Model.AuthenticateResult.Properties.Items) 17 | { 18 |
@prop.Key
19 |
@prop.Value
20 | } 21 |
22 | 23 | @if (Model.Clients.Any()) 24 | { 25 |

Clients

26 |
    27 | @foreach (var client in Model.Clients) 28 | { 29 |
  • @client
  • 30 | } 31 |
32 | } -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Views/Shared/Redirect.cshtml: -------------------------------------------------------------------------------- 1 | @model RedirectViewModel 2 | 3 |

You are now being returned to the application.

4 |

Once complete, you may close this tab

5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Views/Shared/_ValidationSummary.cshtml: -------------------------------------------------------------------------------- 1 | @if (ViewContext.ModelState.IsValid == false) 2 | { 3 |
4 | Error 5 |
6 |
7 | } -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using IdentityServer4.Quickstart.UI 2 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 3 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/05. Implicit Flow - Angular Client Start/Idp/wwwroot/favicon.ico -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/wwwroot/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/05. Implicit Flow - Angular Client Start/Idp/wwwroot/icon.jpg -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/wwwroot/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/05. Implicit Flow - Angular Client Start/Idp/wwwroot/icon.png -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/wwwroot/js/signin-redirect.js: -------------------------------------------------------------------------------- 1 | window.location.href = document.querySelector("meta[http-equiv=refresh]").getAttribute("data-url"); 2 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/Idp/wwwroot/js/signout-redirect.js: -------------------------------------------------------------------------------- 1 | window.addEventListener("load", function () { 2 | var a = document.querySelector("a.PostLogoutRedirectUri"); 3 | if (a) { 4 | window.location = a.href; 5 | } 6 | }); 7 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('Welcome to angular-client!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText() { 9 | return element(by.css('ac-root h1')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/05. Implicit Flow - Angular Client Start/angular-client/src/app/app.component.scss -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'ac-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.scss'] 7 | }) 8 | export class AppComponent { 9 | title = 'angular-client'; 10 | } 11 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/app/components/add-todo/add-todo.component.css: -------------------------------------------------------------------------------- 1 | .full-width { 2 | width: 100%; 3 | } 4 | 5 | .shipping-card { 6 | min-width: 120px; 7 | margin: 20px auto; 8 | } 9 | 10 | .mat-radio-button { 11 | display: block; 12 | margin: 5px 0; 13 | } 14 | 15 | .row { 16 | display: flex; 17 | flex-direction: row; 18 | } 19 | 20 | .col { 21 | flex: 1; 22 | margin-right: 20px; 23 | } 24 | 25 | .col:last-child { 26 | margin-right: 0; 27 | } 28 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/app/components/dashboard/dashboard.component.css: -------------------------------------------------------------------------------- 1 | .grid-container { 2 | margin: 20px; 3 | } 4 | 5 | .dashboard-card { 6 | position: absolute; 7 | top: 15px; 8 | left: 15px; 9 | right: 15px; 10 | bottom: 15px; 11 | } 12 | 13 | .more-button { 14 | position: absolute; 15 | top: 5px; 16 | right: 10px; 17 | } 18 | 19 | .dashboard-card-content { 20 | text-align: center; 21 | } 22 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/app/components/navbar/navbar.component.scss: -------------------------------------------------------------------------------- 1 | .sidenav-container { 2 | height: 100%; 3 | } 4 | 5 | .sidenav { 6 | width: 200px; 7 | } 8 | 9 | .sidenav { 10 | background: inherit; 11 | } 12 | 13 | .mat-toolbar.mat-primary { 14 | position: sticky; 15 | top: 0; 16 | z-index: 9999999; 17 | } 18 | 19 | .router-outlet-container { 20 | position: relative; 21 | } 22 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/app/components/navbar/navbar.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; 3 | import { Observable } from 'rxjs'; 4 | import { map } from 'rxjs/operators'; 5 | 6 | @Component({ 7 | selector: 'ac-navbar', 8 | templateUrl: './navbar.component.html', 9 | styleUrls: ['./navbar.component.scss'] 10 | }) 11 | export class NavbarComponent { 12 | 13 | isHandset$: Observable = this.breakpointObserver.observe(Breakpoints.Handset) 14 | .pipe( 15 | map(result => result.matches) 16 | ); 17 | 18 | constructor(private breakpointObserver: BreakpointObserver) {} 19 | 20 | } 21 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/app/components/todo-table/todo-table.component.scss: -------------------------------------------------------------------------------- 1 | .full-width-table { 2 | width: 100%; 3 | } 4 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/app/components/todo-table/todo-table.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { TodoService } from 'src/app/services/todo.service'; 3 | import { ITodo } from 'src/app/models/todo'; 4 | 5 | @Component({ 6 | selector: 'ac-todo-table', 7 | templateUrl: './todo-table.component.html', 8 | styleUrls: ['./todo-table.component.scss'] 9 | }) 10 | export class TodoTableComponent implements OnInit { 11 | todos: ITodo[]; 12 | 13 | displayedColumns = ['id', 'title', 'completed']; 14 | 15 | constructor(private todoService: TodoService) {} 16 | 17 | ngOnInit() { 18 | this.todoService.getAllTodos().subscribe(todos => { 19 | this.todos = todos; 20 | console.log(this.todos); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/app/models/todo-add.ts: -------------------------------------------------------------------------------- 1 | export interface ITodoAdd { 2 | title: string; 3 | } 4 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/app/models/todo.ts: -------------------------------------------------------------------------------- 1 | export interface ITodo { 2 | id: string; 3 | title: string; 4 | completed: boolean; 5 | } 6 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/app/services/todo.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { TodoService } from './todo.service'; 4 | 5 | describe('TodoService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: TodoService = TestBed.get(TodoService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/app/services/todo.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | import { ITodo } from '../models/todo'; 5 | import { ITodoAdd } from '../models/todo-add'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class TodoService { 11 | constructor(private httpClient: HttpClient) {} 12 | 13 | getAllTodos(): Observable { 14 | return this.httpClient.get(`http://localhost:5001/api/todo`); 15 | } 16 | 17 | addTodo(todo: ITodoAdd) { 18 | return this.httpClient.post(`http://localhost:5001/api/todo`, todo); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/05. Implicit Flow - Angular Client Start/angular-client/src/assets/.gitkeep -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/browserslist: -------------------------------------------------------------------------------- 1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | # 5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed 6 | 7 | > 0.5% 8 | last 2 versions 9 | Firefox ESR 10 | not dead 11 | not IE 9-11 -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/05. Implicit Flow - Angular Client Start/angular-client/src/favicon.ico -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AngularClient 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/main.ts: -------------------------------------------------------------------------------- 1 | import 'hammerjs'; 2 | import { enableProdMode } from '@angular/core'; 3 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 4 | 5 | import { AppModule } from './app/app.module'; 6 | import { environment } from './environments/environment'; 7 | 8 | if (environment.production) { 9 | enableProdMode(); 10 | } 11 | 12 | platformBrowserDynamic().bootstrapModule(AppModule) 13 | .catch(err => console.error(err)); 14 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | 3 | html, body { height: 100%; } 4 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } 5 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "types": [] 6 | }, 7 | "exclude": [ 8 | "test.ts", 9 | "**/*.spec.ts" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "test.ts", 12 | "polyfills.ts" 13 | ], 14 | "include": [ 15 | "**/*.spec.ts", 16 | "**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/src/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "ac", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "ac", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /05. Implicit Flow - Angular Client Start/angular-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "es2015", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "importHelpers": true, 13 | "target": "es5", 14 | "typeRoots": [ 15 | "node_modules/@types" 16 | ], 17 | "lib": [ 18 | "es2018", 19 | "dom" 20 | ] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Api1Resource/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dotnet", 7 | "type": "process", 8 | "args": [ 9 | "build", 10 | "${workspaceFolder}/Api1Resource.csproj" 11 | ], 12 | "problemMatcher": "$msCompile" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Api1Resource/Api1Resource.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.2 5 | InProcess 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Api1Resource/Controllers/IdentityController.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Microsoft.AspNetCore.Authorization; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace Api1Resource.Controllers 6 | { 7 | [Route("identity")] 8 | [Authorize] 9 | public class IdentityController : ControllerBase 10 | { 11 | [HttpGet] 12 | public IActionResult Get() 13 | { 14 | return new JsonResult( 15 | from c in User.Claims select new { c.Type, c.Value }); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Api1Resource/Models/ToDo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Api1Resource.Models 4 | { 5 | public class ToDo 6 | { 7 | public Guid Id { get; set; } 8 | public string Title { get; set; } 9 | public bool Completed { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Api1Resource/Models/ToDoEdit.cs: -------------------------------------------------------------------------------- 1 | namespace Api1Resource.Models 2 | { 3 | public class ToDoEdit 4 | { 5 | public string Title { get; set; } 6 | public bool Completed { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Api1Resource/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace Api1Resource 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | CreateWebHostBuilder(args).Build().Run(); 18 | } 19 | 20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Api1Resource/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Api1Resource": { 4 | "commandName": "Project", 5 | "launchBrowser": false, 6 | "applicationUrl": "http://localhost:5001", 7 | "environmentVariables": { 8 | "ASPNETCORE_ENVIRONMENT": "Development" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Api1Resource/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Api1Resource/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning" 5 | } 6 | }, 7 | "AllowedHosts": "*" 8 | } 9 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Idp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "SelfHost": { 4 | "commandName": "Project", 5 | "environmentVariables": { 6 | "ASPNETCORE_ENVIRONMENT": "Development" 7 | }, 8 | "applicationUrl": "http://localhost:5000" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Quickstart/Account/ExternalProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ExternalProvider 8 | { 9 | public string DisplayName { get; set; } 10 | public string AuthenticationScheme { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Quickstart/Account/LoginInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class LoginInputModel 10 | { 11 | [Required] 12 | public string Username { get; set; } 13 | [Required] 14 | public string Password { get; set; } 15 | public bool RememberLogin { get; set; } 16 | public string ReturnUrl { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Quickstart/Account/LogoutInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class LogoutInputModel 8 | { 9 | public string LogoutId { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Quickstart/Account/LogoutViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class LogoutViewModel : LogoutInputModel 8 | { 9 | public bool ShowLogoutPrompt { get; set; } = true; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Quickstart/Account/RedirectViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | 6 | namespace IdentityServer4.Quickstart.UI 7 | { 8 | public class RedirectViewModel 9 | { 10 | public string RedirectUrl { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Quickstart/Consent/ConsentInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.Collections.Generic; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ConsentInputModel 10 | { 11 | public string Button { get; set; } 12 | public IEnumerable ScopesConsented { get; set; } 13 | public bool RememberConsent { get; set; } 14 | public string ReturnUrl { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Quickstart/Consent/ProcessConsentResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ProcessConsentResult 8 | { 9 | public bool IsRedirect => RedirectUri != null; 10 | public string RedirectUri { get; set; } 11 | public string ClientId { get; set; } 12 | 13 | public bool ShowView => ViewModel != null; 14 | public ConsentViewModel ViewModel { get; set; } 15 | 16 | public bool HasValidationError => ValidationError != null; 17 | public string ValidationError { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Quickstart/Consent/ScopeViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ScopeViewModel 8 | { 9 | public string Name { get; set; } 10 | public string DisplayName { get; set; } 11 | public string Description { get; set; } 12 | public bool Emphasize { get; set; } 13 | public bool Required { get; set; } 14 | public bool Checked { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Quickstart/Device/DeviceAuthorizationInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI.Device 6 | { 7 | public class DeviceAuthorizationInputModel : ConsentInputModel 8 | { 9 | public string UserCode { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Quickstart/Device/DeviceAuthorizationViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI.Device 6 | { 7 | public class DeviceAuthorizationViewModel : ConsentViewModel 8 | { 9 | public string UserCode { get; set; } 10 | public bool ConfirmUserCode { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Quickstart/Home/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using IdentityServer4.Models; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ErrorViewModel 10 | { 11 | public ErrorMessage Error { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Views/Account/Logout.cshtml: -------------------------------------------------------------------------------- 1 | @model LogoutViewModel 2 | 3 |
4 | 7 | 8 |
9 |
10 |

Would you like to logout of IdentityServer?

11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 |
19 |
20 |
21 |
-------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Views/Device/Success.cshtml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Views/Device/UserCodeCapture.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Views/Diagnostics/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model DiagnosticsViewModel 2 | 3 |

Authentication cookie

4 | 5 |

Claims

6 |
7 | @foreach (var claim in Model.AuthenticateResult.Principal.Claims) 8 | { 9 |
@claim.Type
10 |
@claim.Value
11 | } 12 |
13 | 14 |

Properties

15 |
16 | @foreach (var prop in Model.AuthenticateResult.Properties.Items) 17 | { 18 |
@prop.Key
19 |
@prop.Value
20 | } 21 |
22 | 23 | @if (Model.Clients.Any()) 24 | { 25 |

Clients

26 |
    27 | @foreach (var client in Model.Clients) 28 | { 29 |
  • @client
  • 30 | } 31 |
32 | } -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Views/Shared/Redirect.cshtml: -------------------------------------------------------------------------------- 1 | @model RedirectViewModel 2 | 3 |

You are now being returned to the application.

4 |

Once complete, you may close this tab

5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Views/Shared/_ValidationSummary.cshtml: -------------------------------------------------------------------------------- 1 | @if (ViewContext.ModelState.IsValid == false) 2 | { 3 |
4 | Error 5 |
6 |
7 | } -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using IdentityServer4.Quickstart.UI 2 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 3 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/06. Implicit Flow - Angular Client Finish/Idp/wwwroot/favicon.ico -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/wwwroot/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/06. Implicit Flow - Angular Client Finish/Idp/wwwroot/icon.jpg -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/wwwroot/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/06. Implicit Flow - Angular Client Finish/Idp/wwwroot/icon.png -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/wwwroot/js/signin-redirect.js: -------------------------------------------------------------------------------- 1 | window.location.href = document.querySelector("meta[http-equiv=refresh]").getAttribute("data-url"); 2 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/Idp/wwwroot/js/signout-redirect.js: -------------------------------------------------------------------------------- 1 | window.addEventListener("load", function () { 2 | var a = document.querySelector("a.PostLogoutRedirectUri"); 3 | if (a) { 4 | window.location = a.href; 5 | } 6 | }); 7 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('Welcome to angular-client!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText() { 9 | return element(by.css('ac-root h1')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/06. Implicit Flow - Angular Client Finish/angular-client/src/app/app.component.scss -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'ac-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.scss'] 7 | }) 8 | export class AppComponent { 9 | title = 'angular-client'; 10 | } 11 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/components/add-todo/add-todo.component.css: -------------------------------------------------------------------------------- 1 | .full-width { 2 | width: 100%; 3 | } 4 | 5 | .shipping-card { 6 | min-width: 120px; 7 | margin: 20px auto; 8 | } 9 | 10 | .mat-radio-button { 11 | display: block; 12 | margin: 5px 0; 13 | } 14 | 15 | .row { 16 | display: flex; 17 | flex-direction: row; 18 | } 19 | 20 | .col { 21 | flex: 1; 22 | margin-right: 20px; 23 | } 24 | 25 | .col:last-child { 26 | margin-right: 0; 27 | } 28 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/components/dashboard/dashboard.component.css: -------------------------------------------------------------------------------- 1 | .grid-container { 2 | margin: 20px; 3 | } 4 | 5 | .dashboard-card { 6 | position: absolute; 7 | top: 15px; 8 | left: 15px; 9 | right: 15px; 10 | bottom: 15px; 11 | } 12 | 13 | .more-button { 14 | position: absolute; 15 | top: 5px; 16 | right: 10px; 17 | } 18 | 19 | .dashboard-card-content { 20 | text-align: center; 21 | } 22 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/components/navbar/navbar.component.scss: -------------------------------------------------------------------------------- 1 | .sidenav-container { 2 | height: 100%; 3 | } 4 | 5 | .sidenav { 6 | width: 200px; 7 | } 8 | 9 | .sidenav { 10 | background: inherit; 11 | } 12 | 13 | .mat-toolbar.mat-primary { 14 | position: sticky; 15 | top: 0; 16 | z-index: 9999999; 17 | } 18 | 19 | .router-outlet-container { 20 | position: relative; 21 | } 22 | 23 | .toolbar-spacer { 24 | flex: 1 1 auto; 25 | } 26 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/components/todo-table/todo-table.component.scss: -------------------------------------------------------------------------------- 1 | .full-width-table { 2 | width: 100%; 3 | } 4 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/components/todo-table/todo-table.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { TodoService } from 'src/app/services/todo.service'; 3 | import { ITodo } from 'src/app/models/todo'; 4 | 5 | @Component({ 6 | selector: 'ac-todo-table', 7 | templateUrl: './todo-table.component.html', 8 | styleUrls: ['./todo-table.component.scss'] 9 | }) 10 | export class TodoTableComponent implements OnInit { 11 | todos: ITodo[]; 12 | 13 | displayedColumns = ['id', 'title', 'completed']; 14 | 15 | constructor(private todoService: TodoService) {} 16 | 17 | ngOnInit() { 18 | this.todoService.getAllTodos().subscribe(todos => { 19 | this.todos = todos; 20 | console.log(this.todos); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/models/todo-add.ts: -------------------------------------------------------------------------------- 1 | export interface ITodoAdd { 2 | title: string; 3 | } 4 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/models/todo.ts: -------------------------------------------------------------------------------- 1 | export interface ITodo { 2 | id: string; 3 | title: string; 4 | completed: boolean; 5 | } 6 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/oidc/open-id-connect.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { OpenIdConnectService } from './open-id-connect.service'; 4 | 5 | describe('OpenIdConnectService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: OpenIdConnectService = TestBed.get(OpenIdConnectService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/oidc/redirect-silent-renew/redirect-silent-renew.component.html: -------------------------------------------------------------------------------- 1 |

2 | redirect-silent-renew works! 3 |

4 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/oidc/redirect-silent-renew/redirect-silent-renew.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/06. Implicit Flow - Angular Client Finish/angular-client/src/app/oidc/redirect-silent-renew/redirect-silent-renew.component.scss -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/oidc/redirect-silent-renew/redirect-silent-renew.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { OpenIdConnectService } from '../open-id-connect.service'; 3 | 4 | @Component({ 5 | selector: 'ac-redirect-silent-renew', 6 | templateUrl: './redirect-silent-renew.component.html', 7 | styleUrls: ['./redirect-silent-renew.component.scss'] 8 | }) 9 | export class RedirectSilentRenewComponent implements OnInit { 10 | constructor(private oidc: OpenIdConnectService) {} 11 | 12 | ngOnInit() { 13 | this.oidc.handleSilentCallback(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/oidc/signin-oidc/signin-oidc.component.html: -------------------------------------------------------------------------------- 1 |

2 | 登陆成功,返回ing 3 |

4 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/oidc/signin-oidc/signin-oidc.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/06. Implicit Flow - Angular Client Finish/angular-client/src/app/oidc/signin-oidc/signin-oidc.component.scss -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/services/todo.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { TodoService } from './todo.service'; 4 | 5 | describe('TodoService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: TodoService = TestBed.get(TodoService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/app/services/todo.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | import { ITodo } from '../models/todo'; 5 | import { ITodoAdd } from '../models/todo-add'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class TodoService { 11 | constructor(private httpClient: HttpClient) {} 12 | 13 | getAllTodos(): Observable { 14 | return this.httpClient.get(`http://localhost:5001/api/todo`); 15 | } 16 | 17 | addTodo(todo: ITodoAdd) { 18 | return this.httpClient.post(`http://localhost:5001/api/todo`, todo); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/06. Implicit Flow - Angular Client Finish/angular-client/src/assets/.gitkeep -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/browserslist: -------------------------------------------------------------------------------- 1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | # 5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed 6 | 7 | > 0.5% 8 | last 2 versions 9 | Firefox ESR 10 | not dead 11 | not IE 9-11 -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/06. Implicit Flow - Angular Client Finish/angular-client/src/favicon.ico -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AngularClient 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/main.ts: -------------------------------------------------------------------------------- 1 | import 'hammerjs'; 2 | import { enableProdMode } from '@angular/core'; 3 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 4 | 5 | import { AppModule } from './app/app.module'; 6 | import { environment } from './environments/environment'; 7 | 8 | if (environment.production) { 9 | enableProdMode(); 10 | } 11 | 12 | platformBrowserDynamic().bootstrapModule(AppModule) 13 | .catch(err => console.error(err)); 14 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | 3 | html, body { height: 100%; } 4 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } 5 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "types": [] 6 | }, 7 | "exclude": [ 8 | "test.ts", 9 | "**/*.spec.ts" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "test.ts", 12 | "polyfills.ts" 13 | ], 14 | "include": [ 15 | "**/*.spec.ts", 16 | "**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/src/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "ac", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "ac", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /06. Implicit Flow - Angular Client Finish/angular-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "es2015", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "importHelpers": true, 13 | "target": "es5", 14 | "typeRoots": [ 15 | "node_modules/@types" 16 | ], 17 | "lib": [ 18 | "es2018", 19 | "dom" 20 | ] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Api1Resource/Api1Resource.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.2 5 | InProcess 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Api1Resource/Controllers/IdentityController.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Microsoft.AspNetCore.Authorization; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace Api1Resource.Controllers 6 | { 7 | [Route("identity")] 8 | [Authorize] 9 | public class IdentityController : ControllerBase 10 | { 11 | [HttpGet] 12 | public IActionResult Get() 13 | { 14 | return new JsonResult( 15 | from c in User.Claims select new { c.Type, c.Value }); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Api1Resource/Models/ToDo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Api1Resource.Models 4 | { 5 | public class ToDo 6 | { 7 | public Guid Id { get; set; } 8 | public string Title { get; set; } 9 | public bool Completed { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Api1Resource/Models/ToDoEdit.cs: -------------------------------------------------------------------------------- 1 | namespace Api1Resource.Models 2 | { 3 | public class ToDoEdit 4 | { 5 | public string Title { get; set; } 6 | public bool Completed { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Api1Resource/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace Api1Resource 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | CreateWebHostBuilder(args).Build().Run(); 18 | } 19 | 20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Api1Resource/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Api1Resource": { 4 | "commandName": "Project", 5 | "launchBrowser": false, 6 | "applicationUrl": "http://localhost:5001", 7 | "environmentVariables": { 8 | "ASPNETCORE_ENVIRONMENT": "Development" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Api1Resource/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Api1Resource/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning" 5 | } 6 | }, 7 | "AllowedHosts": "*" 8 | } 9 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/Auths/SmithInSomewareRequirement.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Authorization; 2 | 3 | namespace HybridClient.Requirements 4 | { 5 | public class SmithInSomewareRequirement: IAuthorizationRequirement 6 | { 7 | public SmithInSomewareRequirement() 8 | { 9 | 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/Controllers/AuthorizationController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | 3 | namespace HybridClient.Controllers 4 | { 5 | public class AuthorizationController: Controller 6 | { 7 | public IActionResult AccessDenied() 8 | { 9 | return View(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/HybridClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.2 5 | InProcess 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HybridClient.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace HybridClient 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | CreateWebHostBuilder(args).Build().Run(); 18 | } 19 | 20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "HybridClient": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "applicationUrl": "http://localhost:7000", 7 | "environmentVariables": { 8 | "ASPNETCORE_ENVIRONMENT": "Development" 9 | } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/Views/Authorization/AccessDenied.cshtml: -------------------------------------------------------------------------------- 1 | 

Access Denied

-------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/Views/Home/AccessApi1.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | @{ 4 | ViewData["Title"] = "Home Page"; 5 | } 6 | 7 |
8 |

Api1 Resource Respose:

9 |

@Model

10 |
11 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | @{ 4 | ViewData["Title"] = "Home Page"; 5 | } 6 | 7 |
8 |

@ViewData["Title"]

9 |

Hello Identity Server 4 Demo

10 |
11 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/Views/Home/Privacy.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Privacy Policy"; 3 | } 4 |

@ViewData["Title"]

5 | 6 |

Access Token:

7 |

@ViewData["accessToken"]

8 | 9 |

Id Token:

10 |

@ViewData["idToken"]

11 | 12 |

Refresh Token:

13 |

@ViewData["refreshToken"]

14 | 15 |
16 | @foreach (var claim in User.Claims) 17 | { 18 |
@claim.Type
19 |
@claim.Value
20 | } 21 |
-------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using HybridClient 2 | @using HybridClient.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning" 5 | } 6 | }, 7 | "AllowedHosts": "*" 8 | } 9 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/wwwroot/favicon.ico -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification 2 | // for details on configuring this project to bundle and minify static web assets. 3 | 4 | // Write your JavaScript code. 5 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/HybridMvcClient/HybridClient/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) .NET Foundation. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4 | these files except in compliance with the License. You may obtain a copy of the 5 | License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed 10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 | specific language governing permissions and limitations under the License. 13 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Idp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "SelfHost": { 4 | "commandName": "Project", 5 | "environmentVariables": { 6 | "ASPNETCORE_ENVIRONMENT": "Development" 7 | }, 8 | "applicationUrl": "http://localhost:5000" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Quickstart/Account/ExternalProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ExternalProvider 8 | { 9 | public string DisplayName { get; set; } 10 | public string AuthenticationScheme { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Quickstart/Account/LoginInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class LoginInputModel 10 | { 11 | [Required] 12 | public string Username { get; set; } 13 | [Required] 14 | public string Password { get; set; } 15 | public bool RememberLogin { get; set; } 16 | public string ReturnUrl { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Quickstart/Account/LogoutInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class LogoutInputModel 8 | { 9 | public string LogoutId { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Quickstart/Account/LogoutViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class LogoutViewModel : LogoutInputModel 8 | { 9 | public bool ShowLogoutPrompt { get; set; } = true; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Quickstart/Account/RedirectViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | 6 | namespace IdentityServer4.Quickstart.UI 7 | { 8 | public class RedirectViewModel 9 | { 10 | public string RedirectUrl { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Quickstart/Consent/ConsentInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.Collections.Generic; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ConsentInputModel 10 | { 11 | public string Button { get; set; } 12 | public IEnumerable ScopesConsented { get; set; } 13 | public bool RememberConsent { get; set; } 14 | public string ReturnUrl { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Quickstart/Consent/ConsentViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.Collections.Generic; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ConsentViewModel : ConsentInputModel 10 | { 11 | public string ClientName { get; set; } 12 | public string ClientUrl { get; set; } 13 | public string ClientLogoUrl { get; set; } 14 | public bool AllowRememberConsent { get; set; } 15 | 16 | public IEnumerable IdentityScopes { get; set; } 17 | public IEnumerable ResourceScopes { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Quickstart/Consent/ProcessConsentResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ProcessConsentResult 8 | { 9 | public bool IsRedirect => RedirectUri != null; 10 | public string RedirectUri { get; set; } 11 | public string ClientId { get; set; } 12 | 13 | public bool ShowView => ViewModel != null; 14 | public ConsentViewModel ViewModel { get; set; } 15 | 16 | public bool HasValidationError => ValidationError != null; 17 | public string ValidationError { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Quickstart/Consent/ScopeViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ScopeViewModel 8 | { 9 | public string Name { get; set; } 10 | public string DisplayName { get; set; } 11 | public string Description { get; set; } 12 | public bool Emphasize { get; set; } 13 | public bool Required { get; set; } 14 | public bool Checked { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Quickstart/Device/DeviceAuthorizationInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI.Device 6 | { 7 | public class DeviceAuthorizationInputModel : ConsentInputModel 8 | { 9 | public string UserCode { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Quickstart/Device/DeviceAuthorizationViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI.Device 6 | { 7 | public class DeviceAuthorizationViewModel : ConsentViewModel 8 | { 9 | public string UserCode { get; set; } 10 | public bool ConfirmUserCode { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Quickstart/Home/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using IdentityServer4.Models; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ErrorViewModel 10 | { 11 | public ErrorMessage Error { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Views/Account/Logout.cshtml: -------------------------------------------------------------------------------- 1 | @model LogoutViewModel 2 | 3 |
4 | 7 | 8 |
9 |
10 |

Would you like to logout of IdentityServer?

11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 |
19 |
20 |
21 |
-------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Views/Device/Success.cshtml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Views/Device/UserCodeCapture.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Views/Diagnostics/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model DiagnosticsViewModel 2 | 3 |

Authentication cookie

4 | 5 |

Claims

6 |
7 | @foreach (var claim in Model.AuthenticateResult.Principal.Claims) 8 | { 9 |
@claim.Type
10 |
@claim.Value
11 | } 12 |
13 | 14 |

Properties

15 |
16 | @foreach (var prop in Model.AuthenticateResult.Properties.Items) 17 | { 18 |
@prop.Key
19 |
@prop.Value
20 | } 21 |
22 | 23 | @if (Model.Clients.Any()) 24 | { 25 |

Clients

26 |
    27 | @foreach (var client in Model.Clients) 28 | { 29 |
  • @client
  • 30 | } 31 |
32 | } -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Views/Shared/Redirect.cshtml: -------------------------------------------------------------------------------- 1 | @model RedirectViewModel 2 | 3 |

You are now being returned to the application.

4 |

Once complete, you may close this tab

5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Views/Shared/_ValidationSummary.cshtml: -------------------------------------------------------------------------------- 1 | @if (ViewContext.ModelState.IsValid == false) 2 | { 3 |
4 | Error 5 |
6 |
7 | } -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using IdentityServer4.Quickstart.UI 2 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 3 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/07-08. Hybrid Flow - MVC Client/Idp/wwwroot/favicon.ico -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/wwwroot/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/07-08. Hybrid Flow - MVC Client/Idp/wwwroot/icon.jpg -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/wwwroot/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/07-08. Hybrid Flow - MVC Client/Idp/wwwroot/icon.png -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/wwwroot/js/signin-redirect.js: -------------------------------------------------------------------------------- 1 | window.location.href = document.querySelector("meta[http-equiv=refresh]").getAttribute("data-url"); 2 | -------------------------------------------------------------------------------- /07-08. Hybrid Flow - MVC Client/Idp/wwwroot/js/signout-redirect.js: -------------------------------------------------------------------------------- 1 | window.addEventListener("load", function () { 2 | var a = document.querySelector("a.PostLogoutRedirectUri"); 3 | if (a) { 4 | window.location = a.href; 5 | } 6 | }); 7 | -------------------------------------------------------------------------------- /07-08.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/07-08.pptx -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Api1Resource/Api1Resource.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.2 5 | InProcess 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Api1Resource/Controllers/IdentityController.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Microsoft.AspNetCore.Authorization; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace Api1Resource.Controllers 6 | { 7 | [Route("identity")] 8 | [Authorize] 9 | public class IdentityController : ControllerBase 10 | { 11 | [HttpGet] 12 | public IActionResult Get() 13 | { 14 | return new JsonResult( 15 | from c in User.Claims select new { c.Type, c.Value }); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Api1Resource/Models/ToDo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Api1Resource.Models 4 | { 5 | public class ToDo 6 | { 7 | public Guid Id { get; set; } 8 | public string Title { get; set; } 9 | public bool Completed { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Api1Resource/Models/ToDoEdit.cs: -------------------------------------------------------------------------------- 1 | namespace Api1Resource.Models 2 | { 3 | public class ToDoEdit 4 | { 5 | public string Title { get; set; } 6 | public bool Completed { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Api1Resource/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace Api1Resource 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | CreateWebHostBuilder(args).Build().Run(); 18 | } 19 | 20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Api1Resource/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Api1Resource": { 4 | "commandName": "Project", 5 | "launchBrowser": false, 6 | "applicationUrl": "http://localhost:5001", 7 | "environmentVariables": { 8 | "ASPNETCORE_ENVIRONMENT": "Development" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Api1Resource/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Api1Resource/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning" 5 | } 6 | }, 7 | "AllowedHosts": "*" 8 | } 9 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/ConsoleClient/ConsoleClient/ConsoleClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | netcoreapp2.2 6 | latest 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/FlaskClient/client_secrets.json: -------------------------------------------------------------------------------- 1 | { 2 | "web": { 3 | "client_id": "flask client", 4 | "client_secret": "flask secret", 5 | "auth_uri": "http://localhost:5000/connect/authorize", 6 | "token_uri": "http://localhost:5000/connect/token", 7 | "userinfo_uri": "http://localhost:5000/connect/userinfo", 8 | "token_introspection_uri": "http://localhost:5000/connect/introspect", 9 | "issuer": "http://localhost:5000", 10 | "redirect_uris": ["http://localhost:7002/oidc_callback"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/Auths/SmithInSomewareRequirement.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Authorization; 2 | 3 | namespace HybridClient.Requirements 4 | { 5 | public class SmithInSomewareRequirement: IAuthorizationRequirement 6 | { 7 | public SmithInSomewareRequirement() 8 | { 9 | 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/Controllers/AuthorizationController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | 3 | namespace HybridClient.Controllers 4 | { 5 | public class AuthorizationController: Controller 6 | { 7 | public IActionResult AccessDenied() 8 | { 9 | return View(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/HybridClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.2 5 | InProcess 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HybridClient.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "HybridClient": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "applicationUrl": "http://localhost:7000", 7 | "environmentVariables": { 8 | "ASPNETCORE_ENVIRONMENT": "Development" 9 | } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/Views/Authorization/AccessDenied.cshtml: -------------------------------------------------------------------------------- 1 | 

Access Denied

-------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/Views/Home/AccessApi1.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | @{ 4 | ViewData["Title"] = "Home Page"; 5 | } 6 | 7 |
8 |

Api1 Resource Respose:

9 |

@Model

10 |
11 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | @{ 4 | ViewData["Title"] = "Home Page"; 5 | } 6 | 7 |
8 |

@ViewData["Title"]

9 |

Hello Identity Server 4 Demo

10 |
11 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/Views/Home/Privacy.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Privacy Policy"; 3 | } 4 |

@ViewData["Title"]

5 | 6 |

Access Token:

7 |

@ViewData["accessToken"]

8 | 9 |

Id Token:

10 |

@ViewData["idToken"]

11 | 12 |

Refresh Token:

13 |

@ViewData["refreshToken"]

14 | 15 |
16 | @foreach (var claim in User.Claims) 17 | { 18 |
@claim.Type
19 |
@claim.Value
20 | } 21 |
-------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using HybridClient 2 | @using HybridClient.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning" 5 | } 6 | }, 7 | "AllowedHosts": "*" 8 | } 9 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/wwwroot/favicon.ico -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification 2 | // for details on configuring this project to bundle and minify static web assets. 3 | 4 | // Write your JavaScript code. 5 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/HybridMvcClient/HybridClient/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) .NET Foundation. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4 | these files except in compliance with the License. You may obtain a copy of the 5 | License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed 10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 | specific language governing permissions and limitations under the License. 13 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dotnet", 7 | "type": "process", 8 | "args": [ 9 | "build", 10 | "${workspaceFolder}/Idp.csproj" 11 | ], 12 | "problemMatcher": "$msCompile" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Idp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "SelfHost": { 4 | "commandName": "Project", 5 | "environmentVariables": { 6 | "ASPNETCORE_ENVIRONMENT": "Development" 7 | }, 8 | "applicationUrl": "http://localhost:5000" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Quickstart/Account/ExternalProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ExternalProvider 8 | { 9 | public string DisplayName { get; set; } 10 | public string AuthenticationScheme { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Quickstart/Account/LoginInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class LoginInputModel 10 | { 11 | [Required] 12 | public string Username { get; set; } 13 | [Required] 14 | public string Password { get; set; } 15 | public bool RememberLogin { get; set; } 16 | public string ReturnUrl { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Quickstart/Account/LogoutInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class LogoutInputModel 8 | { 9 | public string LogoutId { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Quickstart/Account/LogoutViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class LogoutViewModel : LogoutInputModel 8 | { 9 | public bool ShowLogoutPrompt { get; set; } = true; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Quickstart/Account/RedirectViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | 6 | namespace IdentityServer4.Quickstart.UI 7 | { 8 | public class RedirectViewModel 9 | { 10 | public string RedirectUrl { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Quickstart/Consent/ConsentInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.Collections.Generic; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ConsentInputModel 10 | { 11 | public string Button { get; set; } 12 | public IEnumerable ScopesConsented { get; set; } 13 | public bool RememberConsent { get; set; } 14 | public string ReturnUrl { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Quickstart/Consent/ScopeViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI 6 | { 7 | public class ScopeViewModel 8 | { 9 | public string Name { get; set; } 10 | public string DisplayName { get; set; } 11 | public string Description { get; set; } 12 | public bool Emphasize { get; set; } 13 | public bool Required { get; set; } 14 | public bool Checked { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Quickstart/Device/DeviceAuthorizationInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI.Device 6 | { 7 | public class DeviceAuthorizationInputModel : ConsentInputModel 8 | { 9 | public string UserCode { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Quickstart/Device/DeviceAuthorizationViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace IdentityServer4.Quickstart.UI.Device 6 | { 7 | public class DeviceAuthorizationViewModel : ConsentViewModel 8 | { 9 | public string UserCode { get; set; } 10 | public bool ConfirmUserCode { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Quickstart/Home/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using IdentityServer4.Models; 6 | 7 | namespace IdentityServer4.Quickstart.UI 8 | { 9 | public class ErrorViewModel 10 | { 11 | public ErrorMessage Error { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Views/Account/Logout.cshtml: -------------------------------------------------------------------------------- 1 | @model LogoutViewModel 2 | 3 |
4 | 7 | 8 |
9 |
10 |

Would you like to logout of IdentityServer?

11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 |
19 |
20 |
21 |
-------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Views/Device/Success.cshtml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Views/Device/UserCodeCapture.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Views/Diagnostics/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model DiagnosticsViewModel 2 | 3 |

Authentication cookie

4 | 5 |

Claims

6 |
7 | @foreach (var claim in Model.AuthenticateResult.Principal.Claims) 8 | { 9 |
@claim.Type
10 |
@claim.Value
11 | } 12 |
13 | 14 |

Properties

15 |
16 | @foreach (var prop in Model.AuthenticateResult.Properties.Items) 17 | { 18 |
@prop.Key
19 |
@prop.Value
20 | } 21 |
22 | 23 | @if (Model.Clients.Any()) 24 | { 25 |

Clients

26 |
    27 | @foreach (var client in Model.Clients) 28 | { 29 |
  • @client
  • 30 | } 31 |
32 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Views/Shared/Redirect.cshtml: -------------------------------------------------------------------------------- 1 | @model RedirectViewModel 2 | 3 |

You are now being returned to the application.

4 |

Once complete, you may close this tab

5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Views/Shared/_ValidationSummary.cshtml: -------------------------------------------------------------------------------- 1 | @if (ViewContext.ModelState.IsValid == false) 2 | { 3 |
4 | Error 5 |
6 |
7 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using IdentityServer4.Quickstart.UI 2 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 3 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/wwwroot/favicon.ico -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/wwwroot/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/wwwroot/icon.jpg -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/wwwroot/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/wwwroot/icon.png -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/wwwroot/js/signin-redirect.js: -------------------------------------------------------------------------------- 1 | window.location.href = document.querySelector("meta[http-equiv=refresh]").getAttribute("data-url"); 2 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/Idp/wwwroot/js/signout-redirect.js: -------------------------------------------------------------------------------- 1 | window.addEventListener("load", function () { 2 | var a = document.querySelector("a.PostLogoutRedirectUri"); 3 | if (a) { 4 | window.location = a.href; 5 | } 6 | }); 7 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dotnet", 7 | "type": "process", 8 | "args": [ 9 | "build", 10 | "${workspaceFolder}/MvcClient/MvcClient.csproj" 11 | ], 12 | "problemMatcher": "$msCompile" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/MvcClient/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MvcClient.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/MvcClient/MvcClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.2 5 | InProcess 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/MvcClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace MvcClient 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | CreateWebHostBuilder(args).Build().Run(); 18 | } 19 | 20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/MvcClient/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "MvcClient": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "applicationUrl": "http://localhost:7001", 7 | "environmentVariables": { 8 | "ASPNETCORE_ENVIRONMENT": "Development" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/MvcClient/Views/Home/AccessApis.cshtml: -------------------------------------------------------------------------------- 1 | 

api1:

2 |

@ViewData["api1"]

3 |

api2:

4 |

@ViewData["api2"]

-------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/MvcClient/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | @{ 4 | ViewData["Title"] = "Home Page"; 5 | } 6 | 7 |
8 |

Api1 Resource Respose:

9 |

@Model

10 |
11 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/MvcClient/Views/Home/Privacy.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Privacy Policy"; 3 | } 4 |

@ViewData["Title"]

5 | 6 |

Access Token:

7 |

@ViewData["accessToken"]

8 | 9 |

Id Token:

10 |

@ViewData["idToken"]

11 | 12 |

Refresh Token:

13 |

@ViewData["refreshToken"]

14 | 15 |
16 | @foreach (var claim in User.Claims) 17 | { 18 |
@claim.Type
19 |
@claim.Value
20 | } 21 |
-------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/MvcClient/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using MvcClient 2 | @using MvcClient.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/MvcClient/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/MvcClient/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/MvcClient/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning" 5 | } 6 | }, 7 | "AllowedHosts": "*" 8 | } 9 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/MvcClient/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/MvcClient/wwwroot/favicon.ico -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/MvcClient/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification 2 | // for details on configuring this project to bundle and minify static web assets. 3 | 4 | // Write your JavaScript code. 5 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/MvcClient/MvcClient/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) .NET Foundation. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4 | these files except in compliance with the License. You may obtain a copy of the 5 | License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed 10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 | specific language governing permissions and limitations under the License. 13 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/WpfClient/WpfClient.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/WpfClient/WpfClient/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/WpfClient/WpfClient/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/WpfClient/WpfClient/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace WpfClient 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/WpfClient/WpfClient/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/WpfClient/WpfClient/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText() { 9 | return element(by.css('ac-root h1')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/app.component.scss -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'ac-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.scss'] 7 | }) 8 | export class AppComponent { 9 | title = 'angular-client'; 10 | } 11 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/components/add-todo/add-todo.component.css: -------------------------------------------------------------------------------- 1 | .full-width { 2 | width: 100%; 3 | } 4 | 5 | .shipping-card { 6 | min-width: 120px; 7 | margin: 20px auto; 8 | } 9 | 10 | .mat-radio-button { 11 | display: block; 12 | margin: 5px 0; 13 | } 14 | 15 | .row { 16 | display: flex; 17 | flex-direction: row; 18 | } 19 | 20 | .col { 21 | flex: 1; 22 | margin-right: 20px; 23 | } 24 | 25 | .col:last-child { 26 | margin-right: 0; 27 | } 28 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/components/dashboard/dashboard.component.css: -------------------------------------------------------------------------------- 1 | .grid-container { 2 | margin: 20px; 3 | } 4 | 5 | .dashboard-card { 6 | position: absolute; 7 | top: 15px; 8 | left: 15px; 9 | right: 15px; 10 | bottom: 15px; 11 | } 12 | 13 | .more-button { 14 | position: absolute; 15 | top: 5px; 16 | right: 10px; 17 | } 18 | 19 | .dashboard-card-content { 20 | text-align: center; 21 | } 22 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/components/navbar/navbar.component.scss: -------------------------------------------------------------------------------- 1 | .sidenav-container { 2 | height: 100%; 3 | } 4 | 5 | .sidenav { 6 | width: 200px; 7 | } 8 | 9 | .sidenav { 10 | background: inherit; 11 | } 12 | 13 | .mat-toolbar.mat-primary { 14 | position: sticky; 15 | top: 0; 16 | z-index: 9999999; 17 | } 18 | 19 | .router-outlet-container { 20 | position: relative; 21 | } 22 | 23 | .toolbar-spacer { 24 | flex: 1 1 auto; 25 | } 26 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/components/todo-table/todo-table.component.scss: -------------------------------------------------------------------------------- 1 | .full-width-table { 2 | width: 100%; 3 | } 4 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/models/todo-add.ts: -------------------------------------------------------------------------------- 1 | export interface ITodoAdd { 2 | title: string; 3 | } 4 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/models/todo.ts: -------------------------------------------------------------------------------- 1 | export interface ITodo { 2 | id: string; 3 | title: string; 4 | completed: boolean; 5 | } 6 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/oidc/open-id-connect.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { OpenIdConnectService } from './open-id-connect.service'; 4 | 5 | describe('OpenIdConnectService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: OpenIdConnectService = TestBed.get(OpenIdConnectService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/oidc/redirect-silent-renew/redirect-silent-renew.component.html: -------------------------------------------------------------------------------- 1 |

2 | redirect-silent-renew works! 3 |

4 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/oidc/redirect-silent-renew/redirect-silent-renew.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/oidc/redirect-silent-renew/redirect-silent-renew.component.scss -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/oidc/redirect-silent-renew/redirect-silent-renew.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { OpenIdConnectService } from '../open-id-connect.service'; 3 | 4 | @Component({ 5 | selector: 'ac-redirect-silent-renew', 6 | templateUrl: './redirect-silent-renew.component.html', 7 | styleUrls: ['./redirect-silent-renew.component.scss'] 8 | }) 9 | export class RedirectSilentRenewComponent implements OnInit { 10 | constructor(private oidc: OpenIdConnectService) {} 11 | 12 | ngOnInit() { 13 | this.oidc.handleSilentCallback(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/oidc/signin-oidc/signin-oidc.component.html: -------------------------------------------------------------------------------- 1 |

2 | 登陆成功,返回ing 3 |

4 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/oidc/signin-oidc/signin-oidc.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/oidc/signin-oidc/signin-oidc.component.scss -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/services/todo.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { TodoService } from './todo.service'; 4 | 5 | describe('TodoService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: TodoService = TestBed.get(TodoService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/app/services/todo.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | import { ITodo } from '../models/todo'; 5 | import { ITodoAdd } from '../models/todo-add'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class TodoService { 11 | constructor(private httpClient: HttpClient) {} 12 | 13 | getAllTodos(): Observable { 14 | return this.httpClient.get(`http://localhost:5001/api/todo`); 15 | } 16 | 17 | addTodo(todo: ITodoAdd) { 18 | return this.httpClient.post(`http://localhost:5001/api/todo`, todo); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/assets/.gitkeep -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/browserslist: -------------------------------------------------------------------------------- 1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | # 5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed 6 | 7 | > 0.5% 8 | last 2 versions 9 | Firefox ESR 10 | not dead 11 | not IE 9-11 -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solenovex/Identity-Server-4-Tutorial-Demo-Code/786180f943be2b21aefcb886cc08535e19277b63/09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/favicon.ico -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AngularClient 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/main.ts: -------------------------------------------------------------------------------- 1 | import 'hammerjs'; 2 | import { enableProdMode } from '@angular/core'; 3 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 4 | 5 | import { AppModule } from './app/app.module'; 6 | import { environment } from './environments/environment'; 7 | 8 | if (environment.production) { 9 | enableProdMode(); 10 | } 11 | 12 | platformBrowserDynamic().bootstrapModule(AppModule) 13 | .catch(err => console.error(err)); 14 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | 3 | html, body { height: 100%; } 4 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } 5 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "types": [] 6 | }, 7 | "exclude": [ 8 | "test.ts", 9 | "**/*.spec.ts" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "test.ts", 12 | "polyfills.ts" 13 | ], 14 | "include": [ 15 | "**/*.spec.ts", 16 | "**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/src/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "ac", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "ac", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/angular-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "es2015", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "importHelpers": true, 13 | "target": "es5", 14 | "typeRoots": [ 15 | "node_modules/@types" 16 | ], 17 | "lib": [ 18 | "es2018", 19 | "dom" 20 | ] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /09. Single Sign On - MVC, Angular, Flask Clients access ASP.NET Core and express APIs/expressAPI/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "expressapi", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "dave", 10 | "license": "ISC", 11 | "dependencies": { 12 | "cors": "^2.8.5", 13 | "debug": "^4.1.1", 14 | "errorhandler": "^1.5.0", 15 | "express": "^4.16.4", 16 | "express-jwt": "^5.3.1", 17 | "helmet": "^3.15.1", 18 | "jwks-rsa": "^1.4.0", 19 | "morgan": "^1.9.1" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Identity Server 4 视频教程配套源码 2 | 视频教程地址:https://www.bilibili.com/video/av42364337/ 3 | 视频教程大纲: 4 | 5 | * OAuth 2.0 简介上(选看) 6 | * OAuth 2.0 简介下(选看) 7 | * OpenId Connect 简介(选看) 8 | 9 | 1. 搭建Identity Server 4服务器,Client Credentials Grant 实例 10 | 2. Resource Owner Password Credentials Grant 实例 11 | 3. Authorization Code Flow 实例 12 | 4. 刷新 Access Token (MVC Client) 13 | 5. 建立 Angular 客户端(Angular 7, Angular Material, Angular CLI) 14 | 6. Implicit Flow 实例 15 | 7. Hybrid Flow 实例,Claims映射,基于角色的授权和基于策略的授权 16 | 8. Refrence Token,撤销Tokens,Google和Github登录 17 | 9. 单点登录实例(添加Python Flask客户端,Express.js的API资源) 18 | --------------------------------------------------------------------------------