Giter Site home page Giter Site logo

djangoauth's Introduction

djangOauth

项目介绍

  1. 基于 django-rest-framework-jwt
  2. 实现 用户名的统一认证

运行环境

Djnago >= 2 Python >= 3

工作方式

  1. 第三方应用发起带有“用户名、密码”的post请求(/api/login/),djangOauth 验证用户名、密码后,返回jwt token
  2. 第三方应用解析 jwt token 验证有效性,并保存至cookies,每页刷新页面 验证一次。
  3. 如若token过期,则发起(/api/token-refresh/) token刷新接口,获取新的token。

配置说明

  1. setting.py
    1.1 JWT_EXPIRATION_DELTA : 控制token过期时间;
    1.2 JWT_REFRESH_EXPIRATION_DELTA : token过期多长时间内,可以通过过期token获取新token

安装方法

  1. 安装mysql,并新建数据库 djangOauth(略)
  2. 下载代码
git clone https://github.com/X-Mars/djangOauth.git
  1. 安装模块
pip3 install -r requirements.txt
  1. 启动服务
python3 djangOauth/manage.py runserver 0.0.0.0 8000
  1. 后台访问
http://ip:8000/admin

接口信息

http://ip:8000/api/doc/

待完善

  1. 对接openldap

djangoauth's People

Contributors

x-mars avatar

Watchers

 avatar

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.