• Stars
    star
    179
  • Rank 214,039 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 7 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An Authentication backend for Django Rest Framework for AWS Cognito JWT tokens
http://codecov.io/github/LabD/django-cognito-jwt/coverage.svg?branch=master Documentation Status

Django Cognito JWT

An Authentication backend for Django Rest Framework for AWS Cognito JWT tokens

Installation

pip install django-cognito-jwt

Usage

Add the following lines to your Django settings.py file:

COGNITO_AWS_REGION = '<aws region>' # 'eu-central-1'
COGNITO_USER_POOL = '<user pool>'   # 'eu-central-1_xYzaq'
COGNITO_AUDIENCE = '<client id>'

(Optional) If you want to cache the Cognito public keys between requests you can enable the COGNITO_PUBLIC_KEYS_CACHING_ENABLED setting (it only works if you have the Django CACHES setup to anything other than the dummy backend).

COGNITO_PUBLIC_KEYS_CACHING_ENABLED = True
COGNITO_PUBLIC_KEYS_CACHING_TIMEOUT = 60*60*24  # 24h caching, default is 300s

Also update the rest framework settings to use the correct authentication backend:

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': [
        ...
        'django_cognito_jwt.JSONWebTokenAuthentication',
        ...
    ],
    ...
 }

Be sure you are passing the ID Token JWT from Cognito as the authentication header. Using the Access Token will work for authentication only but we're unable to use the get_or_create_for_cognito method with the Access Token.

(Optional) If you want to use a different user model then the default DJANGO_USER_MODEL you can use the COGNITO_USER_MODEL setting.

COGNITO_USER_MODEL = "myproject.AppUser"

More Repositories

1

nextjs-basic-auth-middleware

Add basic authentication to a NextJS application as middleware
TypeScript
214
star
2

wagtailstreamforms

What happened when a FormBuilder met a StreamField
Python
156
star
3

django-oscar-wagtail

Wagtail integration for Oscar Commerce (or Oscar Commerce integration for Wagtail?)
Python
101
star
4

wagtail-2fa

2 Factor Authentication for Wagtail
Python
84
star
5

terraform-provider-commercetools

Terraform provider for commercetools
Go
64
star
6

django-healthchecks

Simple Django app/framework to publish health check for monitoring purposes
Python
60
star
7

django-iam-dbauth

Django backends to support IAM database authentication for AWS
Python
44
star
8

mach-composer

MACH composer is an orchestration tool for modern MACH ecosystems, powered by Terraform infrastructure-as-code underneath.
Go
39
star
9

django-session-timeout

Add timestamp to sessions to expire them
Python
36
star
10

commercetools-go-sdk

Go SDK for commercetools
Go
27
star
11

commercetools-node-mock

Mock for the commercetools rest api
TypeScript
19
star
12

ecs-deplojo

Deployment tool for Amazon ECS
Python
19
star
13

commercetools-python-sdk

Commercetools Python SDK
Python
17
star
14

react-abode

React micro-frontend framework allowing you to host multiple React components from HTML.
TypeScript
15
star
15

python-param-store

Python module to store secrets in secret stores
Python
15
star
16

django-perms-provisioner

Provision Django instances with groups and permissions
Python
13
star
17

terraform-provider-contentstack

Terraform provider for Contentstack
Go
9
star
18

wagtail-audit-trail

Python
8
star
19

terraform-provider-sonarqube

Terraform Provider for SonarQube
Go
8
star
20

react-loqate

React implementation of the Loqate API.
TypeScript
8
star
21

django-postcode-lookup

Generic API for postcode lookups
Python
8
star
22

terraform-provider-amplience

Terraform provider for Amplience
Go
7
star
23

commercetools-mock-server

Docker based mock server for the commercetools API
Dockerfile
7
star
24

pytest-bdd-splinter

Python
6
star
25

wagtail-site-inheritance

Support for site inheritance in Wagtail
Python
6
star
26

schema-generate

A library and CLI tool to generate various schemas based off of TypeScript interfaces.
TypeScript
5
star
27

changie-release-action

GitHub action for Changie
4
star
28

terraform-provider-taskrunner-aws-ecs

Terraform Provider for running ECS tasks
Go
4
star
29

graphql-codegen-faker-fixtures

Generate Faker fixtures for your GraphQL Fragments using GraphQL codegen
TypeScript
4
star
30

docker-python-lint

Flake8 docker
Dockerfile
3
star
31

mach-component-aws-commercetools-token-refresher

Terraform module that runs a Lambda function to auto-refresh commercetools auth tokens in AWS Secrets Manager
Python
3
star
32

terraform-module-commercetools-mc-app

HCL
3
star
33

docker-nginx-s3

Docker container to proxy nginx to s3
Shell
3
star
34

wsgi-aws-unproxy

Process X-Forwarded-For headers for AWS
Python
3
star
35

python-mocksftp

Python
2
star
36

terraform-aws-static-site

AWS static site module for Terraform, with support for basic authentication
HCL
2
star
37

apex-redirector

Go
2
star
38

lambda-utilities-javascript

TypeScript
2
star
39

commercetools-utilities-javascript

TypeScript
2
star
40

commercetools-federated-schema

Library for enabling Apollo GraphQL schema federation for commercetools
TypeScript
2
star
41

terraform-provider-storyblok

Terraform provider to manage Storyblok
Go
2
star
42

graphql-codegen-plugin-amplience

GraphQL codegen plugin for outputting Amplience schema's
TypeScript
2
star
43

node-dynamodb-mock

TypeScript
2
star
44

amplience-go-sdk

Go
2
star
45

go-rds-iam

A SQL Driver for connecting to AWS RDS instances via IAM roles
Go
1
star
46

aws-lambda-deploy

Python
1
star
47

contentstack-go-sdk

Go SDK for the Contentstack management API
Go
1
star
48

django-cache-results

A microlibrary to ease your caching code.
Python
1
star
49

javascript-tools

Tooling for JavaScript projects within Lab Digital
JavaScript
1
star
50

frontend-tooling

๐Ÿ› Tooling and configuration for front-end projects
JavaScript
1
star
51

homebrew-terraform-provider-commercetools

Ruby
1
star
52

tf-ca-proxy

A proxy to use AWS CodeArtifact for hosting Terraform modules
Go
1
star
53

node-federated-token

Tokens for federated services
TypeScript
1
star
54

spaken

Python
1
star
55

js-toolkit

@labdigital/toolkit package for typescript development
TypeScript
1
star
56

next-sentry-tunnel

Sentry tunnel using Next.js route handler
TypeScript
1
star