All Projects → dotnet-labs → JwtAuthDemo

dotnet-labs / JwtAuthDemo

Licence: MIT license
ASP.NET Core + Angular JWT auth demo; integration tests; login, logout, refresh token, impersonation, authentication, authorization; run on Docker Compose.

Programming Languages

C#
18002 projects
typescript
32286 projects
HTML
75241 projects
CSS
56736 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to JwtAuthDemo

spring-boot-login-example
Spring Boot Login and Registration example with MySQL, JWT, Rest Api - Spring Boot Spring Security Login example
Stars: ✭ 50 (-82.01%)
Mutual labels:  login, authorization, jwt-token, jwt-auth
Reallysimplejwt
A really simple library to generate JSON Web Tokens in PHP.
Stars: ✭ 218 (-21.58%)
Mutual labels:  jwt-token, json-web-token, jwt-auth
Security.identity
.NET DevPack Identity is a set of common implementations to help you implementing Identity, Jwt, claims validation and another facilities
Stars: ✭ 165 (-40.65%)
Mutual labels:  authorization, asp-net-core, json-web-token
Aspnetcore Tests Sample
A project to help demonstrate how to do unit, integration and acceptance tests with an web api project using ASP.NET Core and Angular 7 front end.
Stars: ✭ 40 (-85.61%)
Mutual labels:  aspnetcore, integration-testing, asp-net-core
SpringSecurityInEasySteps
Learn Spring Security step by step
Stars: ✭ 13 (-95.32%)
Mutual labels:  login, authorization, logout
Onion Architecture Asp.net Core
WhiteApp API solution template which is built on Onion Architecture with all essential feature using .NET 5!
Stars: ✭ 196 (-29.5%)
Mutual labels:  aspnetcore, integration-testing, asp-net-core
Jwtsecurity
JWT Server for Asp.Net Core and Asp.Net WebAPI2
Stars: ✭ 16 (-94.24%)
Mutual labels:  aspnetcore, jwt-token, asp-net-core
jax-rs-pac4j
Security library for JAX-RS and Jersey
Stars: ✭ 48 (-82.73%)
Mutual labels:  login, authorization, logout
Hexagonal-architecture-ASP.NET-Core
App generator API solution template which is built on Hexagnonal Architecture with all essential feature using .NET Core
Stars: ✭ 57 (-79.5%)
Mutual labels:  aspnetcore, integration-testing, asp-net-core
undertow-pac4j
Security library for Undertow: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 35 (-87.41%)
Mutual labels:  login, authorization, logout
XAF Security E4908
This repository contains examples for Role-based Access Control, Permission Management, and OData / Web / REST API Services for Entity Framework and XPO ORM
Stars: ✭ 47 (-83.09%)
Mutual labels:  aspnetcore, authorization, asp-net-core
hapi-doorkeeper
User authentication for web servers
Stars: ✭ 14 (-94.96%)
Mutual labels:  login, authorization, logout
NodeScalableArchitecture
A Scalable Node Architecture/Server. This repository contains a complete implementation of writing scalable nodejs server/architecture on my medium blog.
Stars: ✭ 62 (-77.7%)
Mutual labels:  jwt-token, jwt-auth
DNTCaptcha.Core
DNTCaptcha.Core is a captcha generator and validator for ASP.NET Core applications
Stars: ✭ 181 (-34.89%)
Mutual labels:  aspnetcore, asp-net-core
oauth2-wechat
微信登录认证授权 Wechat login authorization. This package provides Wechat OAuth 2.0 support for the PHP League's OAuth 2.0 Client
Stars: ✭ 18 (-93.53%)
Mutual labels:  login, authorization
TheLastTime
C# .NET 5 Blazor WebAssembly Progressive Web Application that tracks when was the last time you did something
Stars: ✭ 23 (-91.73%)
Mutual labels:  aspnetcore, asp-net-core
SimpleSocial
A simple social network web application using ASP.NET Core 3.1
Stars: ✭ 16 (-94.24%)
Mutual labels:  aspnetcore, asp-net-core
AspNetCoreMvcAngular
ASP.NET Core MVC with angular in MVC View OpenID Connect Hybrid Flow
Stars: ✭ 54 (-80.58%)
Mutual labels:  aspnetcore, asp-net-core
API-Authentication-NodeJs
API Authentication using JWT's (JSON Web Tokens). Plug n Play inside any app which requires authentication. NodeJs Express MongoDB & Redis.
Stars: ✭ 162 (-41.73%)
Mutual labels:  jwt-token, jwt-auth
AspNetCore-Dynamic-Permission
Dynamic Permission Samples in ASP.NET Core and ASP.NET MVC 5.
Stars: ✭ 19 (-93.17%)
Mutual labels:  authorization, asp-net-core

JWT Auth Demo (Angular + ASP.NET Core / ASP.NET 5+)

Buy Me a Coffee at ko-fi.com

This repository demos an Angular SPA and an ASP.NET Core web API application using JWT auth, and an integration testing project for a set of actions including login, logout, refresh token, impersonation, authentication, and authorization.

Medium Articles

  1. JWT Auth in ASP.NET Core

    In this article, I will show you how to implement an ASP.NET Core web API application using JWT authentication and authorization.

  2. JWT Authentication in Angular

    In this article, we will build a simple app using Angular. We will implement an AuthService class to handle login, logout, and refresh token processes, as well as operations for localStorage key-value pairs. We will create a JwtInterceptor class to add JWT Bearer token to the HTTP request headers, and an UnauthorizedInterceptor class to redirect the user to the login page if an HTTP status code 401 is received. We will use an AuthGuard to prevent unauthenticated user from visiting the application pages.

Demo

jwt demo

Solution Structure

This repository includes two applications: an Angular SPA in the angular folder, and an ASP.NET Core web API app in the webapi folder. The SPA makes HTTP requests to the server side (the webapi app) using an API BaseURL https://localhost:5001. The API BaseURL is set in the environment.ts file and the environment.prod.ts file, which can be modified based on your situation.

  • angular The SPA is served using NGINX on Docker. The application demonstrates JWT authorization in the front-end.
  • webapi The ASP.NET Core web API app is served by Kestrel on Docker. This app has implemented HTTPS support.

Usage

The demo is configured to run by Docker Compose. The services are listed in the docker-compose.yml file. You can launch the demo by the following command.

docker-compose up --build --remove-orphans

Then visit http://localhost:8080 for the app, and https://localhost:5001 for Swagger document for the web API project.

NOTE: You can also move the folders around to consolidate the solution as one ASP.NET Core web app using the SPA service.

Screenshots

License

Feel free to use the code in this repository as it is under MIT license.

Buy Me a Coffee at ko-fi.com

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].