zoukankan      html  css  js  c++  java
  • Asp.net core authentication

    CONCEPTS:

    Authentication is responsible for identify/authenticate a user

    Authorization is responsible for checking the authenticated use's access to a restricted resource.

    Claims are key-value pair discriptions to representing a user(we can call the use pricipal), describing the user's properties.For  example, a claims set may looks like: {name:wyman,role:admin,department:it}

    Identity represents ....

    Authentication Scheme: types of authentication,like JWT,cookie and others.

    USAGE:

    Authentication middleware is added into the asp.net core pipeline in the Confure Method in Startup.cs class, by calling the UseAuthentication() method.

    Authencation Service is used by the Authentication middleware, and it's registered in the ConfigureServices method by calling the AddAuthentication() extend method of IServiceCollection.

    IAuthencationHandler is where the authentication work to be done.  there're three core methods :

    AuthenticateAsync(): is the method responsible for authenticate a use, 

    ChallengeAsync(): how to react when a unauthenticated user tries to access the stricted resource, depending on the specified authentication scheme, for example, JWTAuthentication will response a 401 header to the client, and CookieAuthentication may redirect client to the login page.

    ForbidAsync: how to react when a authenticated user tries to access restricted resouce without permission.

     IAuthenticationHandler 

  • 相关阅读:
    #cat ora11g_ora_.trc
    Vue学习之路3-浅析Vue-cli搭建项目后的目录结构
    Vue学习之路2-项目初搭建
    Vue学习之路1-集成环境安装
    laravel中建立公共视图的方法
    Windows下Laravel5.5 的 Homestead 开发环境部署
    技术好文推荐
    中文文案排版指北
    消息队列的使用
    Laravel 验证中文本地化
  • 原文地址:https://www.cnblogs.com/lwhkdash/p/14698230.html
Copyright © 2011-2022 走看看