Skip to content

lastingyeh/aspnetIdentities

Repository files navigation

Demo

Basics

  • Cookie auth [HttContext.SignInAsync]
    • Access to [Authorize] [/Home/Secret]
      • Direct to Action [/Home/Authenticate]
      • Add Grandmas.Cookie (header)
      • SignInAsync
      • RedirectToIndex
      • Access again
      • Successfully (header: Grandmas.Cookie)
    • Custom Required Policy
      • Policy [Authorize(Policy = "Claim.DoB")]
      • Role [Authorize(Role = "Admin")]
    • Custom Controller (OperationsController)
      • OperationAuthorizationRequirement
      • Custom authorization
    • Dynamic Claim added (trigger when [Authorize])
      • IClaimsTransformation
      • Add Custom claim
    • Custom Authorization Policy Provider (DefaultAuthorizationPolicyProvider)
      • Rank => RequireClaim("Rank")
      • securityLevel => SecurityLevelHandler (requirement.Level <= claimLevel)
      • AuthorizeAttribute inherited

IdentityExample

  • Cookie auth [Identity]
    • Register user [/Home/Register]
    • Access to [Authorize] [/Home/Secret]
      • Direct to Action [/Home/Login]
      • login success => Add Identity.Cookie (header)
      • access again
      • Successfully
    • Add Email Confirmation process
      • Generate EmailConfirmation Token
      • Generate EmailConfirmation link
      • Send email with token and link
      • [page] EmailVerification page
      • client click link from email box
      • verify user & token
      • [page] VerifyEmail

IdentityServer4

  • Part 1

    • ApiOne
    • ApiTwo
    • IdentityServer
    • JavascriptClient
    • MvcClient
  • Part 2

    • CustomIdentityServer
    • CustomResourceServer
    • CustomAccessRefreshApi

Microservices

  • IdentityServer
  • ApiGateway
  • Movies.API
  • Movies.Client

OAuth

  • Api
  • Client
  • Server

AuthorizationCode

alt tag

Identity Server 4

ClientCredentials

alt tag

Authorization Code

alt tag

Implicit

alt tag

External [Facebook]

alt tag

Docker

  • docker-compose (/oauth)

    $ docker-compose up --build -d 
    
  • Dev Https

     $ dotnet dev-certs https -ep ${HOME}/.aspnet/https/aspnetapp.pfx -p [password]
    
     $ dotnet dev-certs https --trust
    
    • set at docker-compose.yaml

      environment:
        - ASPNETCORE_URLS=https://+:443
        - ASPNETCORE_ENVIRONMENT=Development
        - ASPNETCORE_Kestrel__Certificates__Default__Password=<password>
        - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx
      volumes:
        - ~/.aspnet/https:/https:ro 
          

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published