├── ClientTwo ├── angularApp │ ├── app │ │ ├── app.component.css │ │ ├── home │ │ │ ├── home.component.html │ │ │ └── home.component.ts │ │ ├── unauthorized │ │ │ ├── unauthorized.component.html │ │ │ └── unauthorized.component.ts │ │ ├── app.constants.ts │ │ ├── app.routes.ts │ │ ├── app.component.html │ │ └── app.component.ts │ ├── styles.scss │ ├── vendor.ts │ ├── assets │ │ └── damienbod.jpg │ ├── images │ │ └── damienbod.jpg │ ├── main-aot.ts │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ └── styles │ │ └── app.scss ├── favicon.ico ├── webpack.config.js ├── ClientTwo.csproj.user ├── .vscode │ ├── tasks.json │ └── launch.json ├── .template.config │ └── template.json ├── Program.cs ├── web.config ├── tsconfig-aot.json ├── Controllers │ └── ClientAppSettingsController.cs ├── tsconfig.json ├── ClientTwo.csproj ├── Properties │ └── launchSettings.json ├── config │ ├── webpack.helpers.js │ ├── spec.bundle.js │ └── webpack.test.js ├── appsettings.json ├── ViewModel │ └── ClientAppSettings.cs ├── karma.conf.js ├── Startup.cs ├── tslint.json └── package.json ├── AspNetCoreIdentityServer4 ├── wwwroot │ ├── js │ │ ├── site.min.js │ │ └── site.js │ ├── favicon.ico │ ├── lib │ │ ├── bootstrap │ │ │ ├── dist │ │ │ │ ├── fonts │ │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ │ └── js │ │ │ │ │ └── npm.js │ │ │ ├── .bower.json │ │ │ └── LICENSE │ │ ├── jquery │ │ │ ├── .bower.json │ │ │ └── LICENSE.txt │ │ ├── jquery-validation │ │ │ ├── .bower.json │ │ │ └── LICENSE.md │ │ └── jquery-validation-unobtrusive │ │ │ └── .bower.json │ ├── _references.js │ └── css │ │ ├── site.min.css │ │ └── site.css ├── .bowerrc ├── runtimeconfig.template.json ├── damienbodserver.pfx ├── db.usersdatabase.sqlite ├── ClientSelector.cs ├── db.identityserver4configuration.sqlite ├── .vs │ └── AspNetCoreIdentityServer4Persistence │ │ └── v15 │ │ └── .suo ├── Views │ ├── Home │ │ ├── About.cshtml │ │ ├── Contact.cshtml │ │ └── Index.cshtml │ ├── Account │ │ ├── ForgotPasswordConfirmation.cshtml │ │ ├── ExternalLoginFailure.cshtml │ │ ├── Lockout.cshtml │ │ ├── ResetPasswordConfirmation.cshtml │ │ ├── ConfirmEmail.cshtml │ │ ├── LoggedOut.cshtml │ │ ├── Logout.cshtml │ │ ├── SendCode.cshtml │ │ ├── ForgotPassword.cshtml │ │ ├── ExternalLoginConfirmation.cshtml │ │ ├── VerifyCode.cshtml │ │ ├── ResetPassword.cshtml │ │ ├── Register.cshtml │ │ └── Login.cshtml │ ├── Shared │ │ ├── _ValidationSummary.cshtml │ │ ├── Error.cshtml │ │ ├── _ValidationScriptsPartial.cshtml │ │ └── _LoginPartial.cshtml │ ├── _ViewStart.cshtml │ ├── _ViewImports.cshtml │ ├── Manage │ │ ├── AddPhoneNumber.cshtml │ │ ├── VerifyPhoneNumber.cshtml │ │ ├── SetPassword.cshtml │ │ ├── ChangePassword.cshtml │ │ ├── ManageLogins.cshtml │ │ └── Index.cshtml │ └── Consent │ │ ├── _ScopeListItem.cshtml │ │ └── Index.cshtml ├── bower.json ├── Resources │ ├── SharedResource.cs │ └── LocService.cs ├── Themes │ ├── _ViewStart.cshtml │ ├── _ViewImports.cshtml │ ├── ClientOne │ │ ├── Account │ │ │ ├── LoggedOut.cshtml │ │ │ └── Login.cshtml │ │ └── Shared │ │ │ └── _LoginPartial.cshtml │ └── ClientTwo │ │ ├── Account │ │ ├── LoggedOut.cshtml │ │ └── Login.cshtml │ │ └── Shared │ │ ├── _LoginPartial.cshtml │ │ └── _LayoutClientTwo.cshtml ├── Services │ ├── ISmsSender.cs │ ├── IEmailSender.cs │ └── MessageServices.cs ├── Models │ ├── ManageViewModels │ │ ├── FactorViewModel.cs │ │ ├── RemoveLoginViewModel.cs │ │ ├── AddPhoneNumberViewModel.cs │ │ ├── ConfigureTwoFactorViewModel.cs │ │ ├── ManageLoginsViewModel.cs │ │ ├── VerifyPhoneNumberViewModel.cs │ │ ├── IndexViewModel.cs │ │ ├── SetPasswordViewModel.cs │ │ └── ChangePasswordViewModel.cs │ ├── AccountViewModels │ │ ├── LogoutViewModel.cs │ │ ├── ForgotPasswordViewModel.cs │ │ ├── ExternalLoginConfirmationViewModel.cs │ │ ├── LoggedOutViewModel.cs │ │ ├── SendCodeViewModel.cs │ │ ├── LoginInputModel.cs │ │ ├── LoginViewModel.cs │ │ ├── VerifyCodeViewModel.cs │ │ ├── ResetPasswordViewModel.cs │ │ └── RegisterViewModel.cs │ ├── ErrorViewModel.cs │ ├── ConsentInputModel.cs │ └── ApplicationUser.cs ├── appsettings.json ├── web.config ├── bundleconfig.json ├── Program.cs ├── Properties │ └── launchSettings.json ├── Data │ └── ApplicationDbContext.cs ├── ClientIdFilter.cs ├── Controllers │ └── HomeController.cs ├── AspNetCoreIdentityServer4.csproj ├── Filters │ └── SecurityHeadersAttribute.cs ├── LocalizationCookieProvider.cs ├── ClientViewLocationExpander.cs └── Migrations │ ├── ConfigurationStoreContextModelSnapshot.cs │ ├── 20171224145139_id4configMigration.cs │ └── 20171224145139_id4configMigration.Designer.cs ├── ClientOne ├── angularApp │ ├── typings.d.ts │ ├── styles.scss │ ├── styles │ │ └── app.scss │ ├── app │ │ ├── forbidden │ │ │ ├── forbidden.component.html │ │ │ └── forbidden.component.ts │ │ ├── unauthorized │ │ │ ├── unauthorized.component.html │ │ │ └── unauthorized.component.ts │ │ ├── auth │ │ │ ├── models │ │ │ │ ├── authorization-result.enum.ts │ │ │ │ ├── jwtkeys.ts │ │ │ │ └── validate-state-result.model.ts │ │ │ ├── services │ │ │ │ ├── oidc-array-helper.service.ts │ │ │ │ ├── uri-encoder.ts │ │ │ │ ├── oidc.logger.service.ts │ │ │ │ ├── oidc-data.service.ts │ │ │ │ ├── oidc.security.user-service.ts │ │ │ │ ├── oidc.security.storage.ts │ │ │ │ ├── oidc-token-helper.service.ts │ │ │ │ └── oidc.security.silent-renew.ts │ │ │ └── modules │ │ │ │ └── auth.module.ts │ │ ├── home │ │ │ ├── home.component.html │ │ │ └── home.component.ts │ │ ├── app.component.css │ │ ├── app.constants.ts │ │ ├── app.routes.ts │ │ ├── app.component.ts │ │ └── app.component.html │ ├── assets │ │ └── damienbod.jpg │ ├── images │ │ └── damienbod.jpg │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ ├── main-aot.ts │ ├── vendor.ts │ ├── index.html │ ├── main.ts │ └── polyfills.ts ├── runtimeconfig.template.json ├── favicon.ico ├── webpack.config.js ├── appsettings.json ├── ClientOne.csproj.user ├── web.config ├── tsconfig-aot.json ├── ClientOne.csproj ├── Properties │ └── launchSettings.json ├── config │ ├── webpack.helpers.js │ ├── spec.bundle.js │ └── webpack.test.js ├── tsconfig.json ├── karma.conf.js ├── Startup.cs ├── package.json └── tslint.json ├── AspNetCoreIdentityServer4.Persistence ├── ConfigurationStore │ ├── readme.md │ ├── ClientStore.cs │ ├── ClientEntity.cs │ ├── ConfigurationStoreContext.cs │ ├── ApiResourceEntity.cs │ ├── IdentityResourceEntity.cs │ └── ConfigurationStoreContextFactory.cs ├── Program.cs └── AspNetCoreIdentityServer4.Persistence.csproj ├── .gitignore ├── README.md ├── SeedingConsoleApp ├── SeedingConsoleApp.csproj └── Program.cs └── AspNetCoreIdentityServer4Persistence.sln /ClientTwo/angularApp/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/js/site.min.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ClientOne/angularApp/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*"; 2 | -------------------------------------------------------------------------------- /ClientOne/angularApp/styles.scss: -------------------------------------------------------------------------------- 1 | @import './styles/app.scss'; 2 | -------------------------------------------------------------------------------- /ClientTwo/angularApp/app/home/home.component.html: -------------------------------------------------------------------------------- 1 |
Welcome
-------------------------------------------------------------------------------- /ClientTwo/angularApp/styles.scss: -------------------------------------------------------------------------------- 1 | @import './styles/app.scss'; 2 | -------------------------------------------------------------------------------- /ClientOne/angularApp/styles/app.scss: -------------------------------------------------------------------------------- 1 | a { 2 | color: #03A9F4; 3 | } -------------------------------------------------------------------------------- /ClientTwo/angularApp/vendor.ts: -------------------------------------------------------------------------------- 1 | // import 'jquery/src/jquery'; 2 | 3 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "wwwroot/lib" 3 | } 4 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Write your Javascript code. 2 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/forbidden/forbidden.component.html: -------------------------------------------------------------------------------- 1 |
403: You have no rights to access this.
-------------------------------------------------------------------------------- /ClientOne/runtimeconfig.template.json: -------------------------------------------------------------------------------- 1 | { 2 | "configProperties": { 3 | "System.GC.Server": true 4 | } 5 | } -------------------------------------------------------------------------------- /ClientOne/angularApp/app/unauthorized/unauthorized.component.html: -------------------------------------------------------------------------------- 1 |
401: You have no rights to access this. Please Login
-------------------------------------------------------------------------------- /ClientOne/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/ClientOne/favicon.ico -------------------------------------------------------------------------------- /ClientTwo/angularApp/app/unauthorized/unauthorized.component.html: -------------------------------------------------------------------------------- 1 |
401: You have no rights to access this. Please Login
-------------------------------------------------------------------------------- /ClientTwo/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/ClientTwo/favicon.ico -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/runtimeconfig.template.json: -------------------------------------------------------------------------------- 1 | { 2 | "configProperties": { 3 | "System.GC.Server": true 4 | } 5 | } -------------------------------------------------------------------------------- /ClientOne/angularApp/assets/damienbod.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/ClientOne/angularApp/assets/damienbod.jpg -------------------------------------------------------------------------------- /ClientOne/angularApp/images/damienbod.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/ClientOne/angularApp/images/damienbod.jpg -------------------------------------------------------------------------------- /ClientTwo/angularApp/assets/damienbod.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/ClientTwo/angularApp/assets/damienbod.jpg -------------------------------------------------------------------------------- /ClientTwo/angularApp/images/damienbod.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/ClientTwo/angularApp/images/damienbod.jpg -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/damienbodserver.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/AspNetCoreIdentityServer4/damienbodserver.pfx -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/AspNetCoreIdentityServer4/wwwroot/favicon.ico -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/db.usersdatabase.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/AspNetCoreIdentityServer4/db.usersdatabase.sqlite -------------------------------------------------------------------------------- /ClientOne/angularApp/app/auth/models/authorization-result.enum.ts: -------------------------------------------------------------------------------- 1 | export enum AuthorizationResult { 2 | authorized = 1, 3 | forbidden = 2, 4 | unauthorized = 3 5 | } 6 | -------------------------------------------------------------------------------- /ClientOne/webpack.config.js: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | module.exports = function(env) { 4 | return require(`./config/webpack.${env}.js`) 5 | } -------------------------------------------------------------------------------- /ClientTwo/webpack.config.js: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | module.exports = function(env) { 4 | return require(`./config/webpack.${env}.js`) 5 | } -------------------------------------------------------------------------------- /ClientOne/angularApp/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/ClientOne/angularApp/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /ClientOne/angularApp/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/ClientOne/angularApp/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /ClientOne/angularApp/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/ClientOne/angularApp/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /ClientOne/angularApp/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/ClientOne/angularApp/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/ClientSelector.cs: -------------------------------------------------------------------------------- 1 | namespace IdentityServerWithIdentitySQLite 2 | { 3 | public class ClientSelector 4 | { 5 | public string SelectedClient = ""; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/db.identityserver4configuration.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/AspNetCoreIdentityServer4/db.identityserver4configuration.sqlite -------------------------------------------------------------------------------- /ClientTwo/angularApp/app/app.constants.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable() 4 | export class Configuration { 5 | public Server = 'https://localhost:44390/'; 6 | } 7 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/home/home.component.html: -------------------------------------------------------------------------------- 1 |
Welcome
2 | 3 |
4 |

name:

5 |

{{name}}:

6 |

email:

7 |

{{email}}

8 |
9 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/.vs/AspNetCoreIdentityServer4Persistence/v15/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/AspNetCoreIdentityServer4/.vs/AspNetCoreIdentityServer4Persistence/v15/.suo -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "About"; 3 | } 4 |

@ViewData["Title"].

5 |

@ViewData["Message"]

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4.Persistence/ConfigurationStore/readme.md: -------------------------------------------------------------------------------- 1 | 2 | dotnet ef migrations add id4configMigration --context ConfigurationStoreContext 3 | 4 | dotnet ef database update --context ConfigurationStoreContext --verbose -------------------------------------------------------------------------------- /ClientOne/angularApp/app/app.component.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | } 4 | 5 | .starter-template { 6 | padding: 40px 15px; 7 | text-align: center; 8 | } 9 | 10 | .navigationLinkButton:hover { 11 | cursor: pointer; 12 | } -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Account/ForgotPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Forgot Password Confirmation"; 3 | } 4 | 5 |

@ViewData["Title"].

6 |

7 | Please check your email to reset your password. 8 |

9 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Account/ExternalLoginFailure.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Login Failure"; 3 | } 4 | 5 |
6 |

@ViewData["Title"].

7 |

Unsuccessful login with service.

8 |
9 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/AspNetCoreIdentityServer4/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/AspNetCoreIdentityServer4/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/AspNetCoreIdentityServer4/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/AspNetCoreIdentityServer4Persistence/HEAD/AspNetCoreIdentityServer4/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /ClientOne/angularApp/app/app.constants.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable() 4 | export class Configuration { 5 | public Server = 'https://localhost:44390/'; 6 | public FileServer = 'https://localhost:44378/'; 7 | } 8 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Account/Lockout.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Locked out"; 3 | } 4 | 5 |
6 |

Locked out.

7 |

This account has been locked out, please try again later.

8 |
9 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Shared/_ValidationSummary.cshtml: -------------------------------------------------------------------------------- 1 | @if (ViewContext.ModelState.IsValid == false) 2 | { 3 |
4 | Error 5 |
6 |
7 | } -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "asp.net", 3 | "private": true, 4 | "dependencies": { 5 | "bootstrap": "3.3.6", 6 | "jquery": "2.2.0", 7 | "jquery-validation": "1.14.0", 8 | "jquery-validation-unobtrusive": "3.2.6" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ClientOne/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Resources/SharedResource.cs: -------------------------------------------------------------------------------- 1 | namespace IdentityServerWithAspNetIdentity.Resources 2 | { 3 | /// 4 | /// Dummy class to group shared resources 5 | /// 6 | public class SharedResource 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ClientOne/ClientOne.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0.0 5 | 6 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/auth/models/jwtkeys.ts: -------------------------------------------------------------------------------- 1 | export class JwtKeys { 2 | keys: JwtKey[]; 3 | } 4 | 5 | export class JwtKey { 6 | kty: string; 7 | use: string; 8 | kid: string; 9 | x5t: string; 10 | e: string; 11 | n: string; 12 | x5c: any[]; 13 | } -------------------------------------------------------------------------------- /ClientTwo/ClientTwo.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0.0 5 | 6 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/auth/models/validate-state-result.model.ts: -------------------------------------------------------------------------------- 1 | export class ValidateStateResult { 2 | constructor( 3 | public access_token = '', 4 | public id_token = '', 5 | public authResponseIsValid = false, 6 | public decoded_id_token: any 7 | ) {} 8 | } 9 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Account/ResetPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Reset password confirmation"; 3 | } 4 | 5 |

@ViewData["Title"].

6 |

7 | Your password has been reset. Please Click here to log in. 8 |

9 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4.Persistence/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AspNetCoreIdentityServer4.Persistence 4 | { 5 | class Program 6 | { 7 | static void Main(string[] args) 8 | { 9 | Console.WriteLine("Hello World!"); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Themes/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Globalization 2 | @using IdentityServerWithAspNetIdentity.Resources 3 | @inject LocService SharedLocalizer 4 | @inject IdentityServerWithIdentitySQLite.ClientSelector _clientSelector 5 | @{ 6 | Layout = $"_Layout{_clientSelector.SelectedClient}"; 7 | } 8 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Globalization 2 | @using IdentityServerWithAspNetIdentity.Resources 3 | @inject LocService SharedLocalizer 4 | @inject IdentityServerWithIdentitySQLite.ClientSelector _clientSelector 5 | @{ 6 | Layout = $"_Layout{_clientSelector.SelectedClient}"; 7 | } 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /ClientOne/node_modules 2 | /ClientOne/angularApp/**/*.js 3 | /ClientOne/angularApp/**/*.js.map 4 | /.vs/config/applicationhost.config 5 | /.vs 6 | /**/bin 7 | /ClientTwo/node_modules 8 | /ClientTwo/angularApp/**/*.js.map 9 | /ClientTwo/angularApp/**/*.js 10 | /ClientTwo/wwwroot/ 11 | /ClientOne/wwwroot/ 12 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Account/ConfirmEmail.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Confirm Email"; 3 | } 4 | 5 |

@ViewData["Title"].

6 |
7 |

8 | Thank you for confirming your email. Please Click here to Log in. 9 |

10 |
11 | -------------------------------------------------------------------------------- /ClientOne/angularApp/main-aot.ts: -------------------------------------------------------------------------------- 1 | import './styles.scss'; 2 | 3 | import { platformBrowser } from '@angular/platform-browser'; 4 | import { enableProdMode } from '@angular/core'; 5 | import { AppModuleNgFactory } from './app/app.module.ngfactory'; 6 | 7 | enableProdMode(); 8 | 9 | platformBrowser().bootstrapModuleFactory(AppModuleNgFactory); -------------------------------------------------------------------------------- /ClientTwo/angularApp/main-aot.ts: -------------------------------------------------------------------------------- 1 | import './styles.scss'; 2 | 3 | import { platformBrowser } from '@angular/platform-browser'; 4 | import { enableProdMode } from '@angular/core'; 5 | import { AppModuleNgFactory } from './app/app.module.ngfactory'; 6 | 7 | enableProdMode(); 8 | 9 | platformBrowser().bootstrapModuleFactory(AppModuleNgFactory); -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Services/ISmsSender.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace IdentityServerWithAspNetIdentity.Services 7 | { 8 | public interface ISmsSender 9 | { 10 | Task SendSmsAsync(string number, string message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ClientOne/angularApp/vendor.ts: -------------------------------------------------------------------------------- 1 | import 'jquery/src/jquery'; 2 | import 'bootstrap/dist/js/bootstrap'; 3 | 4 | import 'bootstrap/dist/css/bootstrap.css'; 5 | import 'bootstrap/dist/css/bootstrap-theme.css'; 6 | 7 | import '../favicon.ico'; 8 | 9 | // Other vendors for example jQuery, Lodash or Bootstrap 10 | // You can import js, ts, css, sass, ... 11 | 12 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Themes/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using IdentityServerWithAspNetIdentity 2 | @using IdentityServerWithAspNetIdentity.Models 3 | @using IdentityServerWithAspNetIdentity.Models.AccountViewModels 4 | @using IdentityServerWithAspNetIdentity.Models.ManageViewModels 5 | @using Microsoft.AspNetCore.Identity 6 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 7 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using IdentityServerWithAspNetIdentity 2 | @using IdentityServerWithAspNetIdentity.Models 3 | @using IdentityServerWithAspNetIdentity.Models.AccountViewModels 4 | @using IdentityServerWithAspNetIdentity.Models.ManageViewModels 5 | @using Microsoft.AspNetCore.Identity 6 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 7 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/ManageViewModels/FactorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace IdentityServerWithAspNetIdentity.Models.ManageViewModels 7 | { 8 | public class FactorViewModel 9 | { 10 | public string Purpose { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Services/IEmailSender.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace IdentityServerWithAspNetIdentity.Services 7 | { 8 | public interface IEmailSender 9 | { 10 | Task SendEmailAsync(string email, string subject, string message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/_references.js: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Using an EF Core database for the IdentityServer4 configuration data 2 | 3 | https://damienbod.com/2017/12/30/using-an-ef-core-database-for-the-identityserver4-configuration-data/ 4 | 5 | # Creating specific themes for OIDC clients using razor views with IdentityServer4 6 | 7 | https://damienbod.com/2018/01/05/creating-specific-themes-for-oidc-clients-using-razor-views-with-identityserver4/ 8 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/AccountViewModels/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.Models 6 | { 7 | public class LogoutViewModel 8 | { 9 | public string LogoutId { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /ClientOne/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ClientTwo/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | "command": "dotnet", 4 | "isShellCommand": true, 5 | "args": [], 6 | "tasks": [ 7 | { 8 | "taskName": "build", 9 | "args": [ 10 | "${workspaceRoot}\\project.json" 11 | ], 12 | "isBuildCommand": true, 13 | "problemMatcher": "$msCompile" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/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.Models 8 | { 9 | public class ErrorViewModel 10 | { 11 | public ErrorMessage Error { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /ClientOne/angularApp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | ASP.NET Core Angular IdentityServer4 Client 8 | 9 | 10 | 11 | Loading... 12 | 13 | 14 | -------------------------------------------------------------------------------- /ClientTwo/angularApp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | ASP.NET Core 1.0 Angular IdentityServer4 Client 8 | 9 | 10 | 11 | Loading... 12 | 13 | 14 | -------------------------------------------------------------------------------- /ClientTwo/.template.config/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Damien Bowden, Roberto Simonetti, Fabian Gosebrink", 3 | "classifications": [ "Web", "SPA", "Angular" ], 4 | "name": "ASP.NET Core with Angular and Webpack", 5 | "identity": "AngularWebpackVisualStudio", 6 | "shortName": "angularwebapi", 7 | "tags": { 8 | "language": "C#" 9 | }, 10 | "sourceName": "AngularWebpackVisualStudio", 11 | "preferNameDirectory" : "true" 12 | } -------------------------------------------------------------------------------- /ClientOne/angularApp/main.ts: -------------------------------------------------------------------------------- 1 | import './styles.scss'; 2 | 3 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 4 | // import { platformBrowser } from '@angular/platform-browser'; 5 | 6 | import { AppModule } from './app/app.module'; 7 | 8 | // Styles. 9 | // Enables Hot Module Replacement. 10 | declare var module: any; 11 | 12 | if (module.hot) { 13 | module.hot.accept(); 14 | } 15 | 16 | platformBrowserDynamic().bootstrapModule(AppModule); 17 | -------------------------------------------------------------------------------- /ClientTwo/angularApp/main.ts: -------------------------------------------------------------------------------- 1 | import './styles.scss'; 2 | 3 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 4 | // import { platformBrowser } from '@angular/platform-browser'; 5 | 6 | import { AppModule } from './app/app.module'; 7 | 8 | // Styles. 9 | // Enables Hot Module Replacement. 10 | declare var module: any; 11 | 12 | if (module.hot) { 13 | module.hot.accept(); 14 | } 15 | 16 | platformBrowserDynamic().bootstrapModule(AppModule); 17 | -------------------------------------------------------------------------------- /ClientTwo/angularApp/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-home', 5 | templateUrl: 'home.component.html' 6 | }) 7 | 8 | export class HomeComponent implements OnInit { 9 | 10 | public message: string; 11 | public values: any[]; 12 | 13 | constructor() { 14 | this.message = 'HomeComponent constructor'; 15 | } 16 | 17 | ngOnInit() { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/AccountViewModels/ForgotPasswordViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace IdentityServerWithAspNetIdentity.Models.AccountViewModels 8 | { 9 | public class ForgotPasswordViewModel 10 | { 11 | [Required] 12 | [EmailAddress] 13 | public string Email { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/ManageViewModels/RemoveLoginViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace IdentityServerWithAspNetIdentity.Models.ManageViewModels 8 | { 9 | public class RemoveLoginViewModel 10 | { 11 | public string LoginProvider { get; set; } 12 | public string ProviderKey { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/AccountViewModels/ExternalLoginConfirmationViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace IdentityServerWithAspNetIdentity.Models.AccountViewModels 8 | { 9 | public class ExternalLoginConfirmationViewModel 10 | { 11 | [Required] 12 | [EmailAddress] 13 | public string Email { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/forbidden/forbidden.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-forbidden', 5 | templateUrl: 'forbidden.component.html' 6 | }) 7 | 8 | export class ForbiddenComponent implements OnInit { 9 | 10 | public message: string; 11 | public values: any[]; 12 | 13 | constructor() { 14 | this.message = 'ForbiddenComponent constructor'; 15 | } 16 | 17 | ngOnInit() { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/ManageViewModels/AddPhoneNumberViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace IdentityServerWithAspNetIdentity.Models.ManageViewModels 8 | { 9 | public class AddPhoneNumberViewModel 10 | { 11 | [Required] 12 | [Phone] 13 | [Display(Name = "Phone number")] 14 | public string PhoneNumber { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/ManageViewModels/ConfigureTwoFactorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Mvc.Rendering; 6 | 7 | namespace IdentityServerWithAspNetIdentity.Models.ManageViewModels 8 | { 9 | public class ConfigureTwoFactorViewModel 10 | { 11 | public string SelectedProvider { get; set; } 12 | 13 | public ICollection Providers { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ClientTwo/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore; 2 | using Microsoft.AspNetCore.Hosting; 3 | 4 | namespace Angular2WebpackVisualStudio 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | BuildWebHost(args).Run(); 11 | } 12 | 13 | public static IWebHost BuildWebHost(string[] args) => 14 | WebHost.CreateDefaultBuilder(args) 15 | .UseStartup() 16 | .Build(); 17 | } 18 | } -------------------------------------------------------------------------------- /ClientTwo/angularApp/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes, RouterModule } from '@angular/router'; 2 | 3 | import { HomeComponent } from './home/home.component'; 4 | import { UnauthorizedComponent } from './unauthorized/unauthorized.component'; 5 | 6 | const appRoutes: Routes = [ 7 | { path: '', component: HomeComponent }, 8 | { path: 'home', component: HomeComponent }, 9 | { path: 'unauthorized', component: UnauthorizedComponent } 10 | ]; 11 | 12 | export const routing = RouterModule.forRoot(appRoutes); 13 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/unauthorized/unauthorized.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-unauthorized', 5 | templateUrl: 'unauthorized.component.html' 6 | }) 7 | 8 | export class UnauthorizedComponent implements OnInit { 9 | 10 | public message: string; 11 | public values: any[]; 12 | 13 | constructor() { 14 | this.message = 'UnauthorizedComponent constructor'; 15 | } 16 | 17 | ngOnInit() { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ClientTwo/angularApp/app/unauthorized/unauthorized.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-unauthorized', 5 | templateUrl: 'unauthorized.component.html' 6 | }) 7 | 8 | export class UnauthorizedComponent implements OnInit { 9 | 10 | public message: string; 11 | public values: any[]; 12 | 13 | constructor() { 14 | this.message = 'UnauthorizedComponent constructor'; 15 | } 16 | 17 | ngOnInit() { 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /ClientTwo/angularApp/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | Login 3 | Direct Message 4 | Logout 5 |

{{email}}

6 |
7 |
8 | 9 |
10 | 11 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/AccountViewModels/LoggedOutViewModel.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.Models 6 | { 7 | public class LoggedOutViewModel 8 | { 9 | public string PostLogoutRedirectUri { get; set; } 10 | public string ClientName { get; set; } 11 | public string SignOutIframeUrl { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Contact"; 3 | } 4 |

@ViewData["Title"].

5 |

@ViewData["Message"]

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
18 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/auth/services/oidc-array-helper.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable() 4 | export class ArrayHelperService { 5 | constructor() {} 6 | 7 | arraysEqual(arr1: Array, arr2: Array) { 8 | if (arr1.length !== arr2.length) { 9 | return false; 10 | } 11 | 12 | for (let i = arr1.length; i--; ) { 13 | if (arr1[i] !== arr2[i]) { 14 | return false; 15 | } 16 | } 17 | 18 | return true; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/ManageViewModels/ManageLoginsViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Http.Authentication; 6 | using Microsoft.AspNetCore.Identity; 7 | 8 | namespace IdentityServerWithAspNetIdentity.Models.ManageViewModels 9 | { 10 | public class ManageLoginsViewModel 11 | { 12 | public IList CurrentLogins { get; set; } 13 | 14 | public IList OtherLogins { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/lib/bootstrap/dist/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /ClientOne/angularApp/app/auth/services/uri-encoder.ts: -------------------------------------------------------------------------------- 1 | import { HttpParameterCodec } from '@angular/common/http'; 2 | 3 | export class UriEncoder implements HttpParameterCodec { 4 | encodeKey(key: string): string { 5 | return encodeURIComponent(key); 6 | } 7 | 8 | encodeValue(value: string): string { 9 | return encodeURIComponent(value); 10 | } 11 | 12 | decodeKey(key: string): string { 13 | return decodeURIComponent(key); 14 | } 15 | 16 | decodeValue(value: string): string { 17 | return decodeURIComponent(value); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/ManageViewModels/VerifyPhoneNumberViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace IdentityServerWithAspNetIdentity.Models.ManageViewModels 8 | { 9 | public class VerifyPhoneNumberViewModel 10 | { 11 | [Required] 12 | public string Code { get; set; } 13 | 14 | [Required] 15 | [Phone] 16 | [Display(Name = "Phone number")] 17 | public string PhoneNumber { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/AccountViewModels/SendCodeViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Mvc.Rendering; 6 | 7 | namespace IdentityServerWithAspNetIdentity.Models.AccountViewModels 8 | { 9 | public class SendCodeViewModel 10 | { 11 | public string SelectedProvider { get; set; } 12 | 13 | public ICollection Providers { get; set; } 14 | 15 | public string ReturnUrl { get; set; } 16 | 17 | public bool RememberMe { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/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.Models 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 | } -------------------------------------------------------------------------------- /ClientTwo/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /SeedingConsoleApp/SeedingConsoleApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp2.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "ConnectionStrings": { 4 | "DefaultConnection": "Data Source=C:\\git\\AspNetCoreIdentityServer4Persistence\\AspNetCoreIdentityServer4\\db.usersdatabase.sqlite", 5 | "ConfigurationStoreConnection": "Data Source=C:\\git\\AspNetCoreIdentityServer4Persistence\\AspNetCoreIdentityServer4\\db.identityserver4configuration.sqlite" 6 | }, 7 | 8 | "Logging": { 9 | "IncludeScopes": false, 10 | "LogLevel": { 11 | "Default": "Debug", 12 | "System": "Information", 13 | "Microsoft": "Information" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /ClientOne/tsconfig-aot.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "es2015", 5 | "moduleResolution": "node", 6 | "sourceMap": true, 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "removeComments": true, 10 | "skipLibCheck": true, 11 | "strict": true, 12 | "noUnusedLocals": true, 13 | "noUnusedParameters": true, 14 | "lib": [ 15 | "es2015", 16 | "dom" 17 | ] 18 | }, 19 | "angularCompilerOptions": { 20 | "entryModule": "./angularApp/app/app.module#AppModule", 21 | "skipMetadataEmit": true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ClientTwo/tsconfig-aot.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "es2015", 5 | "moduleResolution": "node", 6 | "sourceMap": true, 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "removeComments": true, 10 | "skipLibCheck": true, 11 | "strict": true, 12 | "noUnusedLocals": true, 13 | "noUnusedParameters": true, 14 | "lib": [ 15 | "es2015", 16 | "dom" 17 | ] 18 | }, 19 | "angularCompilerOptions": { 20 | "entryModule": "./angularApp/app/app.module#AppModule", 21 | "skipMetadataEmit": true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/ManageViewModels/IndexViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Identity; 6 | 7 | namespace IdentityServerWithAspNetIdentity.Models.ManageViewModels 8 | { 9 | public class IndexViewModel 10 | { 11 | public bool HasPassword { get; set; } 12 | 13 | public IList Logins { get; set; } 14 | 15 | public string PhoneNumber { get; set; } 16 | 17 | public bool TwoFactor { get; set; } 18 | 19 | public bool BrowserRemembered { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ClientOne/ClientOne.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netcoreapp2.0 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes, RouterModule } from '@angular/router'; 2 | 3 | import { ForbiddenComponent } from './forbidden/forbidden.component'; 4 | import { HomeComponent } from './home/home.component'; 5 | import { UnauthorizedComponent } from './unauthorized/unauthorized.component'; 6 | 7 | const appRoutes: Routes = [ 8 | { path: '', component: HomeComponent }, 9 | { path: 'home', component: HomeComponent }, 10 | { path: 'Forbidden', component: ForbiddenComponent }, 11 | { path: 'Unauthorized', component: UnauthorizedComponent } 12 | ]; 13 | 14 | export const routing = RouterModule.forRoot(appRoutes); 15 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/lib/jquery/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "main": "dist/jquery.js", 4 | "license": "MIT", 5 | "ignore": [ 6 | "package.json" 7 | ], 8 | "keywords": [ 9 | "jquery", 10 | "javascript", 11 | "browser", 12 | "library" 13 | ], 14 | "homepage": "https://github.com/jquery/jquery-dist", 15 | "version": "2.2.0", 16 | "_release": "2.2.0", 17 | "_resolution": { 18 | "type": "version", 19 | "tag": "2.2.0", 20 | "commit": "6fc01e29bdad0964f62ef56d01297039cdcadbe5" 21 | }, 22 | "_source": "git://github.com/jquery/jquery-dist.git", 23 | "_target": "2.2.0", 24 | "_originalSource": "jquery" 25 | } -------------------------------------------------------------------------------- /ClientOne/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "https://localhost:44372/", 7 | "sslPort": 44372 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "web": { 19 | "commandName": "web", 20 | "environmentVariables": { 21 | "ASPNETCORE_ENVIRONMENT": "Development" 22 | } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Account/LoggedOut.cshtml: -------------------------------------------------------------------------------- 1 | @model IdentityServer4.Quickstart.UI.Models.LoggedOutViewModel 2 | 3 | 22 | -------------------------------------------------------------------------------- /ClientOne/angularApp/polyfills.ts: -------------------------------------------------------------------------------- 1 | import 'ie-shim'; // Internet Explorer 9 support. 2 | 3 | import 'core-js/es6/symbol'; 4 | import 'core-js/es6/object'; 5 | import 'core-js/es6/function'; 6 | import 'core-js/es6/parse-int'; 7 | import 'core-js/es6/parse-float'; 8 | import 'core-js/es6/number'; 9 | import 'core-js/es6/math'; 10 | import 'core-js/es6/string'; 11 | import 'core-js/es6/date'; 12 | import 'core-js/es6/array'; 13 | import 'core-js/es6/regexp'; 14 | import 'core-js/es6/map'; 15 | import 'core-js/es6/set'; 16 | import 'core-js/es6/weak-map'; 17 | import 'core-js/es6/weak-set'; 18 | import 'core-js/es6/typed'; 19 | import 'core-js/es6/reflect'; 20 | import 'core-js/es7/reflect'; 21 | 22 | import 'zone.js/dist/zone'; 23 | -------------------------------------------------------------------------------- /ClientTwo/angularApp/polyfills.ts: -------------------------------------------------------------------------------- 1 | import 'ie-shim'; // Internet Explorer 9 support. 2 | 3 | import 'core-js/es6/symbol'; 4 | import 'core-js/es6/object'; 5 | import 'core-js/es6/function'; 6 | import 'core-js/es6/parse-int'; 7 | import 'core-js/es6/parse-float'; 8 | import 'core-js/es6/number'; 9 | import 'core-js/es6/math'; 10 | import 'core-js/es6/string'; 11 | import 'core-js/es6/date'; 12 | import 'core-js/es6/array'; 13 | import 'core-js/es6/regexp'; 14 | import 'core-js/es6/map'; 15 | import 'core-js/es6/set'; 16 | import 'core-js/es6/weak-map'; 17 | import 'core-js/es6/weak-set'; 18 | import 'core-js/es6/typed'; 19 | import 'core-js/es6/reflect'; 20 | import 'core-js/es7/reflect'; 21 | 22 | import 'zone.js/dist/zone'; 23 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/auth/services/oidc.logger.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { AuthConfiguration } from '../modules/auth.configuration'; 3 | 4 | @Injectable() 5 | export class LoggerService { 6 | constructor(private authConfiguration: AuthConfiguration) {} 7 | 8 | logError(message: any) { 9 | console.error(message); 10 | } 11 | 12 | logWarning(message: any) { 13 | if (this.authConfiguration.log_console_warning_active) { 14 | console.warn(message); 15 | } 16 | } 17 | 18 | logDebug(message: any) { 19 | if (this.authConfiguration.log_console_debug_active) { 20 | console.log(message); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/AccountViewModels/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.Models 8 | { 9 | public class LoginInputModel 10 | { 11 | [Required(ErrorMessage = "emailRequired")] 12 | public string Email { get; set; } 13 | [Required(ErrorMessage = "passwordRequired")] 14 | public string Password { get; set; } 15 | public bool RememberLogin { get; set; } 16 | public string ReturnUrl { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/bundleconfig.json: -------------------------------------------------------------------------------- 1 | // Configure bundling and minification for the project. 2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241 3 | [ 4 | { 5 | "outputFileName": "wwwroot/css/site.min.css", 6 | // An array of relative input file paths. Globbing patterns supported 7 | "inputFiles": [ 8 | "wwwroot/css/site.css" 9 | ] 10 | }, 11 | { 12 | "outputFileName": "wwwroot/js/site.min.js", 13 | "inputFiles": [ 14 | "wwwroot/js/site.js" 15 | ], 16 | // Optionally specify minification options 17 | "minify": { 18 | "enabled": true, 19 | "renameLocals": true 20 | }, 21 | // Optinally generate .map file 22 | "sourceMap": false 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/AccountViewModels/LoginViewModel.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.Models 8 | { 9 | public class LoginViewModel : LoginInputModel 10 | { 11 | public bool EnableLocalLogin { get; set; } 12 | public IEnumerable ExternalProviders { get; set; } 13 | } 14 | 15 | public class ExternalProvider 16 | { 17 | public string DisplayName { get; set; } 18 | public string AuthenticationScheme { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Account/Logout.cshtml: -------------------------------------------------------------------------------- 1 | @model IdentityServer4.Quickstart.UI.Models.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 |
-------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Resources/LocService.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Localization; 2 | using System.Reflection; 3 | 4 | namespace IdentityServerWithAspNetIdentity.Resources 5 | { 6 | public class LocService 7 | { 8 | private readonly IStringLocalizer _localizer; 9 | 10 | public LocService(IStringLocalizerFactory factory) 11 | { 12 | var type = typeof(SharedResource); 13 | var assemblyName = new AssemblyName(type.GetTypeInfo().Assembly.FullName); 14 | _localizer = factory.Create("SharedResource", assemblyName.Name); 15 | } 16 | 17 | public LocalizedString GetLocalizedHtmlString(string key) 18 | { 19 | return _localizer[key]; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /ClientTwo/Controllers/ClientAppSettingsController.cs: -------------------------------------------------------------------------------- 1 | using SecurityAspNetCoreSignalR.ViewModel; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.Extensions.Options; 4 | 5 | namespace SecurityAspNetCoreSignalR.Controllers 6 | { 7 | [Route("api/[controller]")] 8 | public class ClientAppSettingsController : Controller 9 | { 10 | private readonly ClientAppSettings _clientAppSettings; 11 | 12 | public ClientAppSettingsController(IOptions clientAppSettings) 13 | { 14 | _clientAppSettings = clientAppSettings.Value; 15 | } 16 | 17 | [HttpGet] 18 | public IActionResult Get() 19 | { 20 | return Ok(_clientAppSettings); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/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 IdentityServerWithAspNetIdentitySqlite 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | BuildWebHost(args).Run(); 18 | } 19 | 20 | public static IWebHost BuildWebHost(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup() 23 | .Build(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/AccountViewModels/VerifyCodeViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace IdentityServerWithAspNetIdentity.Models.AccountViewModels 8 | { 9 | public class VerifyCodeViewModel 10 | { 11 | [Required] 12 | public string Provider { get; set; } 13 | 14 | [Required] 15 | public string Code { get; set; } 16 | 17 | public string ReturnUrl { get; set; } 18 | 19 | [Display(Name = "Remember this browser?")] 20 | public bool RememberBrowser { get; set; } 21 | 22 | [Display(Name = "Remember me?")] 23 | public bool RememberMe { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Account/SendCode.cshtml: -------------------------------------------------------------------------------- 1 | @model SendCodeViewModel 2 | @{ 3 | ViewData["Title"] = "Send Verification Code"; 4 | } 5 | 6 |

@ViewData["Title"].

7 | 8 |
9 | 10 |
11 |
12 | Select Two-Factor Authentication Provider: 13 | 14 | 15 |
16 |
17 |
18 | 19 | @section Scripts { 20 | @{await Html.RenderPartialAsync("_ValidationScriptsPartial"); } 21 | } 22 | -------------------------------------------------------------------------------- /ClientTwo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "es2015", 5 | "moduleResolution": "node", 6 | "sourceMap": true, 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "removeComments": true, 10 | "noImplicitAny": true, 11 | "skipLibCheck": true, 12 | "noUnusedLocals": true, 13 | "noUnusedParameters": true, 14 | "lib": [ 15 | "es2015", 16 | "dom" 17 | ], 18 | "typeRoots": [ 19 | "./node_modules/@types/" 20 | ] 21 | }, 22 | "exclude": [ 23 | "node_modules", 24 | "./angularApp/main-aot.ts" 25 | ], 26 | "awesomeTypescriptLoaderOptions": { 27 | "useWebpackText": true 28 | }, 29 | "compileOnSave": false, 30 | "buildOnSave": false 31 | } 32 | -------------------------------------------------------------------------------- /ClientTwo/ClientTwo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netcoreapp2.0 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Themes/ClientOne/Account/LoggedOut.cshtml: -------------------------------------------------------------------------------- 1 | @model IdentityServer4.Quickstart.UI.Models.LoggedOutViewModel 2 | @inject IdentityServerWithIdentitySQLite.ClientSelector _clientSelector 3 | Theme: @_clientSelector.SelectedClient 4 | 5 | 22 | -------------------------------------------------------------------------------- /ClientOne/config/webpack.helpers.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | 3 | module.exports = { 4 | packageSort: function (packages) { 5 | // packages = ['polyfills', 'vendor', 'app'] 6 | var len = packages.length - 1; 7 | var first = packages[0]; 8 | var last = packages[len]; 9 | return function sort(a, b) { 10 | // polyfills always first 11 | if (a.names[0] === first) { 12 | return -1; 13 | } 14 | // main always last 15 | if (a.names[0] === last) { 16 | return 1; 17 | } 18 | // vendor before app 19 | if (a.names[0] !== first && b.names[0] === last) { 20 | return -1; 21 | } else { 22 | return 1; 23 | } 24 | }; 25 | } 26 | }; -------------------------------------------------------------------------------- /ClientOne/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "es2015", 5 | "moduleResolution": "node", 6 | "sourceMap": true, 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "removeComments": true, 10 | "noImplicitAny": true, 11 | "skipLibCheck": true, 12 | "noUnusedLocals": true, 13 | "strict": true, 14 | "noUnusedParameters": true, 15 | "lib": [ 16 | "es2015", 17 | "dom" 18 | ], 19 | "typeRoots": [ 20 | "./node_modules/@types/" 21 | ] 22 | }, 23 | "exclude": [ 24 | "node_modules", 25 | "./angularApp/main-aot.ts" 26 | ], 27 | "awesomeTypescriptLoaderOptions": { 28 | "useWebpackText": true 29 | }, 30 | "compileOnSave": false, 31 | "buildOnSave": false 32 | } 33 | -------------------------------------------------------------------------------- /ClientTwo/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "https://localhost:44395/", 7 | "sslPort": 44395 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "launchUrl": "index.html", 15 | "environmentVariables": { 16 | "ASPNETCORE_ENVIRONMENT": "Development" 17 | } 18 | }, 19 | "Angular2WebpackVisualStudio": { 20 | "commandName": "Project", 21 | "launchBrowser": true, 22 | "launchUrl": "http://localhost:5000/", 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /ClientTwo/config/webpack.helpers.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | 3 | module.exports = { 4 | packageSort: function (packages) { 5 | // packages = ['polyfills', 'vendor', 'app'] 6 | var len = packages.length - 1; 7 | var first = packages[0]; 8 | var last = packages[len]; 9 | return function sort(a, b) { 10 | // polyfills always first 11 | if (a.names[0] === first) { 12 | return -1; 13 | } 14 | // main always last 15 | if (a.names[0] === last) { 16 | return 1; 17 | } 18 | // vendor before app 19 | if (a.names[0] !== first && b.names[0] === last) { 20 | return -1; 21 | } else { 22 | return 1; 23 | } 24 | }; 25 | } 26 | }; -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/css/site.min.css: -------------------------------------------------------------------------------- 1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}input,select,textarea{max-width:280px}.carousel-caption p{font-size:20px;line-height:1.4}.btn-bracketed::before{display:inline-block;content:"[";padding-right:.5em}.btn-bracketed::after{display:inline-block;content:"]";padding-left:.5em}.carousel-inner .item img[src$=".svg"]{width:100%}@media screen and (max-width:767px){.carousel-caption{display:none}}.page-consent .client-logo{float:left}.page-consent .client-logo img{width:80px;height:80px}.page-consent .consent-buttons{margin-top:25px}.page-consent .consent-form .consent-scopecheck{display:inline-block;margin-right:5px}.page-consent .consent-form .consent-description{margin-left:25px}.page-consent .consent-form .consent-description label{font-weight:normal}.page-consent .consent-form .consent-remember{padding-left:16px} -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/ApplicationUser.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Identity; 2 | 3 | namespace IdentityServerWithAspNetIdentity.Models 4 | { 5 | // Add profile data for application users by adding properties to the ApplicationUser class 6 | public class ApplicationUser : IdentityUser 7 | { 8 | public bool IsAdmin { get; set; } 9 | public string DataEventRecordsRole { get; set; } 10 | public string SecuredFilesRole { get; set; } 11 | } 12 | } 13 | 14 | //new Claim(JwtClaimTypes.Role, "admin"), 15 | //new Claim(JwtClaimTypes.Role, "dataEventRecords.admin"), 16 | //new Claim(JwtClaimTypes.Role, "dataEventRecords.user"), 17 | //new Claim(JwtClaimTypes.Role, "dataEventRecords"), 18 | //new Claim(JwtClaimTypes.Role, "securedFiles.user"), 19 | //new Claim(JwtClaimTypes.Role, "securedFiles.admin"), 20 | //new Claim(JwtClaimTypes.Role, "securedFiles") -------------------------------------------------------------------------------- /ClientOne/config/spec.bundle.js: -------------------------------------------------------------------------------- 1 | Error.stackTraceLimit = Infinity; 2 | 3 | require('core-js'); 4 | require('zone.js/dist/zone'); 5 | require('zone.js/dist/long-stack-trace-zone'); 6 | require('zone.js/dist/proxy'); 7 | require('zone.js/dist/sync-test'); 8 | require('zone.js/dist/jasmine-patch'); 9 | require('zone.js/dist/async-test'); 10 | require('zone.js/dist/fake-async-test'); 11 | require('rxjs/Rx'); 12 | 13 | var testing = require('@angular/core/testing'); 14 | var browser = require('@angular/platform-browser-dynamic/testing'); 15 | 16 | testing.TestBed.initTestEnvironment( 17 | browser.BrowserDynamicTestingModule, 18 | browser.platformBrowserDynamicTesting() 19 | ); 20 | 21 | var testContext = require.context('../angularApp', true, /\.spec\.ts/); 22 | 23 | function requireAll(requireContext) { 24 | return requireContext.keys().map(requireContext); 25 | } 26 | 27 | var modules = requireAll(testContext); 28 | -------------------------------------------------------------------------------- /ClientTwo/config/spec.bundle.js: -------------------------------------------------------------------------------- 1 | Error.stackTraceLimit = Infinity; 2 | 3 | require('core-js'); 4 | require('zone.js/dist/zone'); 5 | require('zone.js/dist/long-stack-trace-zone'); 6 | require('zone.js/dist/proxy'); 7 | require('zone.js/dist/sync-test'); 8 | require('zone.js/dist/jasmine-patch'); 9 | require('zone.js/dist/async-test'); 10 | require('zone.js/dist/fake-async-test'); 11 | require('rxjs/Rx'); 12 | 13 | var testing = require('@angular/core/testing'); 14 | var browser = require('@angular/platform-browser-dynamic/testing'); 15 | 16 | testing.TestBed.initTestEnvironment( 17 | browser.BrowserDynamicTestingModule, 18 | browser.platformBrowserDynamicTesting() 19 | ); 20 | 21 | var testContext = require.context('../angularApp', true, /\.spec\.ts/); 22 | 23 | function requireAll(requireContext) { 24 | return requireContext.keys().map(requireContext); 25 | } 26 | 27 | var modules = requireAll(testContext); 28 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/ManageViewModels/SetPasswordViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace IdentityServerWithAspNetIdentity.Models.ManageViewModels 8 | { 9 | public class SetPasswordViewModel 10 | { 11 | [Required] 12 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] 13 | [DataType(DataType.Password)] 14 | [Display(Name = "New password")] 15 | public string NewPassword { get; set; } 16 | 17 | [DataType(DataType.Password)] 18 | [Display(Name = "Confirm new password")] 19 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] 20 | public string ConfirmPassword { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "https://localhost:44318/", 7 | "sslPort": 44318 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "IdentityServerWithAspNetIdentity": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "launchUrl": "http://localhost:5000", 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development" 24 | } 25 | }, 26 | "newProfile1": { 27 | "commandName": "IISExpress", 28 | "launchBrowser": true 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Home Page"; 3 | } 4 | 5 |

Home

6 | @if (User.Identity.IsAuthenticated) 7 | { 8 |

Welcome back @User.Identity.Name

9 |

User Claims

10 |
11 | @foreach (var claim in User.Claims) 12 | { 13 |
@claim.Type
14 |
@claim.Value
15 | } 16 |
17 | 18 | @*var authScheme = "Identity.Application"; 19 | if (!String.IsNullOrWhiteSpace(authScheme)) 20 | { 21 |

Cookies Properties

22 |
23 | @{ 24 | var props = (await Context.Authentication.GetAuthenticateInfoAsync(authScheme)).Properties; 25 | } 26 | @foreach (var item in props.Items) 27 | { 28 |
@item.Key
29 |
@item.Value
30 | } 31 |
32 | }*@ 33 | } 34 | -------------------------------------------------------------------------------- /ClientTwo/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | }, 10 | "ClientAppSettings": { 11 | "stsServer": "https://localhost:44318", 12 | "redirect_url": "https://localhost:44395", 13 | "client_id": "angularclient", 14 | "response_type": "id_token token", 15 | "scope": "openid profile email", 16 | "post_logout_redirect_uri": "https://localhost:44395", 17 | "start_checksession": false, 18 | "silent_renew": false, 19 | "startup_route": "/test", 20 | "forbidden_route": "/unauthorized", 21 | "unauthorized_route": "/unauthorized", 22 | "log_console_warning_active": true, 23 | "log_console_debug_active": true, 24 | "max_id_token_iat_offset_allowed_in_seconds": 10, 25 | "apiServer": "https://localhost:44390/" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model IdentityServer4.Quickstart.UI.Models.ErrorViewModel 2 | 3 | @{ 4 | var error = Model?.Error?.Error; 5 | var request_id = Model?.Error?.RequestId; 6 | } 7 | 8 |
9 | 12 | 13 |
14 |
15 |
16 | Sorry, there was an error 17 | 18 | @if (error != null) 19 | { 20 | 21 | 22 | : @error 23 | 24 | 25 | } 26 |
27 | 28 | @if (request_id != null) 29 | { 30 |
Request Id: @request_id
31 | } 32 |
33 |
34 |
35 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Services/MessageServices.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace IdentityServerWithAspNetIdentity.Services 7 | { 8 | // This class is used by the application to send Email and SMS 9 | // when you turn on two-factor authentication in ASP.NET Identity. 10 | // For more details see this link http://go.microsoft.com/fwlink/?LinkID=532713 11 | public class AuthMessageSender : IEmailSender, ISmsSender 12 | { 13 | public Task SendEmailAsync(string email, string subject, string message) 14 | { 15 | // Plug in your email service here to send an email. 16 | return Task.FromResult(0); 17 | } 18 | 19 | public Task SendSmsAsync(string number, string message) 20 | { 21 | // Plug in your SMS service here to send a text message. 22 | return Task.FromResult(0); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 14 | 15 | -------------------------------------------------------------------------------- /ClientTwo/ViewModel/ClientAppSettings.cs: -------------------------------------------------------------------------------- 1 | namespace SecurityAspNetCoreSignalR.ViewModel 2 | { 3 | public class ClientAppSettings 4 | { 5 | public string stsServer { get; set; } 6 | public string redirect_url { get; set; } 7 | public string client_id { get; set; } 8 | public string response_type { get; set; } 9 | public string scope { get; set; } 10 | public string post_logout_redirect_uri { get; set; } 11 | public bool start_checksession { get; set; } 12 | public bool silent_renew { get; set; } 13 | public string startup_route { get; set; } 14 | public string forbidden_route { get; set; } 15 | public string unauthorized_route { get; set; } 16 | public bool log_console_warning_active { get; set; } 17 | public bool log_console_debug_active { get; set; } 18 | public string max_id_token_iat_offset_allowed_in_seconds { get; set; } 19 | public string apiServer { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/AccountViewModels/ResetPasswordViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace IdentityServerWithAspNetIdentity.Models.AccountViewModels 8 | { 9 | public class ResetPasswordViewModel 10 | { 11 | [Required] 12 | [EmailAddress] 13 | public string Email { get; set; } 14 | 15 | [Required] 16 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] 17 | [DataType(DataType.Password)] 18 | public string Password { get; set; } 19 | 20 | [DataType(DataType.Password)] 21 | [Display(Name = "Confirm password")] 22 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] 23 | public string ConfirmPassword { get; set; } 24 | 25 | public string Code { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Data/ApplicationDbContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore; 6 | using Microsoft.EntityFrameworkCore; 7 | using IdentityServerWithAspNetIdentity.Models; 8 | 9 | namespace IdentityServerWithAspNetIdentity.Data 10 | { 11 | public class ApplicationDbContext : IdentityDbContext 12 | { 13 | public ApplicationDbContext(DbContextOptions options) 14 | : base(options) 15 | { 16 | } 17 | 18 | protected override void OnModelCreating(ModelBuilder builder) 19 | { 20 | base.OnModelCreating(builder); 21 | // Customize the ASP.NET Identity model and override the defaults if needed. 22 | // For example, you can rename the ASP.NET Identity table names and more. 23 | // Add your customizations after calling base.OnModelCreating(builder); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Themes/ClientTwo/Account/LoggedOut.cshtml: -------------------------------------------------------------------------------- 1 | @model IdentityServer4.Quickstart.UI.Models.LoggedOutViewModel 2 | @inject IdentityServerWithIdentitySQLite.ClientSelector _clientSelector 3 | 4 |



5 | 6 |
7 |
8 |

9 | Logout 10 | You are now logged out 11 |

12 |
13 |
14 | 15 | @if (Model.PostLogoutRedirectUri != null) 16 | { 17 |
18 | Click here to return to the 19 | @Model.ClientName application. 20 |
21 | } 22 | @if (Model.SignOutIframeUrl != null) 23 | { 24 | 25 | } 26 |
27 |
28 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4.Persistence/ConfigurationStore/ClientStore.cs: -------------------------------------------------------------------------------- 1 | using IdentityServer4.Models; 2 | using IdentityServer4.Stores; 3 | using Microsoft.Extensions.Logging; 4 | using System; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | 8 | namespace AspNetCoreIdentityServer4Persistence.ConfigurationStore 9 | { 10 | public class ClientStore : IClientStore 11 | { 12 | private readonly ConfigurationStoreContext _context; 13 | private readonly ILogger _logger; 14 | 15 | public ClientStore(ConfigurationStoreContext context, ILoggerFactory loggerFactory) 16 | { 17 | _context = context; 18 | _logger = loggerFactory.CreateLogger("ClientStore"); 19 | } 20 | 21 | public Task FindClientByIdAsync(string clientId) 22 | { 23 | var client = _context.Clients.First(t => t.ClientId == clientId); 24 | client.MapDataFromEntity(); 25 | return Task.FromResult(client.Client); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Manage/AddPhoneNumber.cshtml: -------------------------------------------------------------------------------- 1 | @model AddPhoneNumberViewModel 2 | @{ 3 | ViewData["Title"] = "Add Phone Number"; 4 | } 5 | 6 |

@ViewData["Title"].

7 |
8 |

Add a phone number.

9 |
10 |
11 |
12 | 13 |
14 | 15 | 16 |
17 |
18 |
19 |
20 | 21 |
22 |
23 |
24 | 25 | @section Scripts { 26 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } 27 | } 28 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Themes/ClientTwo/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNetCore.Identity 2 | @using IdentityServerWithAspNetIdentity.Models 3 | @using System.Globalization 4 | @using IdentityServerWithAspNetIdentity.Resources 5 | @inject LocService SharedLocalizer 6 | 7 | @inject SignInManager SignInManager 8 | @inject UserManager UserManager 9 | 10 | @if (SignInManager.IsSignedIn(User)) 11 | { 12 | Hello @UserManager.GetUserName(User)! 13 | 14 | } 15 | else 16 | { 17 | @SharedLocalizer.GetLocalizedHtmlString("register") 18 | @SharedLocalizer.GetLocalizedHtmlString("login") 19 | } 20 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4.Persistence/ConfigurationStore/ClientEntity.cs: -------------------------------------------------------------------------------- 1 | using IdentityServer4.Models; 2 | using Newtonsoft.Json; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.ComponentModel.DataAnnotations.Schema; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace AspNetCoreIdentityServer4Persistence.ConfigurationStore 11 | { 12 | public class ClientEntity 13 | { 14 | public string ClientData { get; set; } 15 | 16 | [Key] 17 | public string ClientId { get; set; } 18 | 19 | [NotMapped] 20 | public Client Client { get; set; } 21 | 22 | public void AddDataToEntity() 23 | { 24 | ClientData = JsonConvert.SerializeObject(Client); 25 | ClientId = Client.ClientId; 26 | } 27 | 28 | public void MapDataFromEntity() 29 | { 30 | Client = JsonConvert.DeserializeObject(ClientData); 31 | ClientId = Client.ClientId; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4.Persistence/ConfigurationStore/ConfigurationStoreContext.cs: -------------------------------------------------------------------------------- 1 | using IdentityServer4.Models; 2 | using Microsoft.EntityFrameworkCore; 3 | 4 | namespace AspNetCoreIdentityServer4Persistence.ConfigurationStore 5 | { 6 | public class ConfigurationStoreContext : DbContext 7 | { 8 | public ConfigurationStoreContext(DbContextOptions options) : base(options) 9 | { } 10 | 11 | public DbSet Clients { get; set; } 12 | public DbSet ApiResources { get; set; } 13 | public DbSet IdentityResources { get; set; } 14 | 15 | 16 | protected override void OnModelCreating(ModelBuilder builder) 17 | { 18 | builder.Entity().HasKey(m => m.ClientId); 19 | builder.Entity().HasKey(m => m.ApiResourceName); 20 | builder.Entity().HasKey(m => m.IdentityResourceName); 21 | base.OnModelCreating(builder); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/lib/jquery-validation/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-validation", 3 | "homepage": "http://jqueryvalidation.org/", 4 | "repository": { 5 | "type": "git", 6 | "url": "git://github.com/jzaefferer/jquery-validation.git" 7 | }, 8 | "authors": [ 9 | "Jörn Zaefferer " 10 | ], 11 | "description": "Form validation made easy", 12 | "main": "dist/jquery.validate.js", 13 | "keywords": [ 14 | "forms", 15 | "validation", 16 | "validate" 17 | ], 18 | "license": "MIT", 19 | "ignore": [ 20 | "**/.*", 21 | "node_modules", 22 | "bower_components", 23 | "test", 24 | "demo", 25 | "lib" 26 | ], 27 | "dependencies": { 28 | "jquery": ">= 1.7.2" 29 | }, 30 | "version": "1.14.0", 31 | "_release": "1.14.0", 32 | "_resolution": { 33 | "type": "version", 34 | "tag": "1.14.0", 35 | "commit": "c1343fb9823392aa9acbe1c3ffd337b8c92fed48" 36 | }, 37 | "_source": "git://github.com/jzaefferer/jquery-validation.git", 38 | "_target": ">=1.8", 39 | "_originalSource": "jquery-validation" 40 | } -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/ManageViewModels/ChangePasswordViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace IdentityServerWithAspNetIdentity.Models.ManageViewModels 8 | { 9 | public class ChangePasswordViewModel 10 | { 11 | [Required] 12 | [DataType(DataType.Password)] 13 | [Display(Name = "Current password")] 14 | public string OldPassword { get; set; } 15 | 16 | [Required] 17 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] 18 | [DataType(DataType.Password)] 19 | [Display(Name = "New password")] 20 | public string NewPassword { get; set; } 21 | 22 | [DataType(DataType.Password)] 23 | [Display(Name = "Confirm new password")] 24 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] 25 | public string ConfirmPassword { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Models/AccountViewModels/RegisterViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace IdentityServerWithAspNetIdentity.Models.AccountViewModels 8 | { 9 | public class RegisterViewModel 10 | { 11 | [Required] 12 | [EmailAddress] 13 | [Display(Name = "Email")] 14 | public string Email { get; set; } 15 | 16 | [Required] 17 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] 18 | [DataType(DataType.Password)] 19 | [Display(Name = "Password")] 20 | public string Password { get; set; } 21 | 22 | [DataType(DataType.Password)] 23 | [Display(Name = "Confirm password")] 24 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] 25 | public string ConfirmPassword { get; set; } 26 | 27 | [Display(Name = "IsAdmin")] 28 | public bool IsAdmin { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/lib/bootstrap/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bootstrap", 3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", 4 | "keywords": [ 5 | "css", 6 | "js", 7 | "less", 8 | "mobile-first", 9 | "responsive", 10 | "front-end", 11 | "framework", 12 | "web" 13 | ], 14 | "homepage": "http://getbootstrap.com", 15 | "license": "MIT", 16 | "moduleType": "globals", 17 | "main": [ 18 | "less/bootstrap.less", 19 | "dist/js/bootstrap.js" 20 | ], 21 | "ignore": [ 22 | "/.*", 23 | "_config.yml", 24 | "CNAME", 25 | "composer.json", 26 | "CONTRIBUTING.md", 27 | "docs", 28 | "js/tests", 29 | "test-infra" 30 | ], 31 | "dependencies": { 32 | "jquery": "1.9.1 - 2" 33 | }, 34 | "version": "3.3.6", 35 | "_release": "3.3.6", 36 | "_resolution": { 37 | "type": "version", 38 | "tag": "v3.3.6", 39 | "commit": "81df608a40bf0629a1dc08e584849bb1e43e0b7a" 40 | }, 41 | "_source": "git://github.com/twbs/bootstrap.git", 42 | "_target": "3.3.6", 43 | "_originalSource": "bootstrap" 44 | } -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Consent/_ScopeListItem.cshtml: -------------------------------------------------------------------------------- 1 | @model IdentityServer4.Quickstart.UI.Models.ScopeViewModel 2 | 3 |
  • 4 | 24 | @if (Model.Required) 25 | { 26 | (required) 27 | } 28 | @if (Model.Description != null) 29 | { 30 | 33 | } 34 |
  • -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4.Persistence/ConfigurationStore/ApiResourceEntity.cs: -------------------------------------------------------------------------------- 1 | using IdentityServer4.Models; 2 | using Newtonsoft.Json; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.ComponentModel.DataAnnotations.Schema; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace AspNetCoreIdentityServer4Persistence.ConfigurationStore 11 | { 12 | public class ApiResourceEntity 13 | { 14 | public string ApiResourceData { get; set; } 15 | 16 | [Key] 17 | public string ApiResourceName { get; set; } 18 | 19 | [NotMapped] 20 | public ApiResource ApiResource { get; set; } 21 | 22 | public void AddDataToEntity() 23 | { 24 | ApiResourceData = JsonConvert.SerializeObject(ApiResource); 25 | ApiResourceName = ApiResource.Name; 26 | } 27 | 28 | public void MapDataFromEntity() 29 | { 30 | ApiResource = JsonConvert.DeserializeObject(ApiResourceData); 31 | ApiResourceName = ApiResource.Name; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Manage/VerifyPhoneNumber.cshtml: -------------------------------------------------------------------------------- 1 | @model VerifyPhoneNumberViewModel 2 | @{ 3 | ViewData["Title"] = "Verify Phone Number"; 4 | } 5 | 6 |

    @ViewData["Title"].

    7 | 8 |
    9 | 10 |

    Add a phone number.

    11 |
    @ViewData["Status"]
    12 |
    13 |
    14 |
    15 | 16 |
    17 | 18 | 19 |
    20 |
    21 |
    22 |
    23 | 24 |
    25 |
    26 |
    27 | 28 | @section Scripts { 29 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } 30 | } 31 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/lib/bootstrap/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2011-2015 Twitter, Inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Account/ForgotPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model ForgotPasswordViewModel 2 | @{ 3 | ViewData["Title"] = "Forgot your password?"; 4 | } 5 | 6 |

    @ViewData["Title"]

    7 |

    8 | For more information on how to enable reset password please see this article. 9 |

    10 | 11 | @*
    12 |

    Enter your email.

    13 |
    14 |
    15 |
    16 | 17 |
    18 | 19 | 20 |
    21 |
    22 |
    23 |
    24 | 25 |
    26 |
    27 |
    *@ 28 | 29 | @section Scripts { 30 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } 31 | } 32 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/lib/jquery-validation/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | ===================== 3 | 4 | Copyright Jörn Zaefferer 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4.Persistence/ConfigurationStore/IdentityResourceEntity.cs: -------------------------------------------------------------------------------- 1 | using IdentityServer4.Models; 2 | using Newtonsoft.Json; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.ComponentModel.DataAnnotations.Schema; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace AspNetCoreIdentityServer4Persistence.ConfigurationStore 11 | { 12 | public class IdentityResourceEntity 13 | { 14 | public string IdentityResourceData { get; set; } 15 | 16 | [Key] 17 | public string IdentityResourceName { get; set; } 18 | 19 | [NotMapped] 20 | public IdentityResource IdentityResource { get; set; } 21 | 22 | public void AddDataToEntity() 23 | { 24 | IdentityResourceData = JsonConvert.SerializeObject(IdentityResource); 25 | IdentityResourceName = IdentityResource.Name; 26 | } 27 | 28 | public void MapDataFromEntity() 29 | { 30 | IdentityResource = JsonConvert.DeserializeObject(IdentityResourceData); 31 | IdentityResourceName = IdentityResource.Name; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNetCore.Identity 2 | @using IdentityServerWithAspNetIdentity.Models 3 | @using System.Globalization 4 | @using IdentityServerWithAspNetIdentity.Resources 5 | @inject LocService SharedLocalizer 6 | 7 | @inject SignInManager SignInManager 8 | @inject UserManager UserManager 9 | 10 | @if (SignInManager.IsSignedIn(User)) 11 | { 12 | 22 | } 23 | else 24 | { 25 | 29 | } 30 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Themes/ClientOne/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNetCore.Identity 2 | @using IdentityServerWithAspNetIdentity.Models 3 | @using System.Globalization 4 | @using IdentityServerWithAspNetIdentity.Resources 5 | @inject LocService SharedLocalizer 6 | 7 | @inject SignInManager SignInManager 8 | @inject UserManager UserManager 9 | 10 | @if (SignInManager.IsSignedIn(User)) 11 | { 12 | 22 | } 23 | else 24 | { 25 | 29 | } 30 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/auth/services/oidc-data.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient, HttpHeaders } from '@angular/common/http'; 3 | import { Observable } from 'rxjs/Observable'; 4 | 5 | @Injectable() 6 | export class OidcDataService { 7 | constructor(private httpClient: HttpClient) {} 8 | 9 | getWellknownEndpoints(url: string): Observable { 10 | let headers = new HttpHeaders(); 11 | headers = headers.set('Accept', 'application/json'); 12 | 13 | return this.httpClient.get(url, { 14 | headers: headers 15 | }); 16 | } 17 | 18 | getIdentityUserData(url: string, token: string): Observable { 19 | let headers = new HttpHeaders(); 20 | headers = headers.set('Accept', 'application/json'); 21 | headers = headers.set( 22 | 'Authorization', 23 | 'Bearer ' + decodeURIComponent(token) 24 | ); 25 | 26 | return this.httpClient.get(url, { 27 | headers: headers 28 | }); 29 | } 30 | 31 | get(url: string): Observable { 32 | let headers = new HttpHeaders(); 33 | headers = headers.set('Accept', 'application/json'); 34 | 35 | return this.httpClient.get(url, { 36 | headers: headers 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/lib/jquery-validation-unobtrusive/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-validation-unobtrusive", 3 | "version": "3.2.6", 4 | "homepage": "https://github.com/aspnet/jquery-validation-unobtrusive", 5 | "description": "Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.", 6 | "main": [ 7 | "jquery.validate.unobtrusive.js" 8 | ], 9 | "ignore": [ 10 | "**/.*", 11 | "*.json", 12 | "*.md", 13 | "*.txt", 14 | "gulpfile.js" 15 | ], 16 | "keywords": [ 17 | "jquery", 18 | "asp.net", 19 | "mvc", 20 | "validation", 21 | "unobtrusive" 22 | ], 23 | "authors": [ 24 | "Microsoft" 25 | ], 26 | "license": "http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm", 27 | "repository": { 28 | "type": "git", 29 | "url": "git://github.com/aspnet/jquery-validation-unobtrusive.git" 30 | }, 31 | "dependencies": { 32 | "jquery-validation": ">=1.8", 33 | "jquery": ">=1.8" 34 | }, 35 | "_release": "3.2.6", 36 | "_resolution": { 37 | "type": "version", 38 | "tag": "v3.2.6", 39 | "commit": "13386cd1b5947d8a5d23a12b531ce3960be1eba7" 40 | }, 41 | "_source": "git://github.com/aspnet/jquery-validation-unobtrusive.git", 42 | "_target": "3.2.6", 43 | "_originalSource": "jquery-validation-unobtrusive" 44 | } -------------------------------------------------------------------------------- /ClientTwo/angularApp/styles/app.scss: -------------------------------------------------------------------------------- 1 | @import '../../node_modules/@angular/material/theming'; 2 | @import '../../node_modules/@angular/material/prebuilt-themes/deeppurple-amber'; 3 | 4 | a { 5 | color: #03A9F4; 6 | } 7 | 8 | body { 9 | margin: 0; 10 | padding: 0; 11 | } 12 | 13 | .content { 14 | max-width: 100%; 15 | margin: 16px; 16 | padding: 0; 17 | background-color: white; 18 | width: 100%; 19 | } 20 | 21 | .full-width { 22 | width: 100%; 23 | min-height: calc(100vh - 144px); 24 | display: flex; 25 | } 26 | 27 | .row-container { 28 | display: flex; 29 | flex-direction: row; 30 | width: 100%; 31 | } 32 | 33 | .column-container { 34 | display: flex; 35 | flex-direction: column; 36 | } 37 | 38 | .content-container { 39 | flex: 1 1 auto; 40 | } 41 | 42 | .left-navigation-container { 43 | box-shadow: 0 0 14.4px 0.6px rgba(0, 0, 0, 0.2); 44 | background-color: white; 45 | width: 275px; 46 | } 47 | 48 | .info-bar { 49 | width: 100%; 50 | height: 40px; 51 | background-color: lightgrey; 52 | box-shadow: 0px 1px 3px 0 rgba(0, 0, 0, 0.35); 53 | align-items: center; 54 | 55 | h5 { 56 | padding-right: 0.5em; 57 | 58 | &:first-child { 59 | padding-left: 1em; 60 | } 61 | } 62 | } 63 | 64 | .mat-chip { 65 | width: 95%; 66 | } -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4.Persistence/AspNetCoreIdentityServer4.Persistence.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp2.0 6 | AspNetCoreIdentityServer4.Persistence 7 | AspNetCoreIdentityServer4.Persistence 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Account/ExternalLoginConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @model ExternalLoginConfirmationViewModel 2 | @{ 3 | ViewData["Title"] = "Register"; 4 | } 5 | 6 |

    @ViewData["Title"].

    7 |

    Associate your @ViewData["LoginProvider"] account.

    8 | 9 |
    10 |

    Association Form

    11 |
    12 |
    13 | 14 |

    15 | You've successfully authenticated with @ViewData["LoginProvider"]. 16 | Please enter an email address for this site below and click the Register button to finish 17 | logging in. 18 |

    19 |
    20 | 21 |
    22 | 23 | 24 |
    25 |
    26 |
    27 |
    28 | 29 |
    30 |
    31 |
    32 | 33 | @section Scripts { 34 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } 35 | } 36 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Account/VerifyCode.cshtml: -------------------------------------------------------------------------------- 1 | @model VerifyCodeViewModel 2 | @{ 3 | ViewData["Title"] = "Verify"; 4 | } 5 | 6 |

    @ViewData["Title"].

    7 | 8 |
    9 |
    10 | 11 | 12 |

    @ViewData["Status"]

    13 |
    14 |
    15 | 16 |
    17 | 18 | 19 |
    20 |
    21 |
    22 |
    23 |
    24 | 25 | 26 |
    27 |
    28 |
    29 |
    30 |
    31 | 32 |
    33 |
    34 |
    35 | 36 | @section Scripts { 37 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } 38 | } 39 | -------------------------------------------------------------------------------- /ClientTwo/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": ".NET Core Launch (web)", 6 | "type": "coreclr", 7 | "request": "launch", 8 | "preLaunchTask": "build", 9 | "program": "${workspaceRoot}\\bin\\Debug\\netcoreapp1.1\\Angular2WebpackVisualStudio.dll", 10 | "args": [], 11 | "cwd": "${workspaceRoot}", 12 | "stopAtEntry": false, 13 | "internalConsoleOptions": "openOnSessionStart", 14 | "launchBrowser": { 15 | "enabled": true, 16 | "args": "${auto-detect-url}", 17 | "windows": { 18 | "command": "cmd.exe", 19 | "args": "/C start ${auto-detect-url}" 20 | }, 21 | "osx": { 22 | "command": "open" 23 | }, 24 | "linux": { 25 | "command": "xdg-open" 26 | } 27 | }, 28 | "env": { 29 | "ASPNETCORE_ENVIRONMENT": "Development" 30 | }, 31 | "sourceFileMap": { 32 | "/Views": "${workspaceRoot}/Views" 33 | } 34 | }, 35 | { 36 | "name": ".NET Core Attach", 37 | "type": "coreclr", 38 | "request": "attach", 39 | "processId": "${command.pickProcess}" 40 | } 41 | ] 42 | } -------------------------------------------------------------------------------- /ClientOne/angularApp/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, OnDestroy } from '@angular/core'; 2 | import { Subscription } from 'rxjs/Subscription'; 3 | import { OidcSecurityService } from './auth/services/oidc.security.service'; 4 | 5 | import './app.component.css'; 6 | 7 | @Component({ 8 | selector: 'app-component', 9 | templateUrl: 'app.component.html' 10 | }) 11 | 12 | export class AppComponent implements OnInit, OnDestroy { 13 | 14 | isAuthorizedSubscription: Subscription; 15 | isAuthorized: boolean; 16 | 17 | constructor(public securityService: OidcSecurityService) { 18 | } 19 | 20 | ngOnInit() { 21 | this.isAuthorizedSubscription = this.securityService.getIsAuthorized().subscribe( 22 | (isAuthorized: boolean) => { 23 | this.isAuthorized = isAuthorized; 24 | }); 25 | 26 | if (window.location.hash) { 27 | this.securityService.authorizedCallback(); 28 | } 29 | } 30 | 31 | ngOnDestroy(): void { 32 | this.isAuthorizedSubscription.unsubscribe(); 33 | } 34 | 35 | login() { 36 | console.log('start login'); 37 | this.securityService.authorize(); 38 | } 39 | 40 | refreshSession() { 41 | console.log('start refreshSession'); 42 | this.securityService.authorize(); 43 | } 44 | 45 | logout() { 46 | console.log('start logoff'); 47 | this.securityService.logoff(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/auth/services/oidc.security.user-service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Observable } from 'rxjs/Observable'; 3 | import { map } from 'rxjs/operators'; 4 | import { OidcSecurityCommon } from './oidc.security.common'; 5 | import { AuthWellKnownEndpoints } from './auth.well-known-endpoints'; 6 | import { OidcDataService } from './oidc-data.service'; 7 | 8 | @Injectable() 9 | export class OidcSecurityUserService { 10 | private userData: any = ''; 11 | 12 | constructor( 13 | private oidcDataService: OidcDataService, 14 | private oidcSecurityCommon: OidcSecurityCommon, 15 | private authWellKnownEndpoints: AuthWellKnownEndpoints 16 | ) { } 17 | 18 | initUserData() { 19 | return this.getIdentityUserData().pipe( 20 | map((data: any) => (this.userData = data)) 21 | ); 22 | } 23 | 24 | getUserData(): any { 25 | if (!this.userData) { 26 | throw Error('UserData is not set!'); 27 | } 28 | 29 | return this.userData; 30 | } 31 | 32 | setUserData(value: any): void { 33 | this.userData = value; 34 | } 35 | 36 | private getIdentityUserData(): Observable { 37 | const token = this.oidcSecurityCommon.getAccessToken(); 38 | 39 | return this.oidcDataService.getIdentityUserData( 40 | this.authWellKnownEndpoints.userinfo_endpoint, 41 | token 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/auth/services/oidc.security.storage.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { AuthConfiguration } from '../modules/auth.configuration'; 3 | 4 | /** 5 | * Implement this class-interface to create a custom storage. 6 | */ 7 | @Injectable() 8 | export abstract class OidcSecurityStorage { 9 | /** 10 | * This method must contain the logic to read the storage. 11 | * @param key 12 | * @return The value of the given key 13 | */ 14 | public abstract read(key: string): any; 15 | 16 | /** 17 | * This method must contain the logic to write the storage. 18 | * @param key 19 | * @param value The value for the given key 20 | */ 21 | public abstract write(key: string, value: any): void; 22 | } 23 | 24 | @Injectable() 25 | export class BrowserStorage implements OidcSecurityStorage { 26 | private hasStorage: boolean; 27 | 28 | constructor(private authConfiguration: AuthConfiguration) { 29 | this.hasStorage = typeof Storage !== 'undefined'; 30 | } 31 | 32 | public read(key: string): any { 33 | if (this.hasStorage) { 34 | return JSON.parse(this.authConfiguration.storage.getItem(key)); 35 | } 36 | 37 | return; 38 | } 39 | 40 | public write(key: string, value: any): void { 41 | if (this.hasStorage) { 42 | value = value === undefined ? null : value; 43 | this.authConfiguration.storage.setItem(key, JSON.stringify(value)); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4.Persistence/ConfigurationStore/ConfigurationStoreContextFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Design; 5 | using Microsoft.Extensions.Configuration; 6 | 7 | namespace AspNetCoreIdentityServer4Persistence.ConfigurationStore 8 | { 9 | public class ConfigurationStoreContextFactory : IDesignTimeDbContextFactory 10 | { 11 | public ConfigurationStoreContext CreateDbContext(string[] args) 12 | { 13 | var deploymentType = 14 | Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", EnvironmentVariableTarget.Machine); 15 | 16 | var currentDirectory = Directory.GetCurrentDirectory(); 17 | 18 | var configuration = new ConfigurationBuilder() 19 | .AddJsonFile($"{currentDirectory}\\appsettings.json") 20 | .AddJsonFile($"{currentDirectory}\\appsettings.{deploymentType}.json", optional: true) 21 | .Build(); 22 | 23 | var configurationStoreConnection = configuration.GetConnectionString("ConfigurationStoreConnection"); 24 | var optionsBuilder = new DbContextOptionsBuilder(); 25 | optionsBuilder.UseSqlite( 26 | configurationStoreConnection, 27 | b => b.MigrationsAssembly("AspNetCoreIdentityServer4")); 28 | 29 | return new ConfigurationStoreContext(optionsBuilder.Options); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /ClientOne/config/webpack.test.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = { 4 | 5 | devtool: 'inline-source-map', 6 | 7 | performance: { 8 | hints: false 9 | }, 10 | 11 | resolve: { 12 | extensions: ['.ts', '.js'] 13 | }, 14 | 15 | module: { 16 | rules: [ 17 | { 18 | test: /\.ts$/, 19 | use: [ 20 | 'awesome-typescript-loader', 21 | 'angular2-template-loader', 22 | 'source-map-loader' 23 | ] 24 | }, 25 | { 26 | test: /\.css$/, 27 | use: [ 28 | 'style-loader', 29 | 'css-loader' 30 | ] 31 | }, 32 | { 33 | test: /\.scss$/, 34 | include: path.join(__dirname, 'angularApp/styles'), 35 | use: [ 36 | 'style-loader', 37 | 'css-loader', 38 | 'sass-loader' 39 | ] 40 | }, 41 | { 42 | test: /\.scss$/, 43 | exclude: path.join(__dirname, 'angularApp/styles'), 44 | use: [ 45 | 'raw-loader', 46 | 'sass-loader' 47 | ] 48 | }, 49 | { 50 | test: /\.html$/, 51 | use: 'raw-loader' 52 | } 53 | ], 54 | exprContextCritical: false 55 | } 56 | 57 | }; 58 | -------------------------------------------------------------------------------- /ClientTwo/config/webpack.test.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = { 4 | 5 | devtool: 'inline-source-map', 6 | 7 | performance: { 8 | hints: false 9 | }, 10 | 11 | resolve: { 12 | extensions: ['.ts', '.js'] 13 | }, 14 | 15 | module: { 16 | rules: [ 17 | { 18 | test: /\.ts$/, 19 | use: [ 20 | 'awesome-typescript-loader', 21 | 'angular2-template-loader', 22 | 'source-map-loader' 23 | ] 24 | }, 25 | { 26 | test: /\.css$/, 27 | use: [ 28 | 'style-loader', 29 | 'css-loader' 30 | ] 31 | }, 32 | { 33 | test: /\.scss$/, 34 | include: path.join(__dirname, 'angularApp/styles'), 35 | use: [ 36 | 'style-loader', 37 | 'css-loader', 38 | 'sass-loader' 39 | ] 40 | }, 41 | { 42 | test: /\.scss$/, 43 | exclude: path.join(__dirname, 'angularApp/styles'), 44 | use: [ 45 | 'raw-loader', 46 | 'sass-loader' 47 | ] 48 | }, 49 | { 50 | test: /\.html$/, 51 | use: 'raw-loader' 52 | } 53 | ], 54 | exprContextCritical: false 55 | } 56 | 57 | }; 58 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Manage/SetPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model SetPasswordViewModel 2 | @{ 3 | ViewData["Title"] = "Set Password"; 4 | } 5 | 6 |

    7 | You do not have a local username/password for this site. Add a local 8 | account so you can log in without an external login. 9 |

    10 | 11 |
    12 |

    Set your password

    13 |
    14 |
    15 |
    16 | 17 |
    18 | 19 | 20 |
    21 |
    22 |
    23 | 24 |
    25 | 26 | 27 |
    28 |
    29 |
    30 |
    31 | 32 |
    33 |
    34 |
    35 | 36 | @section Scripts { 37 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } 38 | } 39 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/app.component.html: -------------------------------------------------------------------------------- 1 |
    2 | 3 | 25 | 26 | 27 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/ClientIdFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Extensions.Primitives; 3 | using Microsoft.AspNetCore.WebUtilities; 4 | using System.Linq; 5 | using Microsoft.AspNetCore.Mvc.Filters; 6 | 7 | namespace IdentityServerWithIdentitySQLite 8 | { 9 | public class ClientIdFilter : IActionFilter 10 | { 11 | public ClientIdFilter(ClientSelector clientSelector) 12 | { 13 | _clientSelector = clientSelector; 14 | } 15 | 16 | public string Client_id = "none"; 17 | private readonly ClientSelector _clientSelector; 18 | 19 | public void OnActionExecuted(ActionExecutedContext context) 20 | { 21 | var query = context.HttpContext.Request.Query; 22 | var exists = query.TryGetValue("client_id", out StringValues culture); 23 | 24 | if (!exists) 25 | { 26 | exists = query.TryGetValue("returnUrl", out StringValues requesturl); 27 | 28 | if (exists) 29 | { 30 | var request = requesturl.ToArray()[0]; 31 | Uri uri = new Uri("http://faketopreventexception" + request); 32 | var query1 = QueryHelpers.ParseQuery(uri.Query); 33 | var client_id = query1.FirstOrDefault(t => t.Key == "client_id").Value; 34 | 35 | _clientSelector.SelectedClient = client_id.ToString(); 36 | } 37 | } 38 | } 39 | 40 | public void OnActionExecuting(ActionExecutingContext context) 41 | { 42 | 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Mvc; 6 | using IdentityServer4.Services; 7 | using IdentityServer4.Quickstart.UI.Models; 8 | 9 | namespace IdentityServerWithAspNetIdentity.Controllers 10 | { 11 | public class HomeController : Controller 12 | { 13 | private readonly IIdentityServerInteractionService _interaction; 14 | 15 | public HomeController(IIdentityServerInteractionService interaction) 16 | { 17 | _interaction = interaction; 18 | } 19 | 20 | public IActionResult Index() 21 | { 22 | return View(); 23 | } 24 | 25 | public IActionResult About() 26 | { 27 | ViewData["Message"] = "Your application description page."; 28 | 29 | return View(); 30 | } 31 | 32 | public IActionResult Contact() 33 | { 34 | ViewData["Message"] = "Your contact page."; 35 | 36 | return View(); 37 | } 38 | 39 | /// 40 | /// Shows the error page 41 | /// 42 | public async Task Error(string errorId) 43 | { 44 | var vm = new ErrorViewModel(); 45 | 46 | // retrieve error details from identityserver 47 | var message = await _interaction.GetErrorContextAsync(errorId); 48 | if (message != null) 49 | { 50 | vm.Error = message; 51 | } 52 | 53 | return View("Error", vm); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { OidcSecurityService } from '../auth/services/oidc.security.service'; 2 | import { Component, OnInit, OnDestroy } from '@angular/core'; 3 | import { Subscription } from 'rxjs/Subscription'; 4 | 5 | @Component({ 6 | selector: 'app-home', 7 | templateUrl: 'home.component.html' 8 | }) 9 | 10 | export class HomeComponent implements OnInit, OnDestroy { 11 | 12 | message: string; 13 | name = 'none'; 14 | email = 'none'; 15 | userDataSubscription: Subscription; 16 | userData: boolean; 17 | isAuthorizedSubscription: Subscription; 18 | isAuthorized: boolean; 19 | 20 | constructor(public oidcSecurityService: OidcSecurityService) { 21 | this.message = 'HomeComponent constructor'; 22 | } 23 | 24 | ngOnInit() { 25 | this.isAuthorizedSubscription = this.oidcSecurityService.getIsAuthorized().subscribe( 26 | (isAuthorized: boolean) => { 27 | this.isAuthorized = isAuthorized; 28 | }); 29 | 30 | this.userDataSubscription = this.oidcSecurityService.getUserData().subscribe( 31 | (userData: any) => { 32 | 33 | if (userData !== '') { 34 | this.name = userData.name; 35 | this.email = userData.email; 36 | console.log(userData); 37 | } 38 | 39 | console.log('userData getting data'); 40 | }); 41 | } 42 | 43 | ngOnDestroy(): void { 44 | this.userDataSubscription.unsubscribe(); 45 | this.isAuthorizedSubscription.unsubscribe(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Manage/ChangePassword.cshtml: -------------------------------------------------------------------------------- 1 | @model ChangePasswordViewModel 2 | @{ 3 | ViewData["Title"] = "Change Password"; 4 | } 5 | 6 |

    @ViewData["Title"].

    7 | 8 |
    9 |

    Change Password Form

    10 |
    11 |
    12 |
    13 | 14 |
    15 | 16 | 17 |
    18 |
    19 |
    20 | 21 |
    22 | 23 | 24 |
    25 |
    26 |
    27 | 28 |
    29 | 30 | 31 |
    32 |
    33 |
    34 |
    35 | 36 |
    37 |
    38 |
    39 | 40 | @section Scripts { 41 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } 42 | } 43 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Account/ResetPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model ResetPasswordViewModel 2 | @{ 3 | ViewData["Title"] = "Reset password"; 4 | } 5 | 6 |

    @ViewData["Title"].

    7 | 8 |
    9 |

    Reset your password.

    10 |
    11 |
    12 | 13 |
    14 | 15 |
    16 | 17 | 18 |
    19 |
    20 |
    21 | 22 |
    23 | 24 | 25 |
    26 |
    27 |
    28 | 29 |
    30 | 31 | 32 |
    33 |
    34 |
    35 |
    36 | 37 |
    38 |
    39 |
    40 | 41 | @section Scripts { 42 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } 43 | } 44 | -------------------------------------------------------------------------------- /SeedingConsoleApp/Program.cs: -------------------------------------------------------------------------------- 1 | using AspNetCoreIdentityServer4Persistence.ConfigurationStore; 2 | using IdentityServer4.Models; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.Extensions.Configuration; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.IO; 8 | 9 | namespace SeedingConsoleApp 10 | { 11 | class Program 12 | { 13 | static void Main(string[] args) 14 | { 15 | try 16 | { 17 | var currentDirectory = Directory.GetCurrentDirectory(); 18 | 19 | var configuration = new ConfigurationBuilder() 20 | .AddJsonFile($"{currentDirectory}\\..\\AspNetCoreIdentityServer4\\appsettings.json") 21 | .Build(); 22 | 23 | var configurationStoreConnection = configuration.GetConnectionString("ConfigurationStoreConnection"); 24 | 25 | var optionsBuilder = new DbContextOptionsBuilder(); 26 | optionsBuilder.UseSqlite(configurationStoreConnection); 27 | 28 | using (var configurationStoreContext = new ConfigurationStoreContext(optionsBuilder.Options)) 29 | { 30 | configurationStoreContext.AddRange(Config.GetClients()); 31 | configurationStoreContext.AddRange(Config.GetIdentityResources()); 32 | configurationStoreContext.AddRange(Config.GetApiResources()); 33 | configurationStoreContext.SaveChanges(); 34 | } 35 | } 36 | catch (Exception e) 37 | { 38 | Console.WriteLine(e.Message); 39 | } 40 | 41 | Console.ReadLine(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/lib/jquery/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright jQuery Foundation and other contributors, https://jquery.org/ 2 | 3 | This software consists of voluntary contributions made by many 4 | individuals. For exact contribution history, see the revision history 5 | available at https://github.com/jquery/jquery 6 | 7 | The following license applies to all parts of this software except as 8 | documented below: 9 | 10 | ==== 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining 13 | a copy of this software and associated documentation files (the 14 | "Software"), to deal in the Software without restriction, including 15 | without limitation the rights to use, copy, modify, merge, publish, 16 | distribute, sublicense, and/or sell copies of the Software, and to 17 | permit persons to whom the Software is furnished to do so, subject to 18 | the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be 21 | included in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | ==== 32 | 33 | All files located in the node_modules and external directories are 34 | externally maintained libraries used by this software which have their 35 | own licenses; we recommend you read them, as their terms may differ from 36 | the terms above. 37 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/AspNetCoreIdentityServer4.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netcoreapp2.0 4 | AspNetCoreIdentityServer4 5 | AspNetCoreIdentityServer4 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | PreserveNewest 24 | 25 | 26 | 27 | 28 | 29 | PreserveNewest 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Wrapping element */ 7 | /* Set some basic padding to keep content from hitting the edges */ 8 | .body-content { 9 | padding-left: 15px; 10 | padding-right: 15px; 11 | } 12 | 13 | /* Set widths on the form inputs since otherwise they're 100% wide */ 14 | input, 15 | select, 16 | textarea { 17 | max-width: 280px; 18 | } 19 | 20 | /* Carousel */ 21 | .carousel-caption p { 22 | font-size: 20px; 23 | line-height: 1.4; 24 | } 25 | 26 | /* buttons and links extension to use brackets: [ click me ] */ 27 | .btn-bracketed::before { 28 | display:inline-block; 29 | content: "["; 30 | padding-right: 0.5em; 31 | } 32 | .btn-bracketed::after { 33 | display:inline-block; 34 | content: "]"; 35 | padding-left: 0.5em; 36 | } 37 | 38 | /* Make .svg files in the carousel display properly in older browsers */ 39 | .carousel-inner .item img[src$=".svg"] 40 | { 41 | width: 100%; 42 | } 43 | 44 | /* Hide/rearrange for smaller screens */ 45 | @media screen and (max-width: 767px) { 46 | /* Hide captions */ 47 | .carousel-caption { 48 | display: none 49 | } 50 | } 51 | 52 | .page-consent .client-logo { 53 | float: left; 54 | } 55 | .page-consent .client-logo img { 56 | width: 80px; 57 | height: 80px; 58 | } 59 | .page-consent .consent-buttons { 60 | margin-top: 25px; 61 | } 62 | .page-consent .consent-form .consent-scopecheck { 63 | display: inline-block; 64 | margin-right: 5px; 65 | } 66 | .page-consent .consent-form .consent-description { 67 | margin-left: 25px; 68 | } 69 | .page-consent .consent-form .consent-description label { 70 | font-weight: normal; 71 | } 72 | .page-consent .consent-form .consent-remember { 73 | padding-left: 16px; 74 | } 75 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Filters/SecurityHeadersAttribute.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 Microsoft.AspNetCore.Mvc; 6 | using Microsoft.AspNetCore.Mvc.Filters; 7 | 8 | namespace IdentityServerWithAspNetIdentity.Filters 9 | { 10 | public class SecurityHeadersAttribute : ActionFilterAttribute 11 | { 12 | public override void OnResultExecuting(ResultExecutingContext context) 13 | { 14 | var result = context.Result; 15 | if (result is ViewResult) 16 | { 17 | if (!context.HttpContext.Response.Headers.ContainsKey("X-Content-Type-Options")) 18 | { 19 | context.HttpContext.Response.Headers.Add("X-Content-Type-Options", "nosniff"); 20 | } 21 | if (!context.HttpContext.Response.Headers.ContainsKey("X-Frame-Options")) 22 | { 23 | context.HttpContext.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN"); 24 | } 25 | 26 | var csp = "default-src 'self'"; 27 | // once for standards compliant browsers 28 | if (!context.HttpContext.Response.Headers.ContainsKey("Content-Security-Policy")) 29 | { 30 | context.HttpContext.Response.Headers.Add("Content-Security-Policy", csp); 31 | } 32 | // and once again for IE 33 | if (!context.HttpContext.Response.Headers.ContainsKey("X-Content-Security-Policy")) 34 | { 35 | context.HttpContext.Response.Headers.Add("X-Content-Security-Policy", csp); 36 | } 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Account/Register.cshtml: -------------------------------------------------------------------------------- 1 | @model RegisterViewModel 2 | @{ 3 | ViewData["Title"] = "Register"; 4 | } 5 | 6 |

    @ViewData["Title"].

    7 | 8 |
    9 |

    Create a new account.

    10 |
    11 |
    12 |
    13 | 14 |
    15 | 16 | 17 |
    18 |
    19 |
    20 | 21 |
    22 | 23 | 24 |
    25 |
    26 |
    27 | 28 |
    29 | 30 | 31 |
    32 |
    33 |
    34 | 35 |
    36 | 37 |
    38 |
    39 |
    40 |
    41 | 42 |
    43 |
    44 |
    45 | 46 | @section Scripts { 47 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } 48 | } 49 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/LocalizationCookieProvider.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Localization; 2 | using System; 3 | using System.Threading.Tasks; 4 | using Microsoft.AspNetCore.Http; 5 | 6 | namespace IdentityServerWithIdentitySQLite 7 | { 8 | public class LocalizationCookieProvider : RequestCultureProvider 9 | { 10 | public static readonly string DefaultCookieName = ".AspNetCore.Culture"; 11 | 12 | public string CookieName { get; set; } = DefaultCookieName; 13 | 14 | /// 15 | public override Task DetermineProviderCultureResult(HttpContext httpContext) 16 | { 17 | if (httpContext == null) 18 | { 19 | throw new ArgumentNullException(nameof(httpContext)); 20 | } 21 | 22 | var cookie = httpContext.Request.Cookies[CookieName]; 23 | 24 | if (string.IsNullOrEmpty(cookie)) 25 | { 26 | return NullProviderCultureResult; 27 | } 28 | 29 | var providerResultCulture = ParseCookieValue(cookie); 30 | 31 | return Task.FromResult(providerResultCulture); 32 | } 33 | 34 | public static ProviderCultureResult ParseCookieValue(string value) 35 | { 36 | if (string.IsNullOrWhiteSpace(value)) 37 | { 38 | return null; 39 | } 40 | 41 | var cultureName = value; 42 | var uiCultureName = value; 43 | 44 | if (cultureName == null && uiCultureName == null) 45 | { 46 | // No values specified for either so no match 47 | return null; 48 | } 49 | 50 | if (cultureName != null && uiCultureName == null) 51 | { 52 | uiCultureName = cultureName; 53 | } 54 | 55 | if (cultureName == null && uiCultureName != null) 56 | { 57 | cultureName = uiCultureName; 58 | } 59 | 60 | return new ProviderCultureResult(cultureName, uiCultureName); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/ClientViewLocationExpander.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.Razor; 2 | using Microsoft.AspNetCore.WebUtilities; 3 | using Microsoft.Extensions.Primitives; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | 8 | public class ClientViewLocationExpander : IViewLocationExpander 9 | { 10 | private const string THEME_KEY = "theme"; 11 | 12 | public void PopulateValues(ViewLocationExpanderContext context) 13 | { 14 | var query = context.ActionContext.HttpContext.Request.Query; 15 | var exists = query.TryGetValue("client_id", out StringValues culture); 16 | 17 | if (!exists) 18 | { 19 | exists = query.TryGetValue("returnUrl", out StringValues requesturl); 20 | 21 | if (exists) 22 | { 23 | var request = requesturl.ToArray()[0]; 24 | Uri uri = new Uri("http://faketopreventexception" + request); 25 | var query1 = QueryHelpers.ParseQuery(uri.Query); 26 | var client_id = query1.FirstOrDefault(t => t.Key == "client_id").Value; 27 | 28 | context.Values[THEME_KEY] = client_id.ToString(); 29 | } 30 | } 31 | } 32 | 33 | public IEnumerable ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable viewLocations) 34 | { 35 | // add the themes to the view location if one of the theme layouts are required. 36 | if (context.ViewName.Contains("_Layout") 37 | && context.ActionContext.HttpContext.Request.Path.ToString().Contains("logout")) 38 | { 39 | string themeValue = context.ViewName.Replace("_Layout", ""); 40 | context.Values[THEME_KEY] = themeValue; 41 | } 42 | 43 | string theme = null; 44 | if (context.Values.TryGetValue(THEME_KEY, out theme)) 45 | { 46 | viewLocations = new[] { 47 | $"/Themes/{theme}/{{1}}/{{0}}.cshtml", 48 | $"/Themes/{theme}/Shared/{{0}}.cshtml", 49 | } 50 | .Concat(viewLocations); 51 | } 52 | 53 | return viewLocations; 54 | } 55 | } -------------------------------------------------------------------------------- /ClientOne/angularApp/app/auth/services/oidc-token-helper.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable() 4 | export class TokenHelperService { 5 | constructor() {} 6 | 7 | getTokenExpirationDate(dataIdToken: any): Date { 8 | if (!dataIdToken.hasOwnProperty('exp')) { 9 | return new Date(); 10 | } 11 | 12 | const date = new Date(0); // The 0 here is the key, which sets the date to the epoch 13 | date.setUTCSeconds(dataIdToken.exp); 14 | 15 | return date; 16 | } 17 | 18 | getPayloadFromToken(token: any, encode: boolean) { 19 | let data = {}; 20 | if (typeof token !== 'undefined') { 21 | const encoded = token.split('.')[1]; 22 | if (encode) { 23 | return encoded; 24 | } 25 | data = JSON.parse(this.urlBase64Decode(encoded)); 26 | } 27 | 28 | return data; 29 | } 30 | 31 | getHeaderFromToken(token: any, encode: boolean) { 32 | let data = {}; 33 | if (typeof token !== 'undefined') { 34 | const encoded = token.split('.')[0]; 35 | if (encode) { 36 | return encoded; 37 | } 38 | data = JSON.parse(this.urlBase64Decode(encoded)); 39 | } 40 | 41 | return data; 42 | } 43 | 44 | getSignatureFromToken(token: any, encode: boolean) { 45 | let data = {}; 46 | if (typeof token !== 'undefined') { 47 | const encoded = token.split('.')[2]; 48 | if (encode) { 49 | return encoded; 50 | } 51 | data = JSON.parse(this.urlBase64Decode(encoded)); 52 | } 53 | 54 | return data; 55 | } 56 | 57 | urlBase64Decode(str: string) { 58 | let output = str.replace('-', '+').replace('_', '/'); 59 | switch (output.length % 4) { 60 | case 0: 61 | break; 62 | case 2: 63 | output += '=='; 64 | break; 65 | case 3: 66 | output += '='; 67 | break; 68 | default: 69 | throw Error('Illegal base64url string!'); 70 | } 71 | 72 | return window.atob(output); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Migrations/ConfigurationStoreContextModelSnapshot.cs: -------------------------------------------------------------------------------- 1 | // 2 | using AspNetCoreIdentityServer4Persistence.ConfigurationStore; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Metadata; 6 | using Microsoft.EntityFrameworkCore.Migrations; 7 | using Microsoft.EntityFrameworkCore.Storage; 8 | using System; 9 | 10 | namespace AspNetCoreIdentityServer4.Migrations 11 | { 12 | [DbContext(typeof(ConfigurationStoreContext))] 13 | partial class ConfigurationStoreContextModelSnapshot : ModelSnapshot 14 | { 15 | protected override void BuildModel(ModelBuilder modelBuilder) 16 | { 17 | #pragma warning disable 612, 618 18 | modelBuilder 19 | .HasAnnotation("ProductVersion", "2.0.1-rtm-125"); 20 | 21 | modelBuilder.Entity("AspNetCoreIdentityServer4Persistence.ConfigurationStore.ApiResourceEntity", b => 22 | { 23 | b.Property("ApiResourceName") 24 | .ValueGeneratedOnAdd(); 25 | 26 | b.Property("ApiResourceData"); 27 | 28 | b.HasKey("ApiResourceName"); 29 | 30 | b.ToTable("ApiResources"); 31 | }); 32 | 33 | modelBuilder.Entity("AspNetCoreIdentityServer4Persistence.ConfigurationStore.ClientEntity", b => 34 | { 35 | b.Property("ClientId") 36 | .ValueGeneratedOnAdd(); 37 | 38 | b.Property("ClientData"); 39 | 40 | b.HasKey("ClientId"); 41 | 42 | b.ToTable("Clients"); 43 | }); 44 | 45 | modelBuilder.Entity("AspNetCoreIdentityServer4Persistence.ConfigurationStore.IdentityResourceEntity", b => 46 | { 47 | b.Property("IdentityResourceName") 48 | .ValueGeneratedOnAdd(); 49 | 50 | b.Property("IdentityResourceData"); 51 | 52 | b.HasKey("IdentityResourceName"); 53 | 54 | b.ToTable("IdentityResources"); 55 | }); 56 | #pragma warning restore 612, 618 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Migrations/20171224145139_id4configMigration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace AspNetCoreIdentityServer4.Migrations 6 | { 7 | public partial class id4configMigration : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.CreateTable( 12 | name: "ApiResources", 13 | columns: table => new 14 | { 15 | ApiResourceName = table.Column(nullable: false), 16 | ApiResourceData = table.Column(nullable: true) 17 | }, 18 | constraints: table => 19 | { 20 | table.PrimaryKey("PK_ApiResources", x => x.ApiResourceName); 21 | }); 22 | 23 | migrationBuilder.CreateTable( 24 | name: "Clients", 25 | columns: table => new 26 | { 27 | ClientId = table.Column(nullable: false), 28 | ClientData = table.Column(nullable: true) 29 | }, 30 | constraints: table => 31 | { 32 | table.PrimaryKey("PK_Clients", x => x.ClientId); 33 | }); 34 | 35 | migrationBuilder.CreateTable( 36 | name: "IdentityResources", 37 | columns: table => new 38 | { 39 | IdentityResourceName = table.Column(nullable: false), 40 | IdentityResourceData = table.Column(nullable: true) 41 | }, 42 | constraints: table => 43 | { 44 | table.PrimaryKey("PK_IdentityResources", x => x.IdentityResourceName); 45 | }); 46 | } 47 | 48 | protected override void Down(MigrationBuilder migrationBuilder) 49 | { 50 | migrationBuilder.DropTable( 51 | name: "ApiResources"); 52 | 53 | migrationBuilder.DropTable( 54 | name: "Clients"); 55 | 56 | migrationBuilder.DropTable( 57 | name: "IdentityResources"); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Migrations/20171224145139_id4configMigration.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using AspNetCoreIdentityServer4Persistence.ConfigurationStore; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Metadata; 6 | using Microsoft.EntityFrameworkCore.Migrations; 7 | using Microsoft.EntityFrameworkCore.Storage; 8 | using System; 9 | 10 | namespace AspNetCoreIdentityServer4.Migrations 11 | { 12 | [DbContext(typeof(ConfigurationStoreContext))] 13 | [Migration("20171224145139_id4configMigration")] 14 | partial class id4configMigration 15 | { 16 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .HasAnnotation("ProductVersion", "2.0.1-rtm-125"); 21 | 22 | modelBuilder.Entity("AspNetCoreIdentityServer4Persistence.ConfigurationStore.ApiResourceEntity", b => 23 | { 24 | b.Property("ApiResourceName") 25 | .ValueGeneratedOnAdd(); 26 | 27 | b.Property("ApiResourceData"); 28 | 29 | b.HasKey("ApiResourceName"); 30 | 31 | b.ToTable("ApiResources"); 32 | }); 33 | 34 | modelBuilder.Entity("AspNetCoreIdentityServer4Persistence.ConfigurationStore.ClientEntity", b => 35 | { 36 | b.Property("ClientId") 37 | .ValueGeneratedOnAdd(); 38 | 39 | b.Property("ClientData"); 40 | 41 | b.HasKey("ClientId"); 42 | 43 | b.ToTable("Clients"); 44 | }); 45 | 46 | modelBuilder.Entity("AspNetCoreIdentityServer4Persistence.ConfigurationStore.IdentityResourceEntity", b => 47 | { 48 | b.Property("IdentityResourceName") 49 | .ValueGeneratedOnAdd(); 50 | 51 | b.Property("IdentityResourceData"); 52 | 53 | b.HasKey("IdentityResourceName"); 54 | 55 | b.ToTable("IdentityResources"); 56 | }); 57 | #pragma warning restore 612, 618 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Manage/ManageLogins.cshtml: -------------------------------------------------------------------------------- 1 | @model ManageLoginsViewModel 2 | @using Microsoft.AspNetCore.Http.Authentication 3 | @{ 4 | ViewData["Title"] = "Manage your external logins"; 5 | } 6 | 7 |

    @ViewData["Title"].

    8 | 9 |

    @ViewData["StatusMessage"]

    10 | @if (Model.CurrentLogins.Count > 0) 11 | { 12 |

    Registered Logins

    13 | 14 | 15 | @for (var index = 0; index < Model.CurrentLogins.Count; index++) 16 | { 17 | 18 | 19 | 35 | 36 | } 37 | 38 |
    @Model.CurrentLogins[index].LoginProvider 20 | @if ((bool)ViewData["ShowRemoveButton"]) 21 | { 22 |
    23 |
    24 | 25 | 26 | 27 |
    28 |
    29 | } 30 | else 31 | { 32 | @:   33 | } 34 |
    39 | } 40 | @if (Model.OtherLogins.Count > 0) 41 | { 42 |

    Add another service to log in.

    43 |
    44 |
    45 |
    46 |

    47 | @foreach (var provider in Model.OtherLogins) 48 | { 49 | 50 | } 51 |

    52 |
    53 |
    54 | } 55 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/auth/modules/auth.module.ts: -------------------------------------------------------------------------------- 1 | import { ArrayHelperService } from '../services/oidc-array-helper.service'; 2 | import { NgModule, ModuleWithProviders } from '@angular/core'; 3 | 4 | import { OidcSecurityService } from '../services/oidc.security.service'; 5 | import { AuthConfiguration, DefaultConfiguration } from './auth.configuration'; 6 | import { OidcSecurityValidation } from '../services/oidc.security.validation'; 7 | import { OidcSecurityCheckSession } from '../services/oidc.security.check-session'; 8 | import { OidcSecuritySilentRenew } from '../services/oidc.security.silent-renew'; 9 | import { OidcSecurityUserService } from '../services/oidc.security.user-service'; 10 | import { OidcSecurityCommon } from '../services/oidc.security.common'; 11 | import { 12 | OidcSecurityStorage, 13 | BrowserStorage 14 | } from '../services/oidc.security.storage'; 15 | import { AuthWellKnownEndpoints } from '../services/auth.well-known-endpoints'; 16 | import { StateValidationService } from '../services/oidc-security-state-validation.service'; 17 | import { OidcDataService } from '../services/oidc-data.service'; 18 | import { TokenHelperService } from '../services/oidc-token-helper.service'; 19 | import { LoggerService } from '../services/oidc.logger.service'; 20 | 21 | @NgModule() 22 | export class AuthModule { 23 | static forRoot(token: Token = {}): ModuleWithProviders { 24 | return { 25 | ngModule: AuthModule, 26 | providers: [ 27 | OidcSecurityService, 28 | OidcSecurityValidation, 29 | OidcSecurityCheckSession, 30 | OidcSecuritySilentRenew, 31 | OidcSecurityUserService, 32 | OidcSecurityCommon, 33 | AuthConfiguration, 34 | TokenHelperService, 35 | LoggerService, 36 | DefaultConfiguration, 37 | ArrayHelperService, 38 | AuthWellKnownEndpoints, 39 | OidcDataService, 40 | StateValidationService, 41 | { 42 | provide: OidcSecurityStorage, 43 | useClass: token.storage || BrowserStorage 44 | } 45 | ] 46 | }; 47 | } 48 | } 49 | 50 | export interface Type extends Function { 51 | new (...args: any[]): T; 52 | } 53 | 54 | export interface Token { 55 | storage?: Type; 56 | } 57 | -------------------------------------------------------------------------------- /ClientTwo/angularApp/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, OnDestroy } from '@angular/core'; 2 | import { Subscription } from 'rxjs/Subscription'; 3 | import { OidcSecurityService } from 'angular-auth-oidc-client'; 4 | import './app.component.css'; 5 | 6 | @Component({ 7 | selector: 'app-component', 8 | templateUrl: 'app.component.html', 9 | }) 10 | 11 | export class AppComponent implements OnInit, OnDestroy { 12 | 13 | title: string; 14 | email: string; 15 | 16 | isAuthorizedSubscription: Subscription; 17 | isAuthorized: boolean; 18 | userDataSubscription: Subscription; 19 | userData: boolean; 20 | 21 | constructor( 22 | public oidcSecurityService: OidcSecurityService 23 | ) { 24 | if (this.oidcSecurityService.moduleSetup) { 25 | this.doCallbackLogicIfRequired(); 26 | } else { 27 | this.oidcSecurityService.onModuleSetup.subscribe(() => { 28 | this.doCallbackLogicIfRequired(); 29 | }); 30 | } 31 | } 32 | 33 | ngOnInit() { 34 | this.isAuthorizedSubscription = this.oidcSecurityService.getIsAuthorized().subscribe( 35 | (isAuthorized: boolean) => { 36 | this.isAuthorized = isAuthorized; 37 | }); 38 | 39 | this.userDataSubscription = this.oidcSecurityService.getUserData().subscribe( 40 | (userData: any) => { 41 | if (userData && userData !== '') { 42 | this.email = userData.email; 43 | } 44 | }); 45 | } 46 | 47 | ngOnDestroy(): void { 48 | this.isAuthorizedSubscription.unsubscribe(); 49 | this.oidcSecurityService.onModuleSetup.unsubscribe(); 50 | this.userDataSubscription.unsubscribe(); 51 | } 52 | 53 | login() { 54 | console.log('start login'); 55 | this.oidcSecurityService.authorize(); 56 | } 57 | 58 | refreshSession() { 59 | console.log('start refreshSession'); 60 | this.oidcSecurityService.authorize(); 61 | } 62 | 63 | logout() { 64 | console.log('start logoff'); 65 | this.oidcSecurityService.logoff(); 66 | } 67 | 68 | private doCallbackLogicIfRequired() { 69 | if (window.location.hash) { 70 | this.oidcSecurityService.authorizedCallback(); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /ClientOne/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration for Angular testing 2 | 3 | module.exports = function (config) { 4 | var webpackConfig = require('./config/webpack.test.js'); 5 | 6 | var configuration = { 7 | 8 | // base path that will be used to resolve all patterns (eg. files, exclude) 9 | basePath: '', 10 | 11 | // frameworks to use 12 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter 13 | frameworks: ['jasmine'], 14 | 15 | // list of files / patterns to load in the browser 16 | files: [ 17 | { pattern: './config/spec.bundle.js', watched: false } 18 | ], 19 | 20 | // list of files to exclude 21 | exclude: [ 22 | ], 23 | 24 | client: { 25 | clearContext: false 26 | }, 27 | 28 | // preprocess matching files before serving them to the browser 29 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor 30 | preprocessors: { 31 | './config/spec.bundle.js': ['webpack', 'sourcemap'] 32 | }, 33 | 34 | // webpack 35 | webpack: webpackConfig, 36 | 37 | webpackServer: { 38 | noInfo: true 39 | }, 40 | 41 | 42 | // test results reporter to use 43 | // possible values: 'dots', 'progress' 44 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter 45 | reporters: ['spec', 'kjhtml'], 46 | 47 | 48 | // web server port 49 | port: 9876, 50 | 51 | 52 | // enable / disable colors in the output (reporters and logs) 53 | colors: true, 54 | 55 | 56 | // level of logging 57 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 58 | logLevel: config.LOG_INFO, 59 | 60 | 61 | // enable / disable watching file and executing tests whenever any file changes 62 | autoWatch: true, 63 | 64 | 65 | // start these browsers 66 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher 67 | browsers: ['Chrome'], 68 | 69 | // Continuous Integration mode 70 | // if true, Karma captures browsers, runs the tests and exits 71 | singleRun: false 72 | 73 | }; 74 | 75 | config.set(configuration); 76 | 77 | } 78 | -------------------------------------------------------------------------------- /ClientTwo/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration for Angular testing 2 | 3 | module.exports = function (config) { 4 | var webpackConfig = require('./config/webpack.test.js'); 5 | 6 | var configuration = { 7 | 8 | // base path that will be used to resolve all patterns (eg. files, exclude) 9 | basePath: '', 10 | 11 | // frameworks to use 12 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter 13 | frameworks: ['jasmine'], 14 | 15 | // list of files / patterns to load in the browser 16 | files: [ 17 | { pattern: './config/spec.bundle.js', watched: false } 18 | ], 19 | 20 | // list of files to exclude 21 | exclude: [ 22 | ], 23 | 24 | client: { 25 | clearContext: false 26 | }, 27 | 28 | // preprocess matching files before serving them to the browser 29 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor 30 | preprocessors: { 31 | './config/spec.bundle.js': ['webpack', 'sourcemap'] 32 | }, 33 | 34 | // webpack 35 | webpack: webpackConfig, 36 | 37 | webpackServer: { 38 | noInfo: true 39 | }, 40 | 41 | 42 | // test results reporter to use 43 | // possible values: 'dots', 'progress' 44 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter 45 | reporters: ['spec', 'kjhtml'], 46 | 47 | 48 | // web server port 49 | port: 9876, 50 | 51 | 52 | // enable / disable colors in the output (reporters and logs) 53 | colors: true, 54 | 55 | 56 | // level of logging 57 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 58 | logLevel: config.LOG_INFO, 59 | 60 | 61 | // enable / disable watching file and executing tests whenever any file changes 62 | autoWatch: true, 63 | 64 | 65 | // start these browsers 66 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher 67 | browsers: ['Chrome'], 68 | 69 | // Continuous Integration mode 70 | // if true, Karma captures browsers, runs the tests and exits 71 | singleRun: false 72 | 73 | }; 74 | 75 | config.set(configuration); 76 | 77 | } 78 | -------------------------------------------------------------------------------- /ClientOne/angularApp/app/auth/services/oidc.security.silent-renew.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Observer } from 'rxjs/Observer'; 3 | import { Observable } from 'rxjs/Observable'; 4 | import { LoggerService } from './oidc.logger.service'; 5 | 6 | @Injectable() 7 | export class OidcSecuritySilentRenew { 8 | private sessionIframe: any; 9 | 10 | constructor(private loggerService: LoggerService) {} 11 | 12 | initRenew() { 13 | let existsparent = undefined; 14 | try { 15 | const parentdoc = window.parent.document; 16 | if (!parentdoc) { 17 | throw new Error('Unaccessible'); 18 | } 19 | 20 | existsparent = parentdoc.getElementById('myiFrameForSilentRenew'); 21 | } catch (e) { 22 | // not accessible 23 | } 24 | const exists = window.document.getElementById('myiFrameForSilentRenew'); 25 | if (existsparent) { 26 | this.sessionIframe = existsparent; 27 | } else if (exists) { 28 | this.sessionIframe = exists; 29 | } 30 | 31 | if (!exists && !existsparent) { 32 | this.sessionIframe = window.document.createElement('iframe'); 33 | this.sessionIframe.id = 'myiFrameForSilentRenew'; 34 | this.loggerService.logDebug(this.sessionIframe); 35 | this.sessionIframe.style.display = 'none'; 36 | 37 | window.document.body.appendChild(this.sessionIframe); 38 | } 39 | } 40 | 41 | // TODO The return type of this method is never used. Is it needed? 42 | startRenew(url: string) { 43 | let existsparent = undefined; 44 | try { 45 | const parentdoc = window.parent.document; 46 | if (!parentdoc) { 47 | throw new Error('Unaccessible'); 48 | } 49 | 50 | existsparent = parentdoc.getElementById('myiFrameForSilentRenew'); 51 | } catch (e) { 52 | // not accessible 53 | } 54 | const exists = window.document.getElementById('myiFrameForSilentRenew'); 55 | if (existsparent) { 56 | this.sessionIframe = existsparent; 57 | } else if (exists) { 58 | this.sessionIframe = exists; 59 | } 60 | 61 | this.loggerService.logDebug('startRenew for URL:' + url); 62 | this.sessionIframe.src = url; 63 | 64 | return Observable.create((observer: Observer) => { 65 | this.sessionIframe.onload = () => { 66 | observer.next(this); 67 | observer.complete(); 68 | }; 69 | }); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Themes/ClientTwo/Account/Login.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Globalization 2 | @using IdentityServerWithAspNetIdentity.Resources 3 | @model IdentityServer4.Quickstart.UI.Models.LoginViewModel 4 | @inject SignInManager SignInManager 5 | 6 | @inject LocService SharedLocalizer 7 | 8 | @inject IdentityServerWithIdentitySQLite.ClientSelector _clientSelector 9 | @{ 10 | ViewData["Title"] = @SharedLocalizer.GetLocalizedHtmlString("login"); 11 | } 12 | 13 |



    14 | 15 |
    16 |
    17 |

    @_clientSelector.SelectedClient @CultureInfo.CurrentCulture

    18 |
    19 |
    20 |
    21 | 22 | 23 |
    24 | 25 |
    26 | 27 | 28 |
    29 | 30 |
    31 | 32 | @SharedLocalizer.GetLocalizedHtmlString("rememberMe") 33 |
    34 | 35 |
    36 |
    37 | 38 |
    39 |
    40 |

    41 | @SharedLocalizer.GetLocalizedHtmlString("registerAsNewUser") 42 |

    43 |

    44 | @SharedLocalizer.GetLocalizedHtmlString("forgotYourPassword") 45 |

    46 |
    47 |
    48 | 49 | @section Scripts { 50 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } 51 | } 52 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Themes/ClientOne/Account/Login.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Globalization 2 | @using IdentityServerWithAspNetIdentity.Resources 3 | @model IdentityServer4.Quickstart.UI.Models.LoginViewModel 4 | @inject SignInManager SignInManager 5 | 6 | @inject LocService SharedLocalizer 7 | 8 | @inject IdentityServerWithIdentitySQLite.ClientSelector _clientSelector 9 | @{ 10 | ViewData["Title"] = @SharedLocalizer.GetLocalizedHtmlString("login"); 11 | } 12 | Selected client: @_clientSelector.SelectedClient 13 |

    @ViewData["Title"] ClientOne

    14 |
    15 |
    16 |
    17 |
    18 |

    @CultureInfo.CurrentCulture

    19 |
    20 |
    21 |
    22 | 23 |
    24 | 25 | 26 |
    27 |
    28 |
    29 | 30 |
    31 | 32 | 33 |
    34 |
    35 |
    36 | 37 |
    38 | 39 |
    40 |
    41 |
    42 |
    43 | 44 |
    45 |
    46 |

    47 | @SharedLocalizer.GetLocalizedHtmlString("registerAsNewUser") 48 |

    49 |

    50 | @SharedLocalizer.GetLocalizedHtmlString("forgotYourPassword") 51 |

    52 |
    53 |
    54 |
    55 |
    56 | 57 | @section Scripts { 58 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } 59 | } 60 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Account/Login.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Globalization 2 | @using IdentityServerWithAspNetIdentity.Resources 3 | @model IdentityServer4.Quickstart.UI.Models.LoginViewModel 4 | @inject SignInManager SignInManager 5 | @inject LocService SharedLocalizer 6 | 7 | @inject IdentityServerWithIdentitySQLite.ClientSelector _clientSelector 8 | @{ 9 | ViewData["Title"] = @SharedLocalizer.GetLocalizedHtmlString("login"); 10 | } 11 | Selected client: @_clientSelector.SelectedClient 12 |

    @ViewData["Title"] DEFAULT LOGIN

    13 |
    14 |
    15 |
    16 |
    17 |

    @CultureInfo.CurrentCulture

    18 |
    19 |
    20 |
    21 | 22 |
    23 | 24 | 25 |
    26 |
    27 |
    28 | 29 |
    30 | 31 | 32 |
    33 |
    34 |
    35 | 36 |
    37 | 38 |
    39 |
    40 |
    41 |
    42 | 43 |
    44 |
    45 |

    46 | @SharedLocalizer.GetLocalizedHtmlString("registerAsNewUser") 47 |

    48 |

    49 | @SharedLocalizer.GetLocalizedHtmlString("forgotYourPassword") 50 |

    51 |
    52 |
    53 |
    54 |
    55 | @section Scripts { 56 | @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } 57 | } 58 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Themes/ClientTwo/Shared/_LayoutClientTwo.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Globalization 2 | @using IdentityServerWithAspNetIdentity.Resources 3 | @inject LocService SharedLocalizer 4 | @inject IdentityServerWithIdentitySQLite.ClientSelector _clientSelector 5 | 6 | 7 | 8 | 9 | 10 | 11 | @ViewData["Title"] - ID4 ClientTwo 12 | 13 | 14 | 15 | 16 |
    17 |
    18 |
    19 | 20 | STS: @_clientSelector.SelectedClient 21 | 22 |
    23 | 24 | 31 |
    32 |
    33 |
    34 | 35 |
    36 | @RenderBody() 37 |
    38 |
    39 |

    © 2018 - ID4 ClientTwo

    40 |
    41 |
    42 | 43 | 44 | 45 | 46 | 47 | 48 | 52 | 56 | 57 | 58 | @RenderSection("scripts", required: false) 59 | 60 | 61 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Manage/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IndexViewModel 2 | @{ 3 | ViewData["Title"] = "Manage your account"; 4 | } 5 | 6 |

    @ViewData["Title"].

    7 |

    @ViewData["StatusMessage"]

    8 | 9 |
    10 |

    Change your account settings

    11 |
    12 |
    13 |
    Password:
    14 |
    15 | @if (Model.HasPassword) 16 | { 17 | Change 18 | } 19 | else 20 | { 21 | Create 22 | } 23 |
    24 |
    External Logins:
    25 |
    26 | 27 | @Model.Logins.Count Manage 28 |
    29 |
    Phone Number:
    30 |
    31 |

    32 | Phone Numbers can used as a second factor of verification in two-factor authentication. 33 | See this article 34 | for details on setting up this ASP.NET application to support two-factor authentication using SMS. 35 |

    36 | @*@(Model.PhoneNumber ?? "None") 37 | @if (Model.PhoneNumber != null) 38 | { 39 |
    40 | Change 41 |
    42 | [] 43 |
    44 | } 45 | else 46 | { 47 | Add 48 | }*@ 49 |
    50 | 51 |
    Two-Factor Authentication:
    52 |
    53 |

    54 | There are no two-factor authentication providers configured. See this article 55 | for setting up this application to support two-factor authentication. 56 |

    57 | @*@if (Model.TwoFactor) 58 | { 59 |
    60 | Enabled 61 |
    62 | } 63 | else 64 | { 65 |
    66 | Disabled 67 |
    68 | }*@ 69 |
    70 |
    71 |
    72 | -------------------------------------------------------------------------------- /ClientTwo/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using Microsoft.AspNetCore.Builder; 4 | using Microsoft.AspNetCore.Http; 5 | using Microsoft.AspNetCore.Hosting; 6 | using Microsoft.Extensions.Configuration; 7 | using Microsoft.Extensions.DependencyInjection; 8 | using Microsoft.Extensions.Logging; 9 | using SecurityAspNetCoreSignalR.ViewModel; 10 | 11 | namespace Angular2WebpackVisualStudio 12 | { 13 | public class Startup 14 | { 15 | public Startup(IHostingEnvironment env) 16 | { 17 | var builder = new ConfigurationBuilder() 18 | .SetBasePath(env.ContentRootPath) 19 | .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) 20 | .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) 21 | .AddEnvironmentVariables(); 22 | Configuration = builder.Build(); 23 | } 24 | 25 | public IConfigurationRoot Configuration { get; } 26 | 27 | // This method gets called by the runtime. Use this method to add services to the container. 28 | public void ConfigureServices(IServiceCollection services) 29 | { 30 | services.Configure(Configuration.GetSection("ClientAppSettings")); 31 | services.AddCors(options => 32 | { 33 | options.AddPolicy("AllowAllOrigins", 34 | builder => 35 | { 36 | builder 37 | .AllowAnyOrigin() 38 | .AllowAnyHeader() 39 | .AllowAnyMethod(); 40 | }); 41 | }); 42 | 43 | services.AddMvc(); 44 | } 45 | 46 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 47 | public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 48 | { 49 | loggerFactory.AddConsole(Configuration.GetSection("Logging")); 50 | loggerFactory.AddDebug(); 51 | 52 | var angularRoutes = new[] { 53 | "/home", 54 | "/unauthorized", 55 | "/dm", 56 | "/about" 57 | }; 58 | 59 | app.Use(async (context, next) => 60 | { 61 | if (context.Request.Path.HasValue && null != angularRoutes.FirstOrDefault( 62 | (ar) => context.Request.Path.Value.StartsWith(ar, StringComparison.OrdinalIgnoreCase))) 63 | { 64 | context.Request.Path = new PathString("/"); 65 | } 66 | 67 | await next(); 68 | }); 69 | 70 | app.UseCors("AllowAllOrigins"); 71 | 72 | app.UseDefaultFiles(); 73 | app.UseStaticFiles(); 74 | 75 | app.UseMvc(routes => 76 | { 77 | routes.MapRoute( 78 | name: "default", 79 | template: "{controller=Home}/{action=Index}/{id?}"); 80 | }); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /ClientOne/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Microsoft.Extensions.Configuration; 4 | using Microsoft.Extensions.DependencyInjection; 5 | using Microsoft.Extensions.Logging; 6 | using System.IO; 7 | using Microsoft.AspNetCore.Http; 8 | using System.Linq; 9 | using System; 10 | 11 | namespace Angular2Client 12 | { 13 | public class Startup 14 | { 15 | public Startup(IHostingEnvironment env) 16 | { 17 | var builder = new ConfigurationBuilder() 18 | .SetBasePath(env.ContentRootPath) 19 | .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) 20 | .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) 21 | .AddEnvironmentVariables(); 22 | Configuration = builder.Build(); 23 | } 24 | 25 | public IConfigurationRoot Configuration { get; set; } 26 | 27 | public void ConfigureServices(IServiceCollection services) 28 | { 29 | services.AddCors(options => 30 | { 31 | options.AddPolicy("AllowAllOrigins", 32 | builder => 33 | { 34 | builder 35 | .AllowAnyOrigin() 36 | .AllowAnyHeader() 37 | .AllowAnyMethod(); 38 | }); 39 | }); 40 | } 41 | 42 | public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 43 | { 44 | loggerFactory.AddConsole(Configuration.GetSection("Logging")); 45 | loggerFactory.AddDebug(); 46 | 47 | app.UseCors("AllowAllOrigins"); 48 | 49 | var angularRoutes = new[] { 50 | "/home", 51 | "/forbidden", 52 | "/authorized", 53 | "/authorize", 54 | "/unauthorized", 55 | "/logoff" 56 | }; 57 | 58 | app.Use(async (context, next) => 59 | { 60 | if (context.Request.Path.HasValue && null != angularRoutes.FirstOrDefault( 61 | (ar) => context.Request.Path.Value.StartsWith(ar, StringComparison.OrdinalIgnoreCase))) 62 | { 63 | context.Request.Path = new PathString("/"); 64 | } 65 | 66 | await next(); 67 | }); 68 | 69 | app.UseDefaultFiles(); 70 | app.UseStaticFiles(); 71 | 72 | app.Run(async (context) => 73 | { 74 | await context.Response.WriteAsync("This is server routing, not angular2 routing"); 75 | }); 76 | } 77 | 78 | public static void Main(string[] args) 79 | { 80 | var host = new WebHostBuilder() 81 | .UseKestrel() 82 | .UseContentRoot(Directory.GetCurrentDirectory()) 83 | .UseIISIntegration() 84 | .UseStartup() 85 | .Build(); 86 | 87 | host.Run(); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /ClientOne/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-webpack-visualstudio", 3 | "version": "3.0.0", 4 | "description": "An Angular VS template", 5 | "main": "wwwroot/index.html", 6 | "author": "", 7 | "license": "ISC", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/damienbod/Angular2WebpackVisualStudio.git" 11 | }, 12 | "scripts": { 13 | "start": "concurrently \"webpack-dev-server --env=dev --open --hot --inline --port 8080\" \"dotnet run\" ", 14 | "webpack-dev": "webpack --env=dev", 15 | "webpack-production": "webpack --env=prod", 16 | "build-dev": "npm run webpack-dev", 17 | "build-production": "npm run webpack-production", 18 | "watch-webpack-dev": "webpack --env=dev --watch --color", 19 | "watch-webpack-production": "npm run build-production --watch --color", 20 | "publish-for-iis": "npm run build-production && dotnet publish -c Release", 21 | "test": "karma start", 22 | "test-ci": "karma start --single-run --browsers ChromeHeadless", 23 | "lint": "tslint ./angularApp" 24 | }, 25 | "dependencies": { 26 | "angular-l10n": "^4.1.3", 27 | "@angular/animations": "5.1.1", 28 | "@angular/common": "5.1.1", 29 | "@angular/compiler": "5.1.1", 30 | "@angular/compiler-cli": "5.1.1", 31 | "@angular/core": "5.1.1", 32 | "@angular/forms": "5.1.1", 33 | "@angular/http": "5.1.1", 34 | "@angular/platform-browser": "5.1.1", 35 | "@angular/platform-browser-dynamic": "5.1.1", 36 | "@angular/platform-server": "5.1.1", 37 | "@angular/router": "5.1.1", 38 | "@angular/upgrade": "5.1.1", 39 | "bootstrap": "3.3.7", 40 | "core-js": "2.5.3", 41 | "ie-shim": "0.1.0", 42 | "rxjs": "5.5.5", 43 | "jsrsasign": "8.0.4", 44 | "zone.js": "0.8.18" 45 | }, 46 | "devDependencies": { 47 | "@ngtools/webpack": "^1.9.1", 48 | "@types/jasmine": "^2.8.2", 49 | "@types/node": "^8.5.1", 50 | "angular-router-loader": "^0.8.0", 51 | "angular2-template-loader": "^0.6.2", 52 | "awesome-typescript-loader": "^3.4.1", 53 | "clean-webpack-plugin": "^0.1.17", 54 | "codelyzer": "^4.0.2", 55 | "concurrently": "^3.5.1", 56 | "copy-webpack-plugin": "^4.3.0", 57 | "css-loader": "^0.28.7", 58 | "file-loader": "^1.1.5", 59 | "html-webpack-plugin": "^2.30.1", 60 | "jasmine-core": "^2.8.0", 61 | "jquery": "^3.2.1", 62 | "json-loader": "^0.5.7", 63 | "karma": "^1.7.1", 64 | "karma-chrome-launcher": "^2.2.0", 65 | "karma-jasmine": "^1.1.1", 66 | "karma-jasmine-html-reporter": "^0.2.2", 67 | "karma-sourcemap-loader": "^0.3.7", 68 | "karma-spec-reporter": "^0.0.32", 69 | "karma-webpack": "^2.0.9", 70 | "node-sass": "^4.7.2", 71 | "raw-loader": "^0.5.1", 72 | "rimraf": "^2.6.2", 73 | "sass-loader": "^6.0.6", 74 | "source-map-loader": "^0.2.3", 75 | "style-loader": "^0.19.1", 76 | "tslint": "^5.8.0", 77 | "tslint-loader": "^3.5.3", 78 | "typescript": "^2.6.2", 79 | "uglifyjs-webpack-plugin": "^1.1.4", 80 | "url-loader": "^0.6.2", 81 | "webpack": "^3.10.0", 82 | "webpack-bundle-analyzer": "^2.9.1", 83 | "webpack-dev-server": "^2.9.7" 84 | }, 85 | "-vs-binding": { 86 | "ProjectOpened": [ 87 | "watch-webpack-dev" 88 | ] 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /ClientOne/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "callable-types": true, 7 | "class-name": true, 8 | "comment-format": [ 9 | true, 10 | "check-space" 11 | ], 12 | "curly": true, 13 | "eofline": true, 14 | "forin": true, 15 | "import-blacklist": [ true, "rxjs" ], 16 | "import-spacing": true, 17 | "indent": [ 18 | true, 19 | "spaces" 20 | ], 21 | "interface-over-type-literal": true, 22 | "label-position": true, 23 | "max-line-length": [ 24 | true, 25 | 200 26 | ], 27 | "member-access": false, 28 | "member-ordering": [ 29 | true, 30 | "static-before-instance", 31 | "variables-before-functions" 32 | ], 33 | "no-arg": true, 34 | "no-bitwise": false, 35 | "no-console": [ 36 | true, 37 | "debug", 38 | "info", 39 | "time", 40 | "timeEnd", 41 | "trace" 42 | ], 43 | "no-construct": true, 44 | "no-debugger": true, 45 | "no-duplicate-variable": true, 46 | "no-empty": false, 47 | "no-empty-interface": true, 48 | "no-eval": true, 49 | "no-inferrable-types": [ true, "ignore-params" ], 50 | "no-shadowed-variable": true, 51 | "no-string-literal": false, 52 | "no-string-throw": true, 53 | "no-switch-case-fall-through": true, 54 | "no-trailing-whitespace": true, 55 | "no-unused-expression": true, 56 | "no-use-before-declare": true, 57 | "no-var-keyword": true, 58 | "object-literal-sort-keys": false, 59 | "one-line": [ 60 | true, 61 | "check-open-brace", 62 | "check-catch", 63 | "check-else", 64 | "check-whitespace" 65 | ], 66 | "prefer-const": true, 67 | "quotemark": [ 68 | true, 69 | "single" 70 | ], 71 | "radix": true, 72 | "semicolon": [ 73 | "always" 74 | ], 75 | "triple-equals": [ 76 | true, 77 | "allow-null-check" 78 | ], 79 | "typedef-whitespace": [ 80 | true, 81 | { 82 | "call-signature": "nospace", 83 | "index-signature": "nospace", 84 | "parameter": "nospace", 85 | "property-declaration": "nospace", 86 | "variable-declaration": "nospace" 87 | } 88 | ], 89 | "typeof-compare": true, 90 | "unified-signatures": true, 91 | "variable-name": false, 92 | "whitespace": [ 93 | true, 94 | "check-branch", 95 | "check-decl", 96 | "check-operator", 97 | "check-separator", 98 | "check-type" 99 | ], 100 | 101 | "directive-selector": [ true, "attribute", "app", "camelCase" ], 102 | "component-selector": [ true, "element", "app", "kebab-case" ], 103 | "use-input-property-decorator": true, 104 | "use-output-property-decorator": true, 105 | "use-host-property-decorator": true, 106 | "no-input-rename": true, 107 | "no-output-rename": true, 108 | "use-life-cycle-interface": true, 109 | "use-pipe-transform-interface": true, 110 | "component-class-suffix": true, 111 | "directive-class-suffix": true, 112 | "no-access-missing-member": true, 113 | "templates-use-public": true, 114 | "invoke-injectable": true 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /ClientTwo/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "callable-types": true, 7 | "class-name": true, 8 | "comment-format": [ 9 | true, 10 | "check-space" 11 | ], 12 | "curly": true, 13 | "eofline": true, 14 | "forin": true, 15 | "import-blacklist": [ true, "rxjs" ], 16 | "import-spacing": true, 17 | "indent": [ 18 | true, 19 | "spaces" 20 | ], 21 | "interface-over-type-literal": true, 22 | "label-position": true, 23 | "max-line-length": [ 24 | true, 25 | 140 26 | ], 27 | "member-access": false, 28 | "member-ordering": [ 29 | true, 30 | "static-before-instance", 31 | "variables-before-functions" 32 | ], 33 | "no-arg": true, 34 | "no-bitwise": true, 35 | "no-console": [ 36 | true, 37 | "debug", 38 | "info", 39 | "time", 40 | "timeEnd", 41 | "trace" 42 | ], 43 | "no-construct": true, 44 | "no-debugger": true, 45 | "no-duplicate-variable": true, 46 | "no-empty": false, 47 | "no-empty-interface": true, 48 | "no-eval": true, 49 | "no-inferrable-types": [ true, "ignore-params" ], 50 | "no-shadowed-variable": true, 51 | "no-string-literal": false, 52 | "no-string-throw": true, 53 | "no-switch-case-fall-through": true, 54 | "no-trailing-whitespace": true, 55 | "no-unused-expression": true, 56 | "no-use-before-declare": true, 57 | "no-var-keyword": true, 58 | "object-literal-sort-keys": false, 59 | "one-line": [ 60 | true, 61 | "check-open-brace", 62 | "check-catch", 63 | "check-else", 64 | "check-whitespace" 65 | ], 66 | "prefer-const": true, 67 | "quotemark": [ 68 | true, 69 | "single" 70 | ], 71 | "radix": true, 72 | "semicolon": [ 73 | "always" 74 | ], 75 | "triple-equals": [ 76 | true, 77 | "allow-null-check" 78 | ], 79 | "typedef-whitespace": [ 80 | true, 81 | { 82 | "call-signature": "nospace", 83 | "index-signature": "nospace", 84 | "parameter": "nospace", 85 | "property-declaration": "nospace", 86 | "variable-declaration": "nospace" 87 | } 88 | ], 89 | "typeof-compare": true, 90 | "unified-signatures": true, 91 | "variable-name": false, 92 | "whitespace": [ 93 | true, 94 | "check-branch", 95 | "check-decl", 96 | "check-operator", 97 | "check-separator", 98 | "check-type" 99 | ], 100 | 101 | "directive-selector": [ true, "attribute", "app", "camelCase" ], 102 | "component-selector": [ true, "element", "app", "kebab-case" ], 103 | "use-input-property-decorator": true, 104 | "use-output-property-decorator": true, 105 | "use-host-property-decorator": true, 106 | "no-input-rename": true, 107 | "no-output-rename": true, 108 | "use-life-cycle-interface": true, 109 | "use-pipe-transform-interface": true, 110 | "component-class-suffix": true, 111 | "directive-class-suffix": true, 112 | "no-access-missing-member": true, 113 | "templates-use-public": true, 114 | "invoke-injectable": true 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /ClientTwo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-webpack-visualstudio", 3 | "version": "3.0.0", 4 | "description": "An Angular VS template", 5 | "main": "wwwroot/index.html", 6 | "author": "", 7 | "license": "ISC", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/damienbod/Angular2WebpackVisualStudio.git" 11 | }, 12 | "scripts": { 13 | "start": "concurrently \"webpack-dev-server --env=dev --open --hot --inline --port 8080\" \"dotnet run\" ", 14 | "webpack-dev": "webpack --env=dev", 15 | "webpack-production": "webpack --env=prod", 16 | "build-dev": "npm run webpack-dev", 17 | "build-production": "npm run webpack-production", 18 | "watch-webpack-dev": "webpack --env=dev --watch --color", 19 | "watch-webpack-production": "npm run build-production --watch --color", 20 | "publish-for-iis": "npm run build-production && dotnet publish -c Release", 21 | "test": "karma start", 22 | "test-ci": "karma start --single-run --browsers ChromeHeadless", 23 | "lint": "tslint ./angularApp" 24 | }, 25 | "dependencies": { 26 | "@angular/cdk": "5.0.2", 27 | "@angular/flex-layout": "2.0.0-beta.10-4905443", 28 | "@angular/material": "5.0.2", 29 | "@angular/animations": "5.1.2", 30 | "@angular/common": "5.1.2", 31 | "@angular/compiler": "5.1.2", 32 | "@angular/compiler-cli": "5.1.2", 33 | "@angular/core": "5.1.2", 34 | "@angular/forms": "5.1.2", 35 | "@angular/http": "5.1.2", 36 | "@angular/platform-browser": "5.1.2", 37 | "@angular/platform-browser-dynamic": "5.1.2", 38 | "@angular/platform-server": "5.1.2", 39 | "@angular/router": "5.1.2", 40 | "@angular/upgrade": "5.1.2", 41 | "core-js": "2.5.3", 42 | "ie-shim": "0.1.0", 43 | "rxjs": "5.5.6", 44 | "angular-auth-oidc-client": "3.0.11", 45 | "zone.js": "0.8.19" 46 | }, 47 | "devDependencies": { 48 | "@ngtools/webpack": "^1.9.3", 49 | "@types/jasmine": "^2.8.3", 50 | "@types/node": "^8.5.2", 51 | "angular-router-loader": "^0.8.1", 52 | "angular2-template-loader": "^0.6.2", 53 | "awesome-typescript-loader": "^3.4.1", 54 | "clean-webpack-plugin": "^0.1.17", 55 | "codelyzer": "^4.0.2", 56 | "concurrently": "^3.5.1", 57 | "copy-webpack-plugin": "^4.3.1", 58 | "css-loader": "^0.28.7", 59 | "file-loader": "^1.1.6", 60 | "html-webpack-plugin": "^2.30.1", 61 | "jasmine-core": "^2.8.0", 62 | "jquery": "^3.2.1", 63 | "json-loader": "^0.5.7", 64 | "karma": "^2.0.0", 65 | "karma-chrome-launcher": "^2.2.0", 66 | "karma-jasmine": "^1.1.1", 67 | "karma-jasmine-html-reporter": "^0.2.2", 68 | "karma-sourcemap-loader": "^0.3.7", 69 | "karma-spec-reporter": "^0.0.32", 70 | "karma-webpack": "^2.0.9", 71 | "node-sass": "^4.7.2", 72 | "raw-loader": "^0.5.1", 73 | "rimraf": "^2.6.2", 74 | "sass-loader": "^6.0.6", 75 | "source-map-loader": "^0.2.3", 76 | "style-loader": "^0.19.1", 77 | "tslint": "^5.8.0", 78 | "tslint-loader": "^3.5.3", 79 | "typescript": "^2.6.2", 80 | "uglifyjs-webpack-plugin": "^1.1.5", 81 | "url-loader": "^0.6.2", 82 | "webpack": "^3.10.0", 83 | "webpack-bundle-analyzer": "^2.9.1", 84 | "webpack-dev-server": "^2.9.7" 85 | }, 86 | "-vs-binding": { 87 | "ProjectOpened": [ 88 | "watch-webpack-dev" 89 | ] 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4Persistence.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27130.2010 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetCoreIdentityServer4", "AspNetCoreIdentityServer4\AspNetCoreIdentityServer4.csproj", "{2C40287A-BD3C-4D8C-84D9-33AE54973C61}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SeedingConsoleApp", "SeedingConsoleApp\SeedingConsoleApp.csproj", "{F3664F73-ED71-4602-861D-423EE430DEBF}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientOne", "ClientOne\ClientOne.csproj", "{BB325C98-98EF-4778-B394-EED8A8BE3515}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetCoreIdentityServer4.Persistence", "AspNetCoreIdentityServer4.Persistence\AspNetCoreIdentityServer4.Persistence.csproj", "{B2F33762-018C-4E6A-A7A1-7DB88A49B132}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientTwo", "ClientTwo\ClientTwo.csproj", "{FBC65088-9607-404B-A594-73D12594364C}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|Any CPU = Debug|Any CPU 19 | Release|Any CPU = Release|Any CPU 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {2C40287A-BD3C-4D8C-84D9-33AE54973C61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {2C40287A-BD3C-4D8C-84D9-33AE54973C61}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {2C40287A-BD3C-4D8C-84D9-33AE54973C61}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {2C40287A-BD3C-4D8C-84D9-33AE54973C61}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {F3664F73-ED71-4602-861D-423EE430DEBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {F3664F73-ED71-4602-861D-423EE430DEBF}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {F3664F73-ED71-4602-861D-423EE430DEBF}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {F3664F73-ED71-4602-861D-423EE430DEBF}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {BB325C98-98EF-4778-B394-EED8A8BE3515}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {BB325C98-98EF-4778-B394-EED8A8BE3515}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {BB325C98-98EF-4778-B394-EED8A8BE3515}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {BB325C98-98EF-4778-B394-EED8A8BE3515}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {B2F33762-018C-4E6A-A7A1-7DB88A49B132}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {B2F33762-018C-4E6A-A7A1-7DB88A49B132}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {B2F33762-018C-4E6A-A7A1-7DB88A49B132}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {B2F33762-018C-4E6A-A7A1-7DB88A49B132}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {FBC65088-9607-404B-A594-73D12594364C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {FBC65088-9607-404B-A594-73D12594364C}.Debug|Any CPU.Build.0 = Debug|Any CPU 40 | {FBC65088-9607-404B-A594-73D12594364C}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {FBC65088-9607-404B-A594-73D12594364C}.Release|Any CPU.Build.0 = Release|Any CPU 42 | EndGlobalSection 43 | GlobalSection(SolutionProperties) = preSolution 44 | HideSolutionNode = FALSE 45 | EndGlobalSection 46 | GlobalSection(ExtensibilityGlobals) = postSolution 47 | SolutionGuid = {CD9FF5E4-41D0-4B40-99C1-9E100A90B806} 48 | EndGlobalSection 49 | EndGlobal 50 | -------------------------------------------------------------------------------- /AspNetCoreIdentityServer4/Views/Consent/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IdentityServer4.Quickstart.UI.Models.ConsentViewModel 2 | 3 | --------------------------------------------------------------------------------