├── Angular 7 ├── src │ ├── assets │ │ ├── .gitkeep │ │ └── img │ │ │ ├── 403.png │ │ │ ├── add_user.png │ │ │ └── single_user.png │ ├── app │ │ ├── app.component.css │ │ ├── admin-panel │ │ │ ├── admin-panel.component.html │ │ │ └── admin-panel.component.ts │ │ ├── app.component.html │ │ ├── app.component.ts │ │ ├── user │ │ │ ├── user.component.ts │ │ │ ├── user.component.html │ │ │ ├── login │ │ │ │ ├── login.component.html │ │ │ │ └── login.component.ts │ │ │ └── registration │ │ │ │ ├── registration.component.ts │ │ │ │ └── registration.component.html │ │ ├── forbidden │ │ │ ├── forbidden.component.ts │ │ │ └── forbidden.component.html │ │ ├── home │ │ │ ├── home.component.html │ │ │ └── home.component.ts │ │ ├── auth │ │ │ ├── auth.guard.ts │ │ │ └── auth.interceptor.ts │ │ ├── app.component.spec.ts │ │ ├── app-routing.module.ts │ │ ├── app.module.ts │ │ └── shared │ │ │ └── user.service.ts │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ ├── tslint.json │ ├── main.ts │ ├── browserslist │ ├── test.ts │ ├── karma.conf.js │ ├── index.html │ ├── styles.css │ └── polyfills.ts ├── e2e │ ├── src │ │ ├── app.po.ts │ │ └── app.e2e-spec.ts │ ├── tsconfig.e2e.json │ └── protractor.conf.js ├── .editorconfig ├── tsconfig.json ├── .gitignore ├── appStructure.txt ├── README.md ├── package.json ├── tslint.json └── angular.json ├── WebAPI ├── .vs │ ├── WebAPI │ │ └── v15 │ │ │ ├── Server │ │ │ └── sqlite3 │ │ │ │ ├── db.lock │ │ │ │ ├── storage.ide │ │ │ │ ├── storage.ide-shm │ │ │ │ └── storage.ide-wal │ │ │ └── .suo │ └── config │ │ └── applicationhost.config ├── WebAPI │ ├── obj │ │ ├── Debug │ │ │ └── netcoreapp2.2 │ │ │ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ │ │ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ │ │ │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs │ │ │ │ ├── WebAPI.RazorAssemblyInfo.cache │ │ │ │ ├── WebAPI.AssemblyInfoInputs.cache │ │ │ │ ├── WebAPI.RazorTargetAssemblyInfo.cache │ │ │ │ ├── WebAPI.csproj.CoreCompileInputs.cache │ │ │ │ ├── WebAPI.dll │ │ │ │ ├── WebAPI.pdb │ │ │ │ ├── WebAPI.assets.cache │ │ │ │ ├── WebAPI.csprojAssemblyReference.cache │ │ │ │ ├── WebAPI.RazorAssemblyInfo.cs │ │ │ │ ├── WebAPI.AssemblyInfo.cs │ │ │ │ └── WebAPI.csproj.FileListAbsolute.txt │ │ ├── WebAPI.csproj.nuget.cache │ │ ├── WebAPI.csproj.nuget.g.targets │ │ └── WebAPI.csproj.nuget.g.props │ ├── appsettings.Development.json │ ├── bin │ │ └── Debug │ │ │ └── netcoreapp2.2 │ │ │ ├── WebAPI.dll │ │ │ ├── WebAPI.pdb │ │ │ ├── WebAPI.runtimeconfig.dev.json │ │ │ └── WebAPI.runtimeconfig.json │ ├── Models │ │ ├── LoginModel.cs │ │ ├── ApplicationSettings.cs │ │ ├── ApplicationUser.cs │ │ ├── ApplicationUserModel.cs │ │ └── AuthenticationContext.cs │ ├── appsettings.json │ ├── WebAPI.csproj │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── WebAPI.csproj.user │ ├── Controllers │ │ ├── ValuesController.cs │ │ ├── UserProfileController.cs │ │ └── ApplicationUserController.cs │ ├── Startup.cs │ └── Migrations │ │ ├── AuthenticationContextModelSnapshot.cs │ │ ├── 20190124045416_InitialCreate.Designer.cs │ │ └── 20190124045416_InitialCreate.cs └── WebAPI.sln └── README.md /Angular 7/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Angular 7/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /WebAPI/.vs/WebAPI/v15/Server/sqlite3/db.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Angular 7/src/app/admin-panel/admin-panel.component.html: -------------------------------------------------------------------------------- 1 |

2 | admin-panel works! 3 |

4 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/Debug/netcoreapp2.2/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/Debug/netcoreapp2.2/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/Debug/netcoreapp2.2/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Angular 7/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/Debug/netcoreapp2.2/WebAPI.RazorAssemblyInfo.cache: -------------------------------------------------------------------------------- 1 | 956d135b4025f3ddc3d3abd4139e3f09fdc815fb 2 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/Debug/netcoreapp2.2/WebAPI.AssemblyInfoInputs.cache: -------------------------------------------------------------------------------- 1 | 8071d147e32d0630849d28d7010f1c7d9f5cfc82 2 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/Debug/netcoreapp2.2/WebAPI.RazorTargetAssemblyInfo.cache: -------------------------------------------------------------------------------- 1 | 425a257f2524fe85d4c5b963eb1a394a4032abc4 2 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/Debug/netcoreapp2.2/WebAPI.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 001a6e34bdf223b96578f3873774e0dc2f7bf45a 2 | -------------------------------------------------------------------------------- /Angular 7/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Angular 7/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role/master/Angular 7/src/favicon.ico -------------------------------------------------------------------------------- /WebAPI/.vs/WebAPI/v15/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role/master/WebAPI/.vs/WebAPI/v15/.suo -------------------------------------------------------------------------------- /Angular 7/src/assets/img/403.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role/master/Angular 7/src/assets/img/403.png -------------------------------------------------------------------------------- /Angular 7/src/assets/img/add_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role/master/Angular 7/src/assets/img/add_user.png -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/WebAPI.csproj.nuget.cache: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "dgSpecHash": "Lfqi4TAJw48S5wG+Xfonbgcq1gDXXOCGTs+0SJ6MVS5eROQXDdbD+3ljsx8ghJ9AifvHXgiUpi9MEFvD0eJNkA==", 4 | "success": true 5 | } -------------------------------------------------------------------------------- /Angular 7/src/assets/img/single_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role/master/Angular 7/src/assets/img/single_user.png -------------------------------------------------------------------------------- /WebAPI/.vs/WebAPI/v15/Server/sqlite3/storage.ide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role/master/WebAPI/.vs/WebAPI/v15/Server/sqlite3/storage.ide -------------------------------------------------------------------------------- /WebAPI/WebAPI/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/bin/Debug/netcoreapp2.2/WebAPI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role/master/WebAPI/WebAPI/bin/Debug/netcoreapp2.2/WebAPI.dll -------------------------------------------------------------------------------- /WebAPI/WebAPI/bin/Debug/netcoreapp2.2/WebAPI.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role/master/WebAPI/WebAPI/bin/Debug/netcoreapp2.2/WebAPI.pdb -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/Debug/netcoreapp2.2/WebAPI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role/master/WebAPI/WebAPI/obj/Debug/netcoreapp2.2/WebAPI.dll -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/Debug/netcoreapp2.2/WebAPI.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role/master/WebAPI/WebAPI/obj/Debug/netcoreapp2.2/WebAPI.pdb -------------------------------------------------------------------------------- /WebAPI/.vs/WebAPI/v15/Server/sqlite3/storage.ide-shm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role/master/WebAPI/.vs/WebAPI/v15/Server/sqlite3/storage.ide-shm -------------------------------------------------------------------------------- /WebAPI/.vs/WebAPI/v15/Server/sqlite3/storage.ide-wal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role/master/WebAPI/.vs/WebAPI/v15/Server/sqlite3/storage.ide-wal -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/Debug/netcoreapp2.2/WebAPI.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role/master/WebAPI/WebAPI/obj/Debug/netcoreapp2.2/WebAPI.assets.cache -------------------------------------------------------------------------------- /Angular 7/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "types": [] 6 | }, 7 | "exclude": [ 8 | "test.ts", 9 | "**/*.spec.ts" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/Debug/netcoreapp2.2/WebAPI.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodAffection/Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role/master/WebAPI/WebAPI/obj/Debug/netcoreapp2.2/WebAPI.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /Angular 7/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Angular 7/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'Angular7'; 10 | } 11 | -------------------------------------------------------------------------------- /Angular 7/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /WebAPI/WebAPI/bin/Debug/netcoreapp2.2/WebAPI.runtimeconfig.dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "additionalProbingPaths": [ 4 | "C:\\Users\\Shamseer\\.dotnet\\store\\|arch|\\|tfm|", 5 | "C:\\Users\\Shamseer\\.nuget\\packages", 6 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" 7 | ] 8 | } 9 | } -------------------------------------------------------------------------------- /WebAPI/WebAPI/bin/Debug/netcoreapp2.2/WebAPI.runtimeconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "tfm": "netcoreapp2.2", 4 | "framework": { 5 | "name": "Microsoft.AspNetCore.App", 6 | "version": "2.2.0" 7 | }, 8 | "configProperties": { 9 | "System.GC.Server": true 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Angular 7/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /Angular 7/src/app/user/user.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-user', 5 | templateUrl: './user.component.html', 6 | styles: [] 7 | }) 8 | export class UserComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/Models/LoginModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace WebAPI.Models 7 | { 8 | public class LoginModel 9 | { 10 | public string UserName { get; set; } 11 | public string Password { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Angular 7/src/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 | styles: [] 7 | }) 8 | export class ForbiddenComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/Models/ApplicationSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace WebAPI.Models 7 | { 8 | public class ApplicationSettings 9 | { 10 | public string JWT_Secret { get; set; } 11 | public string Client_URL { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Angular 7/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "test.ts", 12 | "polyfills.ts" 13 | ], 14 | "include": [ 15 | "**/*.spec.ts", 16 | "**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /Angular 7/src/app/admin-panel/admin-panel.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-admin-panel', 5 | templateUrl: './admin-panel.component.html', 6 | styles: [] 7 | }) 8 | export class AdminPanelComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Angular 7/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('workspace-project App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to Angular7!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /Angular 7/src/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "app", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "app", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Angular 7/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /Angular 7/src/browserslist: -------------------------------------------------------------------------------- 1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | # 5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed 6 | 7 | > 0.5% 8 | last 2 versions 9 | Firefox ESR 10 | not dead 11 | not IE 9-11 -------------------------------------------------------------------------------- /WebAPI/WebAPI/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning" 5 | } 6 | }, 7 | "AllowedHosts": "*", 8 | "ConnectionStrings": { 9 | "IdentityConnection": "Server=(local)\\sqlexpress; Database=UserDB; Trusted_Connection=True; MultipleActiveResultSets=True;" 10 | }, 11 | "ApplicationSettings": { 12 | "JWT_Secret": "1234567890123456", 13 | "Client_URL": "http://localhost:4200" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/Models/ApplicationUser.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Identity; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations.Schema; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | 8 | namespace WebAPI.Models 9 | { 10 | public class ApplicationUser : IdentityUser 11 | { 12 | [Column(TypeName ="nvarchar(150)")] 13 | public string FullName { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Angular 7/src/app/user/user.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Sign In

5 |

Sign Up

6 |
7 |
8 |
9 | 10 |
11 |
12 |
13 |
-------------------------------------------------------------------------------- /WebAPI/WebAPI/Models/ApplicationUserModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace WebAPI.Models 7 | { 8 | public class ApplicationUserModel 9 | { 10 | public string UserName { get; set; } 11 | public string Email { get; set; } 12 | public string Password { get; set; } 13 | public string FullName { get; set; } 14 | 15 | public string Role { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Angular 7/src/app/forbidden/forbidden.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | 6 | 7 |
8 |
9 | 403 - ACCESS DENIED 10 |

You don't have the permission to access this resource.

11 |
12 |
13 |
14 |
-------------------------------------------------------------------------------- /Angular 7/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "es2015", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "target": "es5", 13 | "typeRoots": [ 14 | "node_modules/@types" 15 | ], 16 | "lib": [ 17 | "es2018", 18 | "dom" 19 | ] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/Models/AuthenticationContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | 8 | namespace WebAPI.Models 9 | { 10 | public class AuthenticationContext : IdentityDbContext 11 | { 12 | public AuthenticationContext(DbContextOptions options):base(options) 13 | { 14 | 15 | } 16 | 17 | public DbSet ApplicationUsers { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/WebAPI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.2 5 | InProcess 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Angular 7/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # dependencies 9 | /node_modules 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | 20 | # IDE - VSCode 21 | .vscode/* 22 | !.vscode/settings.json 23 | !.vscode/tasks.json 24 | !.vscode/launch.json 25 | !.vscode/extensions.json 26 | 27 | # misc 28 | /.sass-cache 29 | /connect.lock 30 | /coverage 31 | /libpeerconnection.log 32 | npm-debug.log 33 | yarn-error.log 34 | testem.log 35 | /typings 36 | 37 | # System Files 38 | .DS_Store 39 | Thumbs.db 40 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/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 WebAPI 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | CreateWebHostBuilder(args).Build().Run(); 18 | } 19 | 20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Angular 7/appStructure.txt: -------------------------------------------------------------------------------- 1 | ● src 2 | +---● app 3 | | +--● user 4 | | | |--user.component.ts|.html 5 | | | +--● registration 6 | | | | |--registration.component.ts|.html 7 | | | +--● login 8 | | | |--login.component.ts|.html 9 | | | 10 | | +--● home 11 | | | |--home.component.ts|.html 12 | | +--● admin-panel 13 | | | |--admin-panel.component.ts|.html 14 | | +--● forbidden 15 | | | |--forbidden.component.ts|.html 16 | | | 17 | | +--● shared 18 | | | |--user.service.ts 19 | | | 20 | | +--● auth 21 | | | |--auth.guard.ts 22 | | | |--auth.interceptor.ts 23 | | | 24 | | |--app.module.ts 25 | | |--app-routing.module.ts (route configs.) 26 | | 27 | |--index.html (cdn path for bootstrap) -------------------------------------------------------------------------------- /Angular 7/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /Angular 7/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /Angular 7/src/app/home/home.component.html: -------------------------------------------------------------------------------- 1 | 10 | 11 |
12 |
    13 |
  • Username : {{userDetails.userName}}
  • 14 |
  • FullName : {{userDetails.fullName}}
  • 15 |
  • Email : {{userDetails.email}}
  • 16 |
17 |
-------------------------------------------------------------------------------- /Angular 7/src/app/user/login/login.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 |
7 |
8 | 9 | 10 |
11 |
12 |
13 | 14 |
15 |
16 |
-------------------------------------------------------------------------------- /Angular 7/src/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { UserService } from './../shared/user.service'; 2 | import { Component, OnInit } from '@angular/core'; 3 | import { Router } from '@angular/router'; 4 | 5 | @Component({ 6 | selector: 'app-home', 7 | templateUrl: './home.component.html', 8 | styles: [] 9 | }) 10 | export class HomeComponent implements OnInit { 11 | userDetails; 12 | 13 | constructor(private router: Router, private service: UserService) { } 14 | 15 | ngOnInit() { 16 | this.service.getUserProfile().subscribe( 17 | res => { 18 | this.userDetails = res; 19 | }, 20 | err => { 21 | console.log(err); 22 | }, 23 | ); 24 | } 25 | 26 | 27 | onLogout() { 28 | localStorage.removeItem('token'); 29 | this.router.navigate(['/user/login']); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Angular 7/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './src/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: require('path').join(__dirname, './tsconfig.e2e.json') 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; -------------------------------------------------------------------------------- /WebAPI/WebAPI/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:54277", 8 | "sslPort": 0 9 | } 10 | }, 11 | "profiles": { 12 | "IIS Express": { 13 | "commandName": "IISExpress", 14 | "launchBrowser": true, 15 | "launchUrl": "api/values", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "WebAPI": { 21 | "commandName": "Project", 22 | "launchBrowser": true, 23 | "launchUrl": "api/values", 24 | "applicationUrl": "http://localhost:5000", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /WebAPI/WebAPI/WebAPI.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ApiControllerEmptyScaffolder 5 | root/Controller 6 | 600 7 | True 8 | False 9 | True 10 | 11 | False 12 | 13 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/Debug/netcoreapp2.2/WebAPI.RazorAssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System; 12 | using System.Reflection; 13 | 14 | [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.RelatedAssemblyAttribute("WebAPI.Views")] 15 | [assembly: Microsoft.AspNetCore.Razor.Hosting.RazorLanguageVersionAttribute("2.1")] 16 | [assembly: Microsoft.AspNetCore.Razor.Hosting.RazorConfigurationNameAttribute("MVC-2.1")] 17 | [assembly: Microsoft.AspNetCore.Razor.Hosting.RazorExtensionAssemblyNameAttribute("MVC-2.1", "Microsoft.AspNetCore.Mvc.Razor.Extensions")] 18 | 19 | // Generated by the MSBuild WriteCodeFragment class. 20 | 21 | -------------------------------------------------------------------------------- /Angular 7/src/app/auth/auth.guard.ts: -------------------------------------------------------------------------------- 1 | import { UserService } from './../shared/user.service'; 2 | import { Injectable } from '@angular/core'; 3 | import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router'; 4 | import { Observable } from 'rxjs'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | export class AuthGuard implements CanActivate { 10 | 11 | 12 | constructor(private router: Router,private service : UserService) { 13 | } 14 | canActivate( 15 | next: ActivatedRouteSnapshot, 16 | state: RouterStateSnapshot): boolean { 17 | if (localStorage.getItem('token') != null){ 18 | let roles = next.data['permittedRoles'] as Array; 19 | if(roles){ 20 | if(this.service.roleMatch(roles)) return true; 21 | else{ 22 | this.router.navigate(['/forbidden']); 23 | return false; 24 | } 25 | } 26 | return true; 27 | } 28 | else { 29 | this.router.navigate(['/user/login']); 30 | return false; 31 | } 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Angular 7/src/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../coverage'), 20 | reports: ['html', 'lcovonly'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false 30 | }); 31 | }; -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/Debug/netcoreapp2.2/WebAPI.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System; 12 | using System.Reflection; 13 | 14 | [assembly: System.Reflection.AssemblyCompanyAttribute("WebAPI")] 15 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] 16 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] 17 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] 18 | [assembly: System.Reflection.AssemblyProductAttribute("WebAPI")] 19 | [assembly: System.Reflection.AssemblyTitleAttribute("WebAPI")] 20 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] 21 | 22 | // Generated by the MSBuild WriteCodeFragment class. 23 | 24 | -------------------------------------------------------------------------------- /Angular 7/README.md: -------------------------------------------------------------------------------- 1 | # Angular7 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.0.3. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 28 | -------------------------------------------------------------------------------- /Angular 7/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Angular7 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /WebAPI/WebAPI.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.168 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebAPI", "WebAPI\WebAPI.csproj", "{9C812401-3BB2-46E5-AB30-12C8FFC01AB5}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {9C812401-3BB2-46E5-AB30-12C8FFC01AB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {9C812401-3BB2-46E5-AB30-12C8FFC01AB5}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {9C812401-3BB2-46E5-AB30-12C8FFC01AB5}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {9C812401-3BB2-46E5-AB30-12C8FFC01AB5}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {6AD93BD2-7189-40B5-B58D-D4E5A789B900} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Angular 7/src/app/user/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import { ToastrService } from 'ngx-toastr'; 2 | import { UserService } from './../../shared/user.service'; 3 | import { Component, OnInit } from '@angular/core'; 4 | import { NgForm } from '@angular/forms'; 5 | import { Router } from '@angular/router'; 6 | 7 | @Component({ 8 | selector: 'app-login', 9 | templateUrl: './login.component.html', 10 | styles: [] 11 | }) 12 | export class LoginComponent implements OnInit { 13 | formModel = { 14 | UserName: '', 15 | Password: '' 16 | } 17 | constructor(private service: UserService, private router: Router, private toastr: ToastrService) { } 18 | 19 | ngOnInit() { 20 | if (localStorage.getItem('token') != null) 21 | this.router.navigateByUrl('/home'); 22 | } 23 | 24 | onSubmit(form: NgForm) { 25 | this.service.login(form.value).subscribe( 26 | (res: any) => { 27 | localStorage.setItem('token', res.token); 28 | this.router.navigateByUrl('/home'); 29 | }, 30 | err => { 31 | if (err.status == 400) 32 | this.toastr.error('Incorrect username or password.', 'Authentication failed.'); 33 | else 34 | console.log(err); 35 | } 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Angular 7/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | 5 | describe('AppComponent', () => { 6 | beforeEach(async(() => { 7 | TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | })); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.debugElement.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'Angular7'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.debugElement.componentInstance; 26 | expect(app.title).toEqual('Angular7'); 27 | }); 28 | 29 | it('should render title in a h1 tag', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.debugElement.nativeElement; 33 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to Angular7!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /Angular 7/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { AdminPanelComponent } from './admin-panel/admin-panel.component'; 2 | import { ForbiddenComponent } from './forbidden/forbidden.component'; 3 | import { AuthGuard } from './auth/auth.guard'; 4 | import { NgModule } from '@angular/core'; 5 | import { Routes, RouterModule } from '@angular/router'; 6 | import { UserComponent } from './user/user.component'; 7 | import { RegistrationComponent } from './user/registration/registration.component'; 8 | import { LoginComponent } from './user/login/login.component'; 9 | import { HomeComponent } from './home/home.component'; 10 | 11 | const routes: Routes = [ 12 | {path:'',redirectTo:'/user/login',pathMatch:'full'}, 13 | { 14 | path: 'user', component: UserComponent, 15 | children: [ 16 | { path: 'registration', component: RegistrationComponent }, 17 | { path: 'login', component: LoginComponent } 18 | ] 19 | }, 20 | {path:'home',component:HomeComponent,canActivate:[AuthGuard]}, 21 | {path:'forbidden',component:ForbiddenComponent}, 22 | {path:'adminpanel',component:AdminPanelComponent,canActivate:[AuthGuard],data :{permittedRoles:['Admin']}} 23 | ]; 24 | 25 | @NgModule({ 26 | imports: [RouterModule.forRoot(routes)], 27 | exports: [RouterModule] 28 | }) 29 | export class AppRoutingModule { } 30 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/Controllers/ValuesController.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 WebAPI.Models; 7 | 8 | namespace WebAPI.Controllers 9 | { 10 | [Route("api/[controller]")] 11 | [ApiController] 12 | public class ValuesController : ControllerBase 13 | { 14 | public ValuesController(AuthenticationContext context) 15 | { 16 | 17 | } 18 | 19 | // GET api/values 20 | [HttpGet] 21 | public ActionResult> Get() 22 | { 23 | return new string[] { "value1", "value2" }; 24 | } 25 | 26 | // GET api/values/5 27 | [HttpGet("{id}")] 28 | public ActionResult Get(int id) 29 | { 30 | return "value"; 31 | } 32 | 33 | // POST api/values 34 | [HttpPost] 35 | public void Post([FromBody] string value) 36 | { 37 | } 38 | 39 | // PUT api/values/5 40 | [HttpPut("{id}")] 41 | public void Put(int id, [FromBody] string value) 42 | { 43 | } 44 | 45 | // DELETE api/values/5 46 | [HttpDelete("{id}")] 47 | public void Delete(int id) 48 | { 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Angular 7/src/app/user/registration/registration.component.ts: -------------------------------------------------------------------------------- 1 | import { UserService } from './../../shared/user.service'; 2 | import { Component, OnInit } from '@angular/core'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | 5 | @Component({ 6 | selector: 'app-registration', 7 | templateUrl: './registration.component.html', 8 | styles: [] 9 | }) 10 | export class RegistrationComponent implements OnInit { 11 | 12 | constructor(public service: UserService, private toastr: ToastrService) { } 13 | 14 | ngOnInit() { 15 | this.service.formModel.reset(); 16 | } 17 | 18 | onSubmit() { 19 | this.service.register().subscribe( 20 | (res: any) => { 21 | if (res.succeeded) { 22 | this.service.formModel.reset(); 23 | this.toastr.success('New user created!', 'Registration successful.'); 24 | } else { 25 | res.errors.forEach(element => { 26 | switch (element.code) { 27 | case 'DuplicateUserName': 28 | this.toastr.error('Username is already taken','Registration failed.'); 29 | break; 30 | 31 | default: 32 | this.toastr.error(element.description,'Registration failed.'); 33 | break; 34 | } 35 | }); 36 | } 37 | }, 38 | err => { 39 | console.log(err); 40 | } 41 | ); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /Angular 7/src/app/auth/auth.interceptor.ts: -------------------------------------------------------------------------------- 1 | import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from "@angular/common/http"; 2 | import { Injectable } from "@angular/core"; 3 | import { Observable } from "rxjs"; 4 | import { tap } from "rxjs/operators"; 5 | import { Router } from "@angular/router"; 6 | 7 | @Injectable() 8 | export class AuthInterceptor implements HttpInterceptor { 9 | 10 | constructor(private router: Router) { 11 | 12 | } 13 | 14 | intercept(req: HttpRequest, next: HttpHandler): Observable> { 15 | if (localStorage.getItem('token') != null) { 16 | const clonedReq = req.clone({ 17 | headers: req.headers.set('Authorization', 'Bearer ' + localStorage.getItem('token')) 18 | }); 19 | return next.handle(clonedReq).pipe( 20 | tap( 21 | succ => { }, 22 | err => { 23 | if (err.status == 401){ 24 | localStorage.removeItem('token'); 25 | this.router.navigateByUrl('/user/login'); 26 | } 27 | else if(err.status == 403) 28 | this.router.navigateByUrl('/forbidden'); 29 | } 30 | ) 31 | ) 32 | } 33 | else 34 | return next.handle(req.clone()); 35 | } 36 | } -------------------------------------------------------------------------------- /Angular 7/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular7", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "~7.0.0", 15 | "@angular/common": "~7.0.0", 16 | "@angular/compiler": "~7.0.0", 17 | "@angular/core": "~7.0.0", 18 | "@angular/forms": "~7.0.0", 19 | "@angular/http": "~7.0.0", 20 | "@angular/platform-browser": "~7.0.0", 21 | "@angular/platform-browser-dynamic": "~7.0.0", 22 | "@angular/router": "~7.0.0", 23 | "core-js": "^2.5.4", 24 | "ngx-toastr": "^9.1.1", 25 | "rxjs": "~6.3.3", 26 | "zone.js": "~0.8.26" 27 | }, 28 | "devDependencies": { 29 | "@angular-devkit/build-angular": "~0.10.0", 30 | "@angular/cli": "~7.0.3", 31 | "@angular/compiler-cli": "~7.0.0", 32 | "@angular/language-service": "~7.0.0", 33 | "@types/node": "~8.9.4", 34 | "@types/jasmine": "~2.8.8", 35 | "@types/jasminewd2": "~2.0.3", 36 | "codelyzer": "~4.5.0", 37 | "jasmine-core": "~2.99.1", 38 | "jasmine-spec-reporter": "~4.2.1", 39 | "karma": "~3.0.0", 40 | "karma-chrome-launcher": "~2.2.0", 41 | "karma-coverage-istanbul-reporter": "~2.0.1", 42 | "karma-jasmine": "~1.1.2", 43 | "karma-jasmine-html-reporter": "^0.2.2", 44 | "protractor": "~5.4.0", 45 | "ts-node": "~7.0.0", 46 | "tslint": "~5.11.0", 47 | "typescript": "~3.1.1" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Angular 7/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | import { ReactiveFormsModule, FormsModule } from "@angular/forms"; 4 | import { HttpClientModule, HTTP_INTERCEPTORS } from "@angular/common/http"; 5 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 6 | import { ToastrModule } from 'ngx-toastr'; 7 | 8 | import { AppRoutingModule } from './app-routing.module'; 9 | import { AppComponent } from './app.component'; 10 | import { UserComponent } from './user/user.component'; 11 | import { RegistrationComponent } from './user/registration/registration.component'; 12 | import { UserService } from './shared/user.service'; 13 | import { LoginComponent } from './user/login/login.component'; 14 | import { HomeComponent } from './home/home.component'; 15 | import { AuthInterceptor } from './auth/auth.interceptor'; 16 | import { AdminPanelComponent } from './admin-panel/admin-panel.component'; 17 | import { ForbiddenComponent } from './forbidden/forbidden.component'; 18 | 19 | @NgModule({ 20 | declarations: [ 21 | AppComponent, 22 | UserComponent, 23 | RegistrationComponent, 24 | LoginComponent, 25 | HomeComponent, 26 | AdminPanelComponent, 27 | ForbiddenComponent 28 | ], 29 | imports: [ 30 | BrowserModule, 31 | AppRoutingModule, 32 | ReactiveFormsModule, 33 | HttpClientModule, 34 | BrowserAnimationsModule, 35 | ToastrModule.forRoot({ 36 | progressBar: true 37 | }), 38 | FormsModule 39 | ], 40 | providers: [UserService, { 41 | provide: HTTP_INTERCEPTORS, 42 | useClass: AuthInterceptor, 43 | multi: true 44 | }], 45 | bootstrap: [AppComponent] 46 | }) 47 | export class AppModule { } 48 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/Controllers/UserProfileController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Authorization; 6 | using Microsoft.AspNetCore.Http; 7 | using Microsoft.AspNetCore.Identity; 8 | using Microsoft.AspNetCore.Mvc; 9 | using WebAPI.Models; 10 | 11 | namespace WebAPI.Controllers 12 | { 13 | [Route("api/[controller]")] 14 | [ApiController] 15 | public class UserProfileController : ControllerBase 16 | { 17 | private UserManager _userManager; 18 | public UserProfileController(UserManager userManager) 19 | { 20 | _userManager = userManager; 21 | } 22 | 23 | [HttpGet] 24 | [Authorize] 25 | //GET : /api/UserProfile 26 | public async Task GetUserProfile() { 27 | string userId = User.Claims.First(c => c.Type == "UserID").Value; 28 | var user = await _userManager.FindByIdAsync(userId); 29 | return new 30 | { 31 | user.FullName, 32 | user.Email, 33 | user.UserName 34 | }; 35 | } 36 | 37 | [HttpGet] 38 | [Authorize(Roles ="Admin")] 39 | [Route("ForAdmin")] 40 | public string GetForAdmin() 41 | { 42 | return "Web method for Admin"; 43 | } 44 | 45 | [HttpGet] 46 | [Authorize(Roles = "Customer")] 47 | [Route("ForCustomer")] 48 | public string GetCustomer() 49 | { 50 | return "Web method for Customer"; 51 | } 52 | 53 | [HttpGet] 54 | [Authorize(Roles = "Admin,Customer")] 55 | [Route("ForAdminOrCustomer")] 56 | public string GetForAdminOrCustomer() 57 | { 58 | return "Web method for Admin or Customer"; 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /Angular 7/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | body{ 3 | background-color: #04c582;; 4 | } 5 | 6 | input.form-control,input.form-control:focus{ 7 | background-color: #636b7b; 8 | color: #fff; 9 | border: 1px solid #636b7b; 10 | 11 | } 12 | 13 | input.form-control:focus{ 14 | box-shadow: none; 15 | } 16 | 17 | button[type=submit].btn{ 18 | border-radius: 20px; 19 | background-color: #04c582; 20 | color: #fff; 21 | } 22 | 23 | div.form-group label:not(.text-danger){ 24 | color: #545d6a; 25 | font-weight: 700; 26 | } 27 | 28 | div.form-group.required>label:first-child:after{ 29 | content:'*'; 30 | color: #fff; 31 | padding-left: 5px; 32 | } 33 | 34 | #toast-container > div { 35 | opacity:1; 36 | } 37 | 38 | .wrapper { 39 | display: flex; 40 | align-items: center; 41 | flex-direction: column; 42 | justify-content: center; 43 | width: 100%; 44 | padding: 20px; 45 | } 46 | 47 | .wrapped-div { 48 | -webkit-border-radius: 10px 10px 10px 10px; 49 | border-radius: 10px 10px 10px 10px; 50 | background: #2e3137; 51 | padding: 30px; 52 | width: 90%; 53 | max-width: 450px; 54 | position: relative; 55 | padding: 0px; 56 | -webkit-box-shadow: 0 30px 60px 0 rgba(0,0,0,0.3); 57 | box-shadow: 0 30px 60px 0 rgba(0,0,0,0.3); 58 | } 59 | 60 | /* Tabs */ 61 | .tab-header{ 62 | text-align: center; 63 | } 64 | 65 | .tab-header h2.active { 66 | color: #fff; 67 | border-bottom: 4px solid #fff; 68 | } 69 | 70 | .tab-header h2 { 71 | text-align: center; 72 | font-size: 18px; 73 | font-weight: 600; 74 | display:inline-block; 75 | padding: 30px 40px 10px 40px; 76 | cursor: pointer; 77 | color: #545d6a; 78 | border-bottom: 2px solid #545d6a; 79 | } 80 | 81 | .tab-header h2:focus { 82 | outline: none; 83 | } 84 | 85 | form{ 86 | margin: 0px 16px; 87 | } 88 | 89 | div.form-group input.invalid{ 90 | border: 1px solid #dc3545; 91 | } 92 | div.form-group label:first-child{ 93 | text-transform: uppercase; 94 | font-size: 0.9rem; 95 | } 96 | -------------------------------------------------------------------------------- /Angular 7/src/app/shared/user.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { FormBuilder, Validators, FormGroup } from '@angular/forms'; 3 | import { HttpClient, HttpHeaders } from "@angular/common/http"; 4 | 5 | @Injectable({ 6 | providedIn: 'root' 7 | }) 8 | export class UserService { 9 | 10 | constructor(private fb: FormBuilder, private http: HttpClient) { } 11 | readonly BaseURI = 'http://localhost:54277/api'; 12 | 13 | formModel = this.fb.group({ 14 | UserName: ['', Validators.required], 15 | Email: ['', Validators.email], 16 | FullName: [''], 17 | Passwords: this.fb.group({ 18 | Password: ['', [Validators.required, Validators.minLength(4)]], 19 | ConfirmPassword: ['', Validators.required] 20 | }, { validator: this.comparePasswords }) 21 | 22 | }); 23 | 24 | comparePasswords(fb: FormGroup) { 25 | let confirmPswrdCtrl = fb.get('ConfirmPassword'); 26 | //passwordMismatch 27 | //confirmPswrdCtrl.errors={passwordMismatch:true} 28 | if (confirmPswrdCtrl.errors == null || 'passwordMismatch' in confirmPswrdCtrl.errors) { 29 | if (fb.get('Password').value != confirmPswrdCtrl.value) 30 | confirmPswrdCtrl.setErrors({ passwordMismatch: true }); 31 | else 32 | confirmPswrdCtrl.setErrors(null); 33 | } 34 | } 35 | 36 | register() { 37 | var body = { 38 | UserName: this.formModel.value.UserName, 39 | Email: this.formModel.value.Email, 40 | FullName: this.formModel.value.FullName, 41 | Password: this.formModel.value.Passwords.Password 42 | }; 43 | return this.http.post(this.BaseURI + '/ApplicationUser/Register', body); 44 | } 45 | 46 | login(formData) { 47 | return this.http.post(this.BaseURI + '/ApplicationUser/Login', formData); 48 | } 49 | 50 | getUserProfile() { 51 | return this.http.get(this.BaseURI + '/UserProfile'); 52 | } 53 | 54 | roleMatch(allowedRoles): boolean { 55 | var isMatch = false; 56 | var payLoad = JSON.parse(window.atob(localStorage.getItem('token').split('.')[1])); 57 | var userRole = payLoad.role; 58 | allowedRoles.forEach(element => { 59 | if (userRole == element) { 60 | isMatch = true; 61 | return false; 62 | } 63 | }); 64 | return isMatch; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Angular 7/src/app/user/registration/registration.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 | 7 |
8 |
9 | 10 | 11 | 13 |
14 |
15 | 16 | 17 |
18 |
19 |
20 | 21 | 22 | 24 | 26 |
27 |
28 | 29 | 30 | 32 | 34 |
35 |
36 |
37 |
38 | 39 |
40 |
41 |
-------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Asp.Net.Core Web-API Role Based Authorization in Angular 7 with Identity Role 2 | 3 | Implements role based authorization with Angular 7 and Asp.Net core web API using Identity role. 4 | 5 | Content discussed : 6 | - Role based authorization in Asp.Net Core Web API. 7 | - Add role to user in Asp.Net Identity 8 | - Angular 7 role based authorization with guard and interceptor 9 | - Create private routes in Angular 7 10 | - How to handle 403 status code in angular 7 11 | 12 | ## Get the Code 13 | 14 | ``` 15 | $ git clone https://github.com/CodAffection/Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role.git 16 | $ cd Asp.Net-Core-Web-API---Role-Based-Authorization-in-Angular-7-with-Identity-Role/Angular 7 17 | $ npm install 18 | //run the app 19 | $ ng serve 20 | //update Web API DB connection string 21 | ``` 22 | 23 | ## How it works ? 24 | 25 | :tv: Video tutorial on this same topic 26 | Url : https://youtu.be/MGCC2zTb0t4 27 | 28 | Video Tutorial for Role based authorization in Asp.net Core and Angular 7 31 | 32 | 33 | | :bar_chart: | List of Tutorials | | :moneybag: | Support Us | 34 | |--------------------------:|:---------------------|---|---------------------:|:-------------------------------------| 35 | | Angular |http://bit.ly/2KQN9xF | |Paypal | https://goo.gl/bPcyXW | 36 | | Asp.Net Core |http://bit.ly/30fPDMg | |Amazon Affiliate | https://geni.us/JDzpE | 37 | | React |http://bit.ly/325temF | | 38 | | Python |http://bit.ly/2ws4utg | | :point_right: | Follow Us | 39 | | Node.js |https://goo.gl/viJcFs | |Website |http://www.codaffection.com | 40 | | Asp.Net MVC |https://goo.gl/gvjUJ7 | |YouTube |https://www.youtube.com/codaffection | 41 | | Flutter |https://bit.ly/3ggmmJz| |Facebook |https://www.facebook.com/codaffection | 42 | | Web API |https://goo.gl/itVayJ | |Twitter |https://twitter.com/CodAffection | 43 | | MEAN Stack |https://goo.gl/YJPPAH | | 44 | | C# Tutorial |https://goo.gl/s1zJxo | | 45 | | Asp.Net WebForm |https://goo.gl/GXC2aJ | | 46 | | C# WinForm |https://goo.gl/vHS9Hd | | 47 | | MS SQL |https://goo.gl/MLYS9e | | 48 | | Crystal Report |https://goo.gl/5Vou7t | | 49 | | CG Exercises in C Program |https://goo.gl/qEWJCs | | 50 | -------------------------------------------------------------------------------- /Angular 7/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": true, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-blacklist": [ 20 | true, 21 | "rxjs/Rx" 22 | ], 23 | "import-spacing": true, 24 | "indent": [ 25 | true, 26 | "spaces" 27 | ], 28 | "interface-over-type-literal": true, 29 | "label-position": true, 30 | "max-line-length": [ 31 | true, 32 | 140 33 | ], 34 | "member-access": false, 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-arg": true, 47 | "no-bitwise": true, 48 | "no-console": [ 49 | true, 50 | "debug", 51 | "info", 52 | "time", 53 | "timeEnd", 54 | "trace" 55 | ], 56 | "no-construct": true, 57 | "no-debugger": true, 58 | "no-duplicate-super": true, 59 | "no-empty": false, 60 | "no-empty-interface": true, 61 | "no-eval": true, 62 | "no-inferrable-types": [ 63 | true, 64 | "ignore-params" 65 | ], 66 | "no-misused-new": true, 67 | "no-non-null-assertion": true, 68 | "no-redundant-jsdoc": true, 69 | "no-shadowed-variable": true, 70 | "no-string-literal": false, 71 | "no-string-throw": true, 72 | "no-switch-case-fall-through": true, 73 | "no-trailing-whitespace": true, 74 | "no-unnecessary-initializer": true, 75 | "no-unused-expression": true, 76 | "no-use-before-declare": true, 77 | "no-var-keyword": true, 78 | "object-literal-sort-keys": false, 79 | "one-line": [ 80 | true, 81 | "check-open-brace", 82 | "check-catch", 83 | "check-else", 84 | "check-whitespace" 85 | ], 86 | "prefer-const": true, 87 | "quotemark": [ 88 | true, 89 | "single" 90 | ], 91 | "radix": true, 92 | "semicolon": [ 93 | true, 94 | "always" 95 | ], 96 | "triple-equals": [ 97 | true, 98 | "allow-null-check" 99 | ], 100 | "typedef-whitespace": [ 101 | true, 102 | { 103 | "call-signature": "nospace", 104 | "index-signature": "nospace", 105 | "parameter": "nospace", 106 | "property-declaration": "nospace", 107 | "variable-declaration": "nospace" 108 | } 109 | ], 110 | "unified-signatures": true, 111 | "variable-name": false, 112 | "whitespace": [ 113 | true, 114 | "check-branch", 115 | "check-decl", 116 | "check-operator", 117 | "check-separator", 118 | "check-type" 119 | ], 120 | "no-output-on-prefix": true, 121 | "use-input-property-decorator": true, 122 | "use-output-property-decorator": true, 123 | "use-host-property-decorator": true, 124 | "no-input-rename": true, 125 | "no-output-rename": true, 126 | "use-life-cycle-interface": true, 127 | "use-pipe-transform-interface": true, 128 | "component-class-suffix": true, 129 | "directive-class-suffix": true 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /Angular 7/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 22 | // import 'core-js/es6/symbol'; 23 | // import 'core-js/es6/object'; 24 | // import 'core-js/es6/function'; 25 | // import 'core-js/es6/parse-int'; 26 | // import 'core-js/es6/parse-float'; 27 | // import 'core-js/es6/number'; 28 | // import 'core-js/es6/math'; 29 | // import 'core-js/es6/string'; 30 | // import 'core-js/es6/date'; 31 | // import 'core-js/es6/array'; 32 | // import 'core-js/es6/regexp'; 33 | // import 'core-js/es6/map'; 34 | // import 'core-js/es6/weak-map'; 35 | // import 'core-js/es6/set'; 36 | 37 | /** 38 | * If the application will be indexed by Google Search, the following is required. 39 | * Googlebot uses a renderer based on Chrome 41. 40 | * https://developers.google.com/search/docs/guides/rendering 41 | **/ 42 | // import 'core-js/es6/array'; 43 | 44 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 45 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 46 | 47 | /** IE10 and IE11 requires the following for the Reflect API. */ 48 | // import 'core-js/es6/reflect'; 49 | 50 | /** 51 | * Web Animations `@angular/platform-browser/animations` 52 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 53 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 54 | **/ 55 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 56 | 57 | /** 58 | * By default, zone.js will patch all possible macroTask and DomEvents 59 | * user can disable parts of macroTask/DomEvents patch by setting following flags 60 | */ 61 | 62 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 63 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 64 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 65 | 66 | /* 67 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 68 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 69 | */ 70 | // (window as any).__Zone_enable_cross_context_check = true; 71 | 72 | /*************************************************************************************************** 73 | * Zone JS is required by default for Angular itself. 74 | */ 75 | import 'zone.js/dist/zone'; // Included with Angular CLI. 76 | 77 | 78 | /*************************************************************************************************** 79 | * APPLICATION IMPORTS 80 | */ 81 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/WebAPI.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/Controllers/ApplicationUserController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IdentityModel.Tokens.Jwt; 4 | using System.Linq; 5 | using System.Security.Claims; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using Microsoft.AspNetCore.Http; 9 | using Microsoft.AspNetCore.Identity; 10 | using Microsoft.AspNetCore.Mvc; 11 | using Microsoft.Extensions.Options; 12 | using Microsoft.IdentityModel.Tokens; 13 | using WebAPI.Models; 14 | 15 | namespace WebAPI.Controllers 16 | { 17 | [Route("api/[controller]")] 18 | [ApiController] 19 | public class ApplicationUserController : ControllerBase 20 | { 21 | private UserManager _userManager; 22 | private SignInManager _singInManager; 23 | private readonly ApplicationSettings _appSettings; 24 | 25 | public ApplicationUserController(UserManager userManager, SignInManager signInManager,IOptions appSettings) 26 | { 27 | _userManager = userManager; 28 | _singInManager = signInManager; 29 | _appSettings = appSettings.Value; 30 | } 31 | 32 | [HttpPost] 33 | [Route("Register")] 34 | //POST : /api/ApplicationUser/Register 35 | public async Task PostApplicationUser(ApplicationUserModel model) 36 | { 37 | model.Role = "Admin"; 38 | var applicationUser = new ApplicationUser() { 39 | UserName = model.UserName, 40 | Email = model.Email, 41 | FullName = model.FullName 42 | }; 43 | 44 | try 45 | { 46 | var result = await _userManager.CreateAsync(applicationUser, model.Password); 47 | await _userManager.AddToRoleAsync(applicationUser, model.Role); 48 | return Ok(result); 49 | } 50 | catch (Exception ex) 51 | { 52 | 53 | throw ex; 54 | } 55 | } 56 | 57 | [HttpPost] 58 | [Route("Login")] 59 | //POST : /api/ApplicationUser/Login 60 | public async Task Login(LoginModel model) 61 | { 62 | var user = await _userManager.FindByNameAsync(model.UserName); 63 | if (user != null && await _userManager.CheckPasswordAsync(user, model.Password)) 64 | { 65 | //Get role assigned to the user 66 | var role = await _userManager.GetRolesAsync(user); 67 | IdentityOptions _options = new IdentityOptions(); 68 | 69 | var tokenDescriptor = new SecurityTokenDescriptor 70 | { 71 | Subject = new ClaimsIdentity(new Claim[] 72 | { 73 | new Claim("UserID",user.Id.ToString()), 74 | new Claim(_options.ClaimsIdentity.RoleClaimType,role.FirstOrDefault()) 75 | }), 76 | Expires = DateTime.UtcNow.AddDays(1), 77 | SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_appSettings.JWT_Secret)), SecurityAlgorithms.HmacSha256Signature) 78 | }; 79 | var tokenHandler = new JwtSecurityTokenHandler(); 80 | var securityToken = tokenHandler.CreateToken(tokenDescriptor); 81 | var token = tokenHandler.WriteToken(securityToken); 82 | return Ok(new { token }); 83 | } 84 | else 85 | return BadRequest(new { message = "Username or password is incorrect." }); 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /WebAPI/WebAPI/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Authentication.JwtBearer; 7 | using Microsoft.AspNetCore.Builder; 8 | using Microsoft.AspNetCore.Hosting; 9 | using Microsoft.AspNetCore.Identity; 10 | using Microsoft.AspNetCore.Mvc; 11 | using Microsoft.EntityFrameworkCore; 12 | using Microsoft.Extensions.Configuration; 13 | using Microsoft.Extensions.DependencyInjection; 14 | using Microsoft.Extensions.Logging; 15 | using Microsoft.Extensions.Options; 16 | using Microsoft.IdentityModel.Tokens; 17 | using WebAPI.Models; 18 | 19 | namespace WebAPI 20 | { 21 | public class Startup 22 | { 23 | public Startup(IConfiguration configuration) 24 | { 25 | Configuration = configuration; 26 | } 27 | 28 | public IConfiguration Configuration { get; } 29 | 30 | // This method gets called by the runtime. Use this method to add services to the container. 31 | public void ConfigureServices(IServiceCollection services) 32 | { 33 | //Inject AppSettings 34 | services.Configure(Configuration.GetSection("ApplicationSettings")); 35 | 36 | services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); 37 | 38 | services.AddDbContext(options => 39 | options.UseSqlServer(Configuration.GetConnectionString("IdentityConnection"))); 40 | 41 | services.AddDefaultIdentity() 42 | .AddRoles() 43 | .AddEntityFrameworkStores(); 44 | 45 | services.Configure(options => 46 | { 47 | options.Password.RequireDigit = false; 48 | options.Password.RequireNonAlphanumeric = false; 49 | options.Password.RequireLowercase = false; 50 | options.Password.RequireUppercase = false; 51 | options.Password.RequiredLength = 4; 52 | } 53 | ); 54 | 55 | services.AddCors(); 56 | 57 | //Jwt Authentication 58 | 59 | var key = Encoding.UTF8.GetBytes(Configuration["ApplicationSettings:JWT_Secret"].ToString()); 60 | 61 | services.AddAuthentication(x => 62 | { 63 | x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; 64 | x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; 65 | x.DefaultScheme = JwtBearerDefaults.AuthenticationScheme; 66 | }).AddJwtBearer(x=> { 67 | x.RequireHttpsMetadata = false; 68 | x.SaveToken = false; 69 | x.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters 70 | { 71 | ValidateIssuerSigningKey = true, 72 | IssuerSigningKey = new SymmetricSecurityKey(key), 73 | ValidateIssuer = false, 74 | ValidateAudience = false, 75 | ClockSkew = TimeSpan.Zero 76 | }; 77 | }); 78 | } 79 | 80 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 81 | public void Configure(IApplicationBuilder app, IHostingEnvironment env) 82 | { 83 | 84 | app.Use(async (ctx, next) => 85 | { 86 | await next(); 87 | if (ctx.Response.StatusCode == 204) 88 | { 89 | ctx.Response.ContentLength = 0; 90 | } 91 | }); 92 | 93 | if (env.IsDevelopment()) 94 | { 95 | app.UseDeveloperExceptionPage(); 96 | } 97 | 98 | app.UseCors(builder => 99 | builder.WithOrigins(Configuration["ApplicationSettings:Client_URL"].ToString()) 100 | .AllowAnyHeader() 101 | .AllowAnyMethod() 102 | 103 | ); 104 | 105 | app.UseAuthentication(); 106 | 107 | app.UseMvc(); 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /Angular 7/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "Angular7": { 7 | "root": "", 8 | "sourceRoot": "src", 9 | "projectType": "application", 10 | "prefix": "app", 11 | "schematics": {}, 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:browser", 15 | "options": { 16 | "outputPath": "dist/Angular7", 17 | "index": "src/index.html", 18 | "main": "src/main.ts", 19 | "polyfills": "src/polyfills.ts", 20 | "tsConfig": "src/tsconfig.app.json", 21 | "assets": [ 22 | "src/favicon.ico", 23 | "src/assets" 24 | ], 25 | "styles": [ 26 | "src/styles.css", 27 | "node_modules/ngx-toastr/toastr.css" 28 | ], 29 | "scripts": [] 30 | }, 31 | "configurations": { 32 | "production": { 33 | "fileReplacements": [ 34 | { 35 | "replace": "src/environments/environment.ts", 36 | "with": "src/environments/environment.prod.ts" 37 | } 38 | ], 39 | "optimization": true, 40 | "outputHashing": "all", 41 | "sourceMap": false, 42 | "extractCss": true, 43 | "namedChunks": false, 44 | "aot": true, 45 | "extractLicenses": true, 46 | "vendorChunk": false, 47 | "buildOptimizer": true, 48 | "budgets": [ 49 | { 50 | "type": "initial", 51 | "maximumWarning": "2mb", 52 | "maximumError": "5mb" 53 | } 54 | ] 55 | } 56 | } 57 | }, 58 | "serve": { 59 | "builder": "@angular-devkit/build-angular:dev-server", 60 | "options": { 61 | "browserTarget": "Angular7:build" 62 | }, 63 | "configurations": { 64 | "production": { 65 | "browserTarget": "Angular7:build:production" 66 | } 67 | } 68 | }, 69 | "extract-i18n": { 70 | "builder": "@angular-devkit/build-angular:extract-i18n", 71 | "options": { 72 | "browserTarget": "Angular7:build" 73 | } 74 | }, 75 | "test": { 76 | "builder": "@angular-devkit/build-angular:karma", 77 | "options": { 78 | "main": "src/test.ts", 79 | "polyfills": "src/polyfills.ts", 80 | "tsConfig": "src/tsconfig.spec.json", 81 | "karmaConfig": "src/karma.conf.js", 82 | "styles": [ 83 | "src/styles.css" 84 | ], 85 | "scripts": [], 86 | "assets": [ 87 | "src/favicon.ico", 88 | "src/assets" 89 | ] 90 | } 91 | }, 92 | "lint": { 93 | "builder": "@angular-devkit/build-angular:tslint", 94 | "options": { 95 | "tsConfig": [ 96 | "src/tsconfig.app.json", 97 | "src/tsconfig.spec.json" 98 | ], 99 | "exclude": [ 100 | "**/node_modules/**" 101 | ] 102 | } 103 | } 104 | } 105 | }, 106 | "Angular7-e2e": { 107 | "root": "e2e/", 108 | "projectType": "application", 109 | "prefix": "", 110 | "architect": { 111 | "e2e": { 112 | "builder": "@angular-devkit/build-angular:protractor", 113 | "options": { 114 | "protractorConfig": "e2e/protractor.conf.js", 115 | "devServerTarget": "Angular7:serve" 116 | }, 117 | "configurations": { 118 | "production": { 119 | "devServerTarget": "Angular7:serve:production" 120 | } 121 | } 122 | }, 123 | "lint": { 124 | "builder": "@angular-devkit/build-angular:tslint", 125 | "options": { 126 | "tsConfig": "e2e/tsconfig.e2e.json", 127 | "exclude": [ 128 | "**/node_modules/**" 129 | ] 130 | } 131 | } 132 | } 133 | } 134 | }, 135 | "defaultProject": "Angular7" 136 | } -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/WebAPI.csproj.nuget.g.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | True 5 | NuGet 6 | F:\profession\CodAffection\Asp.Net Core\Role Authorization - API and Angular 7\project\WebAPI\WebAPI\obj\project.assets.json 7 | $(UserProfile)\.nuget\packages\ 8 | C:\Users\Shamseer\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder 9 | PackageReference 10 | 4.9.2 11 | 12 | 13 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.codeanalysis.analyzers\1.1.0 26 | C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.entityframeworkcore.tools\2.2.0 27 | C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.razor.design\2.2.0 28 | 29 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/obj/Debug/netcoreapp2.2/WebAPI.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | F:\profession\CodAffection\Asp.Net Core\User Registration - API and Angular 7\project\WebAPI\WebAPI\bin\Debug\netcoreapp2.2\WebAPI.deps.json 2 | F:\profession\CodAffection\Asp.Net Core\User Registration - API and Angular 7\project\WebAPI\WebAPI\bin\Debug\netcoreapp2.2\WebAPI.runtimeconfig.json 3 | F:\profession\CodAffection\Asp.Net Core\User Registration - API and Angular 7\project\WebAPI\WebAPI\bin\Debug\netcoreapp2.2\WebAPI.runtimeconfig.dev.json 4 | F:\profession\CodAffection\Asp.Net Core\User Registration - API and Angular 7\project\WebAPI\WebAPI\bin\Debug\netcoreapp2.2\WebAPI.dll 5 | F:\profession\CodAffection\Asp.Net Core\User Registration - API and Angular 7\project\WebAPI\WebAPI\bin\Debug\netcoreapp2.2\WebAPI.pdb 6 | F:\profession\CodAffection\Asp.Net Core\User Registration - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.csprojAssemblyReference.cache 7 | F:\profession\CodAffection\Asp.Net Core\User Registration - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.csproj.CoreCompileInputs.cache 8 | F:\profession\CodAffection\Asp.Net Core\User Registration - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.RazorAssemblyInfo.cache 9 | F:\profession\CodAffection\Asp.Net Core\User Registration - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.RazorAssemblyInfo.cs 10 | F:\profession\CodAffection\Asp.Net Core\User Registration - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.AssemblyInfoInputs.cache 11 | F:\profession\CodAffection\Asp.Net Core\User Registration - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.AssemblyInfo.cs 12 | F:\profession\CodAffection\Asp.Net Core\User Registration - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.RazorTargetAssemblyInfo.cache 13 | F:\profession\CodAffection\Asp.Net Core\User Registration - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.dll 14 | F:\profession\CodAffection\Asp.Net Core\User Registration - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.pdb 15 | F:\profession\CodAffection\Asp.Net Core\JWT Auth with API and Angular 7\project\WebAPI\WebAPI\bin\Debug\netcoreapp2.2\WebAPI.deps.json 16 | F:\profession\CodAffection\Asp.Net Core\JWT Auth with API and Angular 7\project\WebAPI\WebAPI\bin\Debug\netcoreapp2.2\WebAPI.runtimeconfig.json 17 | F:\profession\CodAffection\Asp.Net Core\JWT Auth with API and Angular 7\project\WebAPI\WebAPI\bin\Debug\netcoreapp2.2\WebAPI.runtimeconfig.dev.json 18 | F:\profession\CodAffection\Asp.Net Core\JWT Auth with API and Angular 7\project\WebAPI\WebAPI\bin\Debug\netcoreapp2.2\WebAPI.dll 19 | F:\profession\CodAffection\Asp.Net Core\JWT Auth with API and Angular 7\project\WebAPI\WebAPI\bin\Debug\netcoreapp2.2\WebAPI.pdb 20 | F:\profession\CodAffection\Asp.Net Core\JWT Auth with API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.csprojAssemblyReference.cache 21 | F:\profession\CodAffection\Asp.Net Core\JWT Auth with API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.csproj.CoreCompileInputs.cache 22 | F:\profession\CodAffection\Asp.Net Core\JWT Auth with API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.RazorAssemblyInfo.cache 23 | F:\profession\CodAffection\Asp.Net Core\JWT Auth with API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.RazorAssemblyInfo.cs 24 | F:\profession\CodAffection\Asp.Net Core\JWT Auth with API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.AssemblyInfoInputs.cache 25 | F:\profession\CodAffection\Asp.Net Core\JWT Auth with API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.AssemblyInfo.cs 26 | F:\profession\CodAffection\Asp.Net Core\JWT Auth with API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.RazorTargetAssemblyInfo.cache 27 | F:\profession\CodAffection\Asp.Net Core\JWT Auth with API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.dll 28 | F:\profession\CodAffection\Asp.Net Core\JWT Auth with API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.pdb 29 | F:\profession\CodAffection\Asp.Net Core\Role Authorization - API and Angular 7\project\WebAPI\WebAPI\bin\Debug\netcoreapp2.2\WebAPI.deps.json 30 | F:\profession\CodAffection\Asp.Net Core\Role Authorization - API and Angular 7\project\WebAPI\WebAPI\bin\Debug\netcoreapp2.2\WebAPI.runtimeconfig.json 31 | F:\profession\CodAffection\Asp.Net Core\Role Authorization - API and Angular 7\project\WebAPI\WebAPI\bin\Debug\netcoreapp2.2\WebAPI.runtimeconfig.dev.json 32 | F:\profession\CodAffection\Asp.Net Core\Role Authorization - API and Angular 7\project\WebAPI\WebAPI\bin\Debug\netcoreapp2.2\WebAPI.dll 33 | F:\profession\CodAffection\Asp.Net Core\Role Authorization - API and Angular 7\project\WebAPI\WebAPI\bin\Debug\netcoreapp2.2\WebAPI.pdb 34 | F:\profession\CodAffection\Asp.Net Core\Role Authorization - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.csprojAssemblyReference.cache 35 | F:\profession\CodAffection\Asp.Net Core\Role Authorization - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.csproj.CoreCompileInputs.cache 36 | F:\profession\CodAffection\Asp.Net Core\Role Authorization - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.RazorAssemblyInfo.cache 37 | F:\profession\CodAffection\Asp.Net Core\Role Authorization - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.RazorAssemblyInfo.cs 38 | F:\profession\CodAffection\Asp.Net Core\Role Authorization - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.AssemblyInfoInputs.cache 39 | F:\profession\CodAffection\Asp.Net Core\Role Authorization - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.AssemblyInfo.cs 40 | F:\profession\CodAffection\Asp.Net Core\Role Authorization - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.RazorTargetAssemblyInfo.cache 41 | F:\profession\CodAffection\Asp.Net Core\Role Authorization - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.dll 42 | F:\profession\CodAffection\Asp.Net Core\Role Authorization - API and Angular 7\project\WebAPI\WebAPI\obj\Debug\netcoreapp2.2\WebAPI.pdb 43 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/Migrations/AuthenticationContextModelSnapshot.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Metadata; 6 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 7 | using WebAPI.Models; 8 | 9 | namespace WebAPI.Migrations 10 | { 11 | [DbContext(typeof(AuthenticationContext))] 12 | partial class AuthenticationContextModelSnapshot : ModelSnapshot 13 | { 14 | protected override void BuildModel(ModelBuilder modelBuilder) 15 | { 16 | #pragma warning disable 612, 618 17 | modelBuilder 18 | .HasAnnotation("ProductVersion", "2.2.0-rtm-35687") 19 | .HasAnnotation("Relational:MaxIdentifierLength", 128) 20 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 21 | 22 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => 23 | { 24 | b.Property("Id") 25 | .ValueGeneratedOnAdd(); 26 | 27 | b.Property("ConcurrencyStamp") 28 | .IsConcurrencyToken(); 29 | 30 | b.Property("Name") 31 | .HasMaxLength(256); 32 | 33 | b.Property("NormalizedName") 34 | .HasMaxLength(256); 35 | 36 | b.HasKey("Id"); 37 | 38 | b.HasIndex("NormalizedName") 39 | .IsUnique() 40 | .HasName("RoleNameIndex") 41 | .HasFilter("[NormalizedName] IS NOT NULL"); 42 | 43 | b.ToTable("AspNetRoles"); 44 | }); 45 | 46 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => 47 | { 48 | b.Property("Id") 49 | .ValueGeneratedOnAdd() 50 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 51 | 52 | b.Property("ClaimType"); 53 | 54 | b.Property("ClaimValue"); 55 | 56 | b.Property("RoleId") 57 | .IsRequired(); 58 | 59 | b.HasKey("Id"); 60 | 61 | b.HasIndex("RoleId"); 62 | 63 | b.ToTable("AspNetRoleClaims"); 64 | }); 65 | 66 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => 67 | { 68 | b.Property("Id") 69 | .ValueGeneratedOnAdd(); 70 | 71 | b.Property("AccessFailedCount"); 72 | 73 | b.Property("ConcurrencyStamp") 74 | .IsConcurrencyToken(); 75 | 76 | b.Property("Discriminator") 77 | .IsRequired(); 78 | 79 | b.Property("Email") 80 | .HasMaxLength(256); 81 | 82 | b.Property("EmailConfirmed"); 83 | 84 | b.Property("LockoutEnabled"); 85 | 86 | b.Property("LockoutEnd"); 87 | 88 | b.Property("NormalizedEmail") 89 | .HasMaxLength(256); 90 | 91 | b.Property("NormalizedUserName") 92 | .HasMaxLength(256); 93 | 94 | b.Property("PasswordHash"); 95 | 96 | b.Property("PhoneNumber"); 97 | 98 | b.Property("PhoneNumberConfirmed"); 99 | 100 | b.Property("SecurityStamp"); 101 | 102 | b.Property("TwoFactorEnabled"); 103 | 104 | b.Property("UserName") 105 | .HasMaxLength(256); 106 | 107 | b.HasKey("Id"); 108 | 109 | b.HasIndex("NormalizedEmail") 110 | .HasName("EmailIndex"); 111 | 112 | b.HasIndex("NormalizedUserName") 113 | .IsUnique() 114 | .HasName("UserNameIndex") 115 | .HasFilter("[NormalizedUserName] IS NOT NULL"); 116 | 117 | b.ToTable("AspNetUsers"); 118 | 119 | b.HasDiscriminator("Discriminator").HasValue("IdentityUser"); 120 | }); 121 | 122 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => 123 | { 124 | b.Property("Id") 125 | .ValueGeneratedOnAdd() 126 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 127 | 128 | b.Property("ClaimType"); 129 | 130 | b.Property("ClaimValue"); 131 | 132 | b.Property("UserId") 133 | .IsRequired(); 134 | 135 | b.HasKey("Id"); 136 | 137 | b.HasIndex("UserId"); 138 | 139 | b.ToTable("AspNetUserClaims"); 140 | }); 141 | 142 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => 143 | { 144 | b.Property("LoginProvider") 145 | .HasMaxLength(128); 146 | 147 | b.Property("ProviderKey") 148 | .HasMaxLength(128); 149 | 150 | b.Property("ProviderDisplayName"); 151 | 152 | b.Property("UserId") 153 | .IsRequired(); 154 | 155 | b.HasKey("LoginProvider", "ProviderKey"); 156 | 157 | b.HasIndex("UserId"); 158 | 159 | b.ToTable("AspNetUserLogins"); 160 | }); 161 | 162 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => 163 | { 164 | b.Property("UserId"); 165 | 166 | b.Property("RoleId"); 167 | 168 | b.HasKey("UserId", "RoleId"); 169 | 170 | b.HasIndex("RoleId"); 171 | 172 | b.ToTable("AspNetUserRoles"); 173 | }); 174 | 175 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => 176 | { 177 | b.Property("UserId"); 178 | 179 | b.Property("LoginProvider") 180 | .HasMaxLength(128); 181 | 182 | b.Property("Name") 183 | .HasMaxLength(128); 184 | 185 | b.Property("Value"); 186 | 187 | b.HasKey("UserId", "LoginProvider", "Name"); 188 | 189 | b.ToTable("AspNetUserTokens"); 190 | }); 191 | 192 | modelBuilder.Entity("WebAPI.Models.ApplicationUser", b => 193 | { 194 | b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); 195 | 196 | b.Property("FullName") 197 | .HasColumnType("nvarchar(150)"); 198 | 199 | b.HasDiscriminator().HasValue("ApplicationUser"); 200 | }); 201 | 202 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => 203 | { 204 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") 205 | .WithMany() 206 | .HasForeignKey("RoleId") 207 | .OnDelete(DeleteBehavior.Cascade); 208 | }); 209 | 210 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => 211 | { 212 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") 213 | .WithMany() 214 | .HasForeignKey("UserId") 215 | .OnDelete(DeleteBehavior.Cascade); 216 | }); 217 | 218 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => 219 | { 220 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") 221 | .WithMany() 222 | .HasForeignKey("UserId") 223 | .OnDelete(DeleteBehavior.Cascade); 224 | }); 225 | 226 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => 227 | { 228 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") 229 | .WithMany() 230 | .HasForeignKey("RoleId") 231 | .OnDelete(DeleteBehavior.Cascade); 232 | 233 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") 234 | .WithMany() 235 | .HasForeignKey("UserId") 236 | .OnDelete(DeleteBehavior.Cascade); 237 | }); 238 | 239 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => 240 | { 241 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") 242 | .WithMany() 243 | .HasForeignKey("UserId") 244 | .OnDelete(DeleteBehavior.Cascade); 245 | }); 246 | #pragma warning restore 612, 618 247 | } 248 | } 249 | } 250 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/Migrations/20190124045416_InitialCreate.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Metadata; 6 | using Microsoft.EntityFrameworkCore.Migrations; 7 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 8 | using WebAPI.Models; 9 | 10 | namespace WebAPI.Migrations 11 | { 12 | [DbContext(typeof(AuthenticationContext))] 13 | [Migration("20190124045416_InitialCreate")] 14 | partial class InitialCreate 15 | { 16 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .HasAnnotation("ProductVersion", "2.2.0-rtm-35687") 21 | .HasAnnotation("Relational:MaxIdentifierLength", 128) 22 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 23 | 24 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => 25 | { 26 | b.Property("Id") 27 | .ValueGeneratedOnAdd(); 28 | 29 | b.Property("ConcurrencyStamp") 30 | .IsConcurrencyToken(); 31 | 32 | b.Property("Name") 33 | .HasMaxLength(256); 34 | 35 | b.Property("NormalizedName") 36 | .HasMaxLength(256); 37 | 38 | b.HasKey("Id"); 39 | 40 | b.HasIndex("NormalizedName") 41 | .IsUnique() 42 | .HasName("RoleNameIndex") 43 | .HasFilter("[NormalizedName] IS NOT NULL"); 44 | 45 | b.ToTable("AspNetRoles"); 46 | }); 47 | 48 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => 49 | { 50 | b.Property("Id") 51 | .ValueGeneratedOnAdd() 52 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 53 | 54 | b.Property("ClaimType"); 55 | 56 | b.Property("ClaimValue"); 57 | 58 | b.Property("RoleId") 59 | .IsRequired(); 60 | 61 | b.HasKey("Id"); 62 | 63 | b.HasIndex("RoleId"); 64 | 65 | b.ToTable("AspNetRoleClaims"); 66 | }); 67 | 68 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => 69 | { 70 | b.Property("Id") 71 | .ValueGeneratedOnAdd(); 72 | 73 | b.Property("AccessFailedCount"); 74 | 75 | b.Property("ConcurrencyStamp") 76 | .IsConcurrencyToken(); 77 | 78 | b.Property("Discriminator") 79 | .IsRequired(); 80 | 81 | b.Property("Email") 82 | .HasMaxLength(256); 83 | 84 | b.Property("EmailConfirmed"); 85 | 86 | b.Property("LockoutEnabled"); 87 | 88 | b.Property("LockoutEnd"); 89 | 90 | b.Property("NormalizedEmail") 91 | .HasMaxLength(256); 92 | 93 | b.Property("NormalizedUserName") 94 | .HasMaxLength(256); 95 | 96 | b.Property("PasswordHash"); 97 | 98 | b.Property("PhoneNumber"); 99 | 100 | b.Property("PhoneNumberConfirmed"); 101 | 102 | b.Property("SecurityStamp"); 103 | 104 | b.Property("TwoFactorEnabled"); 105 | 106 | b.Property("UserName") 107 | .HasMaxLength(256); 108 | 109 | b.HasKey("Id"); 110 | 111 | b.HasIndex("NormalizedEmail") 112 | .HasName("EmailIndex"); 113 | 114 | b.HasIndex("NormalizedUserName") 115 | .IsUnique() 116 | .HasName("UserNameIndex") 117 | .HasFilter("[NormalizedUserName] IS NOT NULL"); 118 | 119 | b.ToTable("AspNetUsers"); 120 | 121 | b.HasDiscriminator("Discriminator").HasValue("IdentityUser"); 122 | }); 123 | 124 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => 125 | { 126 | b.Property("Id") 127 | .ValueGeneratedOnAdd() 128 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 129 | 130 | b.Property("ClaimType"); 131 | 132 | b.Property("ClaimValue"); 133 | 134 | b.Property("UserId") 135 | .IsRequired(); 136 | 137 | b.HasKey("Id"); 138 | 139 | b.HasIndex("UserId"); 140 | 141 | b.ToTable("AspNetUserClaims"); 142 | }); 143 | 144 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => 145 | { 146 | b.Property("LoginProvider") 147 | .HasMaxLength(128); 148 | 149 | b.Property("ProviderKey") 150 | .HasMaxLength(128); 151 | 152 | b.Property("ProviderDisplayName"); 153 | 154 | b.Property("UserId") 155 | .IsRequired(); 156 | 157 | b.HasKey("LoginProvider", "ProviderKey"); 158 | 159 | b.HasIndex("UserId"); 160 | 161 | b.ToTable("AspNetUserLogins"); 162 | }); 163 | 164 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => 165 | { 166 | b.Property("UserId"); 167 | 168 | b.Property("RoleId"); 169 | 170 | b.HasKey("UserId", "RoleId"); 171 | 172 | b.HasIndex("RoleId"); 173 | 174 | b.ToTable("AspNetUserRoles"); 175 | }); 176 | 177 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => 178 | { 179 | b.Property("UserId"); 180 | 181 | b.Property("LoginProvider") 182 | .HasMaxLength(128); 183 | 184 | b.Property("Name") 185 | .HasMaxLength(128); 186 | 187 | b.Property("Value"); 188 | 189 | b.HasKey("UserId", "LoginProvider", "Name"); 190 | 191 | b.ToTable("AspNetUserTokens"); 192 | }); 193 | 194 | modelBuilder.Entity("WebAPI.Models.ApplicationUser", b => 195 | { 196 | b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); 197 | 198 | b.Property("FullName") 199 | .HasColumnType("nvarchar(150)"); 200 | 201 | b.HasDiscriminator().HasValue("ApplicationUser"); 202 | }); 203 | 204 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => 205 | { 206 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") 207 | .WithMany() 208 | .HasForeignKey("RoleId") 209 | .OnDelete(DeleteBehavior.Cascade); 210 | }); 211 | 212 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => 213 | { 214 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") 215 | .WithMany() 216 | .HasForeignKey("UserId") 217 | .OnDelete(DeleteBehavior.Cascade); 218 | }); 219 | 220 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => 221 | { 222 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") 223 | .WithMany() 224 | .HasForeignKey("UserId") 225 | .OnDelete(DeleteBehavior.Cascade); 226 | }); 227 | 228 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => 229 | { 230 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") 231 | .WithMany() 232 | .HasForeignKey("RoleId") 233 | .OnDelete(DeleteBehavior.Cascade); 234 | 235 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") 236 | .WithMany() 237 | .HasForeignKey("UserId") 238 | .OnDelete(DeleteBehavior.Cascade); 239 | }); 240 | 241 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => 242 | { 243 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser") 244 | .WithMany() 245 | .HasForeignKey("UserId") 246 | .OnDelete(DeleteBehavior.Cascade); 247 | }); 248 | #pragma warning restore 612, 618 249 | } 250 | } 251 | } 252 | -------------------------------------------------------------------------------- /WebAPI/WebAPI/Migrations/20190124045416_InitialCreate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Metadata; 3 | using Microsoft.EntityFrameworkCore.Migrations; 4 | 5 | namespace WebAPI.Migrations 6 | { 7 | public partial class InitialCreate : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.CreateTable( 12 | name: "AspNetRoles", 13 | columns: table => new 14 | { 15 | Id = table.Column(nullable: false), 16 | Name = table.Column(maxLength: 256, nullable: true), 17 | NormalizedName = table.Column(maxLength: 256, nullable: true), 18 | ConcurrencyStamp = table.Column(nullable: true) 19 | }, 20 | constraints: table => 21 | { 22 | table.PrimaryKey("PK_AspNetRoles", x => x.Id); 23 | }); 24 | 25 | migrationBuilder.CreateTable( 26 | name: "AspNetUsers", 27 | columns: table => new 28 | { 29 | Id = table.Column(nullable: false), 30 | UserName = table.Column(maxLength: 256, nullable: true), 31 | NormalizedUserName = table.Column(maxLength: 256, nullable: true), 32 | Email = table.Column(maxLength: 256, nullable: true), 33 | NormalizedEmail = table.Column(maxLength: 256, nullable: true), 34 | EmailConfirmed = table.Column(nullable: false), 35 | PasswordHash = table.Column(nullable: true), 36 | SecurityStamp = table.Column(nullable: true), 37 | ConcurrencyStamp = table.Column(nullable: true), 38 | PhoneNumber = table.Column(nullable: true), 39 | PhoneNumberConfirmed = table.Column(nullable: false), 40 | TwoFactorEnabled = table.Column(nullable: false), 41 | LockoutEnd = table.Column(nullable: true), 42 | LockoutEnabled = table.Column(nullable: false), 43 | AccessFailedCount = table.Column(nullable: false), 44 | Discriminator = table.Column(nullable: false), 45 | FullName = table.Column(type: "nvarchar(150)", nullable: true) 46 | }, 47 | constraints: table => 48 | { 49 | table.PrimaryKey("PK_AspNetUsers", x => x.Id); 50 | }); 51 | 52 | migrationBuilder.CreateTable( 53 | name: "AspNetRoleClaims", 54 | columns: table => new 55 | { 56 | Id = table.Column(nullable: false) 57 | .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), 58 | RoleId = table.Column(nullable: false), 59 | ClaimType = table.Column(nullable: true), 60 | ClaimValue = table.Column(nullable: true) 61 | }, 62 | constraints: table => 63 | { 64 | table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); 65 | table.ForeignKey( 66 | name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", 67 | column: x => x.RoleId, 68 | principalTable: "AspNetRoles", 69 | principalColumn: "Id", 70 | onDelete: ReferentialAction.Cascade); 71 | }); 72 | 73 | migrationBuilder.CreateTable( 74 | name: "AspNetUserClaims", 75 | columns: table => new 76 | { 77 | Id = table.Column(nullable: false) 78 | .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), 79 | UserId = table.Column(nullable: false), 80 | ClaimType = table.Column(nullable: true), 81 | ClaimValue = table.Column(nullable: true) 82 | }, 83 | constraints: table => 84 | { 85 | table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); 86 | table.ForeignKey( 87 | name: "FK_AspNetUserClaims_AspNetUsers_UserId", 88 | column: x => x.UserId, 89 | principalTable: "AspNetUsers", 90 | principalColumn: "Id", 91 | onDelete: ReferentialAction.Cascade); 92 | }); 93 | 94 | migrationBuilder.CreateTable( 95 | name: "AspNetUserLogins", 96 | columns: table => new 97 | { 98 | LoginProvider = table.Column(maxLength: 128, nullable: false), 99 | ProviderKey = table.Column(maxLength: 128, nullable: false), 100 | ProviderDisplayName = table.Column(nullable: true), 101 | UserId = table.Column(nullable: false) 102 | }, 103 | constraints: table => 104 | { 105 | table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); 106 | table.ForeignKey( 107 | name: "FK_AspNetUserLogins_AspNetUsers_UserId", 108 | column: x => x.UserId, 109 | principalTable: "AspNetUsers", 110 | principalColumn: "Id", 111 | onDelete: ReferentialAction.Cascade); 112 | }); 113 | 114 | migrationBuilder.CreateTable( 115 | name: "AspNetUserRoles", 116 | columns: table => new 117 | { 118 | UserId = table.Column(nullable: false), 119 | RoleId = table.Column(nullable: false) 120 | }, 121 | constraints: table => 122 | { 123 | table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); 124 | table.ForeignKey( 125 | name: "FK_AspNetUserRoles_AspNetRoles_RoleId", 126 | column: x => x.RoleId, 127 | principalTable: "AspNetRoles", 128 | principalColumn: "Id", 129 | onDelete: ReferentialAction.Cascade); 130 | table.ForeignKey( 131 | name: "FK_AspNetUserRoles_AspNetUsers_UserId", 132 | column: x => x.UserId, 133 | principalTable: "AspNetUsers", 134 | principalColumn: "Id", 135 | onDelete: ReferentialAction.Cascade); 136 | }); 137 | 138 | migrationBuilder.CreateTable( 139 | name: "AspNetUserTokens", 140 | columns: table => new 141 | { 142 | UserId = table.Column(nullable: false), 143 | LoginProvider = table.Column(maxLength: 128, nullable: false), 144 | Name = table.Column(maxLength: 128, nullable: false), 145 | Value = table.Column(nullable: true) 146 | }, 147 | constraints: table => 148 | { 149 | table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); 150 | table.ForeignKey( 151 | name: "FK_AspNetUserTokens_AspNetUsers_UserId", 152 | column: x => x.UserId, 153 | principalTable: "AspNetUsers", 154 | principalColumn: "Id", 155 | onDelete: ReferentialAction.Cascade); 156 | }); 157 | 158 | migrationBuilder.CreateIndex( 159 | name: "IX_AspNetRoleClaims_RoleId", 160 | table: "AspNetRoleClaims", 161 | column: "RoleId"); 162 | 163 | migrationBuilder.CreateIndex( 164 | name: "RoleNameIndex", 165 | table: "AspNetRoles", 166 | column: "NormalizedName", 167 | unique: true, 168 | filter: "[NormalizedName] IS NOT NULL"); 169 | 170 | migrationBuilder.CreateIndex( 171 | name: "IX_AspNetUserClaims_UserId", 172 | table: "AspNetUserClaims", 173 | column: "UserId"); 174 | 175 | migrationBuilder.CreateIndex( 176 | name: "IX_AspNetUserLogins_UserId", 177 | table: "AspNetUserLogins", 178 | column: "UserId"); 179 | 180 | migrationBuilder.CreateIndex( 181 | name: "IX_AspNetUserRoles_RoleId", 182 | table: "AspNetUserRoles", 183 | column: "RoleId"); 184 | 185 | migrationBuilder.CreateIndex( 186 | name: "EmailIndex", 187 | table: "AspNetUsers", 188 | column: "NormalizedEmail"); 189 | 190 | migrationBuilder.CreateIndex( 191 | name: "UserNameIndex", 192 | table: "AspNetUsers", 193 | column: "NormalizedUserName", 194 | unique: true, 195 | filter: "[NormalizedUserName] IS NOT NULL"); 196 | } 197 | 198 | protected override void Down(MigrationBuilder migrationBuilder) 199 | { 200 | migrationBuilder.DropTable( 201 | name: "AspNetRoleClaims"); 202 | 203 | migrationBuilder.DropTable( 204 | name: "AspNetUserClaims"); 205 | 206 | migrationBuilder.DropTable( 207 | name: "AspNetUserLogins"); 208 | 209 | migrationBuilder.DropTable( 210 | name: "AspNetUserRoles"); 211 | 212 | migrationBuilder.DropTable( 213 | name: "AspNetUserTokens"); 214 | 215 | migrationBuilder.DropTable( 216 | name: "AspNetRoles"); 217 | 218 | migrationBuilder.DropTable( 219 | name: "AspNetUsers"); 220 | } 221 | } 222 | } 223 | -------------------------------------------------------------------------------- /WebAPI/.vs/config/applicationhost.config: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 48 | 49 | 50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | 59 | 60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | 79 |
80 |
81 | 82 |
83 |
84 |
85 |
86 |
87 |
88 | 89 |
90 |
91 |
92 |
93 |
94 | 95 |
96 |
97 |
98 | 99 |
100 |
101 | 102 |
103 |
104 | 105 |
106 |
107 |
108 | 109 | 110 |
111 |
112 |
113 |
114 |
115 |
116 | 117 |
118 |
119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | --------------------------------------------------------------------------------