%global _empty_manifest_terminate_build 0
Name: python-django-graphql-jwt
Version: 0.3.4
Release: 1
Summary: JSON Web Token for Django GraphQL.
License: MIT
URL: https://github.com/flavors/django-graphql-jwt
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/cd/8f/1bf2b7dc8b32b257e5d988820242562bda4318c00abed3d95fc37ca986ca/django-graphql-jwt-0.3.4.tar.gz
BuildArch: noarch
Requires: python3-Django
Requires: python3-graphene
Requires: python3-graphene-django
Requires: python3-PyJWT
%description
JSON Web Token authentication for Django GraphQL.
Fantastic documentation is available at https://django-graphql-jwt.domake.io.
## Installation
Install last stable version from Pypi:
```sh
pip install django-graphql-jwt
```
Add `AuthenticationMiddleware` middleware to your *MIDDLEWARE* settings:
```py
MIDDLEWARE = [
# ...
"django.contrib.auth.middleware.AuthenticationMiddleware",
# ...
]
```
Add `JSONWebTokenMiddleware` middleware to your *GRAPHENE* settings:
```py
GRAPHENE = {
"SCHEMA": "mysite.myschema.schema",
"MIDDLEWARE": [
"graphql_jwt.middleware.JSONWebTokenMiddleware",
],
}
```
Add `JSONWebTokenBackend` backend to your *AUTHENTICATION_BACKENDS*:
```py
AUTHENTICATION_BACKENDS = [
"graphql_jwt.backends.JSONWebTokenBackend",
"django.contrib.auth.backends.ModelBackend",
]
```
## Schema
Add *django-graphql-jwt* mutations to the root schema:
```py
import graphene
import graphql_jwt
class Mutation(graphene.ObjectType):
token_auth = graphql_jwt.ObtainJSONWebToken.Field()
verify_token = graphql_jwt.Verify.Field()
refresh_token = graphql_jwt.Refresh.Field()
schema = graphene.Schema(mutation=Mutation)
```
%package -n python3-django-graphql-jwt
Summary: JSON Web Token for Django GraphQL.
Provides: python-django-graphql-jwt
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-django-graphql-jwt
JSON Web Token authentication for Django GraphQL.
Fantastic documentation is available at https://django-graphql-jwt.domake.io.
## Installation
Install last stable version from Pypi:
```sh
pip install django-graphql-jwt
```
Add `AuthenticationMiddleware` middleware to your *MIDDLEWARE* settings:
```py
MIDDLEWARE = [
# ...
"django.contrib.auth.middleware.AuthenticationMiddleware",
# ...
]
```
Add `JSONWebTokenMiddleware` middleware to your *GRAPHENE* settings:
```py
GRAPHENE = {
"SCHEMA": "mysite.myschema.schema",
"MIDDLEWARE": [
"graphql_jwt.middleware.JSONWebTokenMiddleware",
],
}
```
Add `JSONWebTokenBackend` backend to your *AUTHENTICATION_BACKENDS*:
```py
AUTHENTICATION_BACKENDS = [
"graphql_jwt.backends.JSONWebTokenBackend",
"django.contrib.auth.backends.ModelBackend",
]
```
## Schema
Add *django-graphql-jwt* mutations to the root schema:
```py
import graphene
import graphql_jwt
class Mutation(graphene.ObjectType):
token_auth = graphql_jwt.ObtainJSONWebToken.Field()
verify_token = graphql_jwt.Verify.Field()
refresh_token = graphql_jwt.Refresh.Field()
schema = graphene.Schema(mutation=Mutation)
```
%package help
Summary: Development documents and examples for django-graphql-jwt
Provides: python3-django-graphql-jwt-doc
%description help
JSON Web Token authentication for Django GraphQL.
Fantastic documentation is available at https://django-graphql-jwt.domake.io.
## Installation
Install last stable version from Pypi:
```sh
pip install django-graphql-jwt
```
Add `AuthenticationMiddleware` middleware to your *MIDDLEWARE* settings:
```py
MIDDLEWARE = [
# ...
"django.contrib.auth.middleware.AuthenticationMiddleware",
# ...
]
```
Add `JSONWebTokenMiddleware` middleware to your *GRAPHENE* settings:
```py
GRAPHENE = {
"SCHEMA": "mysite.myschema.schema",
"MIDDLEWARE": [
"graphql_jwt.middleware.JSONWebTokenMiddleware",
],
}
```
Add `JSONWebTokenBackend` backend to your *AUTHENTICATION_BACKENDS*:
```py
AUTHENTICATION_BACKENDS = [
"graphql_jwt.backends.JSONWebTokenBackend",
"django.contrib.auth.backends.ModelBackend",
]
```
## Schema
Add *django-graphql-jwt* mutations to the root schema:
```py
import graphene
import graphql_jwt
class Mutation(graphene.ObjectType):
token_auth = graphql_jwt.ObtainJSONWebToken.Field()
verify_token = graphql_jwt.Verify.Field()
refresh_token = graphql_jwt.Refresh.Field()
schema = graphene.Schema(mutation=Mutation)
```
%prep
%autosetup -n django-graphql-jwt-0.3.4
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-django-graphql-jwt -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Mon Apr 10 2023 Python_Bot - 0.3.4-1
- Package Spec generated