Testing JWT (edit)
https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-apps
https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-reference-tokens
https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-token-session-sso
Theory - Concepts - Principles (edit)
- Procedural Programming vs Object-Oriented Programming
- Object Oriented Programming Concepts C#
- Object-Oriented Programming Principles C#
- Object-Oriented Programming concepts and principles C#
- Class Design principles
- Cohesion principles
- Coupling principles
- Interface Segregation Principle OR here
- Dependency Inversion principles
- Dependency Injection (DI)
- Inversion of Control (IoC)
- Lazy Load
- Model View Controller
- Repository
- Design Patterns
- Dispose pattern
- Abstract class & Interface
public abstract class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public abstract string GetFullName();
}
public class Employee : Person
{
public decimal Salary { get; set; }
public override string GetFullName()
{
return LastName + ", " + FirstName;
}
}
Principles of OOP are:
- Abstraction. Abstraction means using simple things to represent complexity. We all know how to turn the TV on, but we don’t need to know how it works in order to enjoy it. In Java, abstraction means simple things like objects, classes, and variables represent more complex underlying code and data. This is important because it lets avoid repeating the same work multiple times.
- Encapsulation. This is the practice of keeping fields within a class private, then providing access to them via public methods. It’s a protective barrier that keeps the data and code safe within the class itself. This way, we can re-use objects like code components or variables without allowing open access to the data system-wide.
- Inheritance. This is a special feature of Object Oriented Programming in Java. It lets programmers create new classes that share some of the attributes of existing classes. This lets us build on previous work without reinventing the wheel.
- Polymorphism. This Java OOPs concept lets programmers use the same word to mean different things in different contexts. One form of polymorphism in Java is method overloading. That’s when different meanings are implied by the code itself. The other form is method overriding. That’s when the different meanings are implied by the values of the supplied variables. See more on this below.
- Override example
public virtual void Method1()
{
Console.Write("Base Class Method");
}
public override void Method1()
{
Console.Write("Derived Class Method");
}
-
Overload example
void area(int side);
void area(int l, int b);
void area(float radius);
Class Design principles – Also called SOLID principles are:
- S - Single-responsiblity principle
- O - Open-closed principle
- L - Liskov substitution principle
- I - Interface segregation principle
- D - Dependency Inversion Principle
Lý thuyết về OOP, Principles, Design Patterns có kèm theo ví dụ
https://www.codeproject.com/Articles/22769/Introduction-to-Object-Oriented-Programming-Concep
Guidelines
https://github.com/dennisdoomen/CSharpGuidelines
http://www.dotnetcurry.com/software-gardening/1333/coding-guidelines-important-for-developers
https://www.syncfusion.com/resources/techportal/ebookconfirm/oop-csharp/ (PDF)
Best Practices - Exception
https://stackify.com/csharp-exception-handling-best-practices/ (nêu tên các loại exceptions)
https://stackify.com/csharp-catch-all-exceptions/
Best Practices - Logging
https://stackify.com/csharp-logging-best-practices/
log.Debug(string.Format("Creating a foo: {0}", JsonConvert.SerializeObject(foo)));
DEBUG 2014-11-01 10:39:53.3295 [11] Creating a foo: {"ID":0,"RequiredInt":1,"FooString":"The foo is 1"}
Token-Based Authentication in ASP.NET Core
10 Things You Should Know about Tokens
https://auth0.com/blog/ten-things-you-should-know-about-tokens-and-cookies/
https://code.tutsplus.com/tutorials/token-based-authentication-with-angularjs-nodejs--cms-22543 (có ví dụ với AngularJS)
https://scotch.io/tutorials/the-ins-and-outs-of-token-based-authentication
USE CASES FOR TOKEN BASED AUTHENTICATION
We’ve seen how easy it is to implement JWT authentication and secure our API. To conclude, let’s examine use cases where token based authentication is best suited for.
- Platform-as-a-Service Applications – exposing RESTful APIs that will be consumed by a variety of frameworks and clients.
- Mobile Apps – implementing native or hybrid mobile apps that interact with your services.
- Single Page Applications (SPA) – building modern applications with frameworks such as Angular and React.
ASP.NET Core Web API
https://dotnetthoughts.net/token-based-authentication-in-aspnet-core/
https://logcorner.com/angular2-token-based-authentication-using-asp-net-core-web-api-and-json-web-token/
https://logcorner.com/token-based-authentication-using-asp-net-web-api-core/
http://www.blinkingcaret.com/2017/09/06/secure-web-api-in-asp-net-core/
NodeJS
https://auth0.com/learn/token-based-authentication-made-easy/