Git Product home page Git Product logo

authorization's Introduction

一些说明

用户名随意,测试密码:空

目录

§ 验证流程

§ 身份验证模块

§ 加密算法


§ 验证流程

登录流程


请求认证


退出登陆


§ 身份验证模块

.
├──Server/
│  ├──Common/
   │  ├── Authorization/
      │   ├── IToken.cs
          ├── JwtToken.cs
          ├── JwtAuth.cs
          ├── TokenConfig.cs
          ├── Exceptions.cs

懒得写了,详见IToken.cs


§ 加密算法

数据库存储格式:MD5( [原始密码] )

前端加密格式:MD5( MD5( [原始密码] ).[服务端随机串] ),用于登陆时传入后端

后端校验:[前端加密密码] == MD5( [数据库存储密码].[服务端随机串] )

【注意】:MD5和SHA-1被认为不再安全,微软推荐使用SHA-2系列(SHA-256、SHA-512等)加密算法( https://msdn.microsoft.com/zh-cn/library/92f9ye3s(v=vs.110).aspx#哈希值

Token对象构成:

    public class JwtToken : IToken
    {
        #region 服务端存储的信息,对客户端隐藏

        public 随机加密盐 Salt { get; set; }
        ...

        #endregion

        #region 提供给客户端的信息

        public 头部 Header { get; set; }
        public 载荷 Payload { get; set; }

        #endregion
    }

Token加密串:Base64Url( [Header] ).Base64Url( [Payload] ).Base64Url( HMAC( Base64Url( [Header] ).Base64Url( [Payload] ) , [Salt] ) )

authorization's People

Contributors

linys2333 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

zszqwe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.