GithubHelp home page GithubHelp logo

dencygb / drf-msal-jwt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from narongdejsrn/drf-msal-jwt

0.0 0.0 0.0 76 KB

MSAL for Django Rest Framework

License: MIT License

Makefile 9.40% Python 90.60%

drf-msal-jwt's Introduction

Django Rest Framework MSAL + JWT

https://travis-ci.org/narongdejsrn/drf-msal-jwt.svg?branch=master

This package allows user to authenticate using Microsoft Account in Django REST Framework.

This library rely on Django REST Framework and Django Rest Framework JWT to works properly. Please make sure you setup these packages successfully before using this package.

Documentation

The full documentation is at https://drf-msal-jwt.readthedocs.io.

Quickstart

Install Django Rest Framework MSAL + JWT:

pip install drf-msal-jwt

Add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'drf_msal_jwt',
    ...
)

Add Django Rest Framework MSAL + JWT's URL patterns:

from drf_msal_jwt import urls as drf_msal_jwt_urls


urlpatterns = [
    ...
    url(r'^', include(drf_msal_jwt_urls)),
    ...
]

Config the settings.py

DEFAULTS = {
    'MSAL_CLIENT_ID': "{AZURE_AD_CLIENT_ID}",
    'MSAL_CLIENT_SECRET': "{AZURE_AD_CLIENT_SECRET}",
    'MSAL_AUTHORITY_URL': 'https://login.microsoftonline.com/common/',
    'MSAL_REDIRECT_URL': "{AZURE_AD_REDIRECT_URL}",
    'MSAL_SCOPES': ["User.ReadBasic.All"],
    'MSAL_USER_HANDLER': 'django.contrib.auth.models.User',
    'MSAL_ALLOW_DOMAINS': ['*'],
    'MSAL_CHECK_STATE': True
}

Features

  • [API] for generating Microsoft Login URL
  • [API] for logging/creating user based on Authorization Code, and generate JWT token

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Deployment

Bumb version & deploy

bumpversion <major/minor/patch>
python setup.py publish

drf-msal-jwt's People

Contributors

narongdejsrn 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.