A python JWT validator that does all the BYU specific stuff as well.
Project description
# byu-jwt-python
A python JWT validator that does all the BYU specific stuff as well.
# Installation
`pip install byu_jwt`
## API
### How to Validate a JWT
```
import byu_jwt
try:
byu_jwt.decode(jwt_to_validate)
# valid JWT
except Exception:
# invalid JWT
```
### JWT Header Names
BYU's API Manager creates an HTTP header that contains a signed [JWT](https://jwt.io/). The names of the designed BYU signed headers can be referenced here for lookup convenience.
### BYU_JWT_HEADER_CURRENT
The property containing the name of the HTTP header that contains the BYU signed JWT sent directly from BYU's API Manager.
Value is X-JWT-Assertion.
Example
```
import byu_jwt
current_jwt_header = byu_jwt.BYU_JWT_HEADER_CURRENT
```
### BYU_JWT_HEADER_ORIGINAL
The property containing the name of the HTTP header that contains the BYU signed JWT forwarded on from a service that received the BYU signed JWT sent directly from BYU's API Manager.
Value is X-JWT-Assertion-Original.
Example
```
import byu_jwt
original_jwt_header = byu_jwt.BYU_JWT_HEADER_ORIGINAL
```
## Testing
You will need a file named ~/.byu/byu-jwt-python.yaml with the following contents. Get your info at https://api.byu.edu/store/site/pages/subscriptions.jag
```
client_id: <your WSO2 application's Consumer Key>
client_secret: <your WSO2 application's Consumer Secret>
```
Make sure you have python and python3 installed on your system, then install virtualenv in whatever way you install python modules (usually `$ pip install virtualenv`).
```
$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements
$ pip3 install -r requirements
$ python byu_jwt.py True
# The 'True' makes the tests run in verbose mode.
# Leaving it off will run the tests silently and they will only print info if any tests fail.
$ python3 byu_jwt.py True
$ deactivate # to get out of the virtualenv
```
A python JWT validator that does all the BYU specific stuff as well.
# Installation
`pip install byu_jwt`
## API
### How to Validate a JWT
```
import byu_jwt
try:
byu_jwt.decode(jwt_to_validate)
# valid JWT
except Exception:
# invalid JWT
```
### JWT Header Names
BYU's API Manager creates an HTTP header that contains a signed [JWT](https://jwt.io/). The names of the designed BYU signed headers can be referenced here for lookup convenience.
### BYU_JWT_HEADER_CURRENT
The property containing the name of the HTTP header that contains the BYU signed JWT sent directly from BYU's API Manager.
Value is X-JWT-Assertion.
Example
```
import byu_jwt
current_jwt_header = byu_jwt.BYU_JWT_HEADER_CURRENT
```
### BYU_JWT_HEADER_ORIGINAL
The property containing the name of the HTTP header that contains the BYU signed JWT forwarded on from a service that received the BYU signed JWT sent directly from BYU's API Manager.
Value is X-JWT-Assertion-Original.
Example
```
import byu_jwt
original_jwt_header = byu_jwt.BYU_JWT_HEADER_ORIGINAL
```
## Testing
You will need a file named ~/.byu/byu-jwt-python.yaml with the following contents. Get your info at https://api.byu.edu/store/site/pages/subscriptions.jag
```
client_id: <your WSO2 application's Consumer Key>
client_secret: <your WSO2 application's Consumer Secret>
```
Make sure you have python and python3 installed on your system, then install virtualenv in whatever way you install python modules (usually `$ pip install virtualenv`).
```
$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements
$ pip3 install -r requirements
$ python byu_jwt.py True
# The 'True' makes the tests run in verbose mode.
# Leaving it off will run the tests silently and they will only print info if any tests fail.
$ python3 byu_jwt.py True
$ deactivate # to get out of the virtualenv
```
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
byu_jwt-1.1.3.tar.gz
(5.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
byu_jwt-1.1.3-py3-none-any.whl
(12.5 kB
view details)
File details
Details for the file byu_jwt-1.1.3.tar.gz.
File metadata
- Download URL: byu_jwt-1.1.3.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5956565f91c837389010517603d224c842d51c910030d7f6fde843cac2b2d39c
|
|
| MD5 |
48a82ccc3c12cd0eb5e102abcf23940f
|
|
| BLAKE2b-256 |
c2e3399eb61cfa9f7de6363622a0fb0daa2499b1a4ad5d510af4bb2eb556e2c4
|
File details
Details for the file byu_jwt-1.1.3-py3-none-any.whl.
File metadata
- Download URL: byu_jwt-1.1.3-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d3b4368753291d83144f84c76a2c4f62aefbf127ba51deb77d00f161918089c
|
|
| MD5 |
9e819fb88321738864eb3e338d7853e8
|
|
| BLAKE2b-256 |
79209cd9dd04a9c3fa564dfb99a5a91c7ade83f81c5235ca6b114e3868d85ea2
|