Used to implement Blue2Factor
Project description
#Blue2FactorPy
This python page is used for python webservers that use Blue2Factor
It can be used with both Django and Flask. You may have to install some packages
python3 -m pip install jwt rsa django flask requests
###To call in Flask:
from Blue2Factor import Authentication
companyId = "COMPANY_ID from https://secure.blue2factor.com"
loginUrl = "LOGIN_URL that was entered at https://secure.blue2factor.com"
b2f = Authentication.Auth()
@app.route('/mytest', methods=['GET', 'POST'])
def myTest():
if not b2f.authenticateFlaskRequest(request, companyId, loginUrl, privateKeyStr):
return b2f.redirect
#do what you would normally do, and set cookies
response = Main.Sample().showTestPage()
return response
@app.after_request
def setCookie(response):
return b2f.setB2fCookie(response)
###Or using Django
from Blue2Factor import Authentication
companyId = "COMPANY_ID from https://secure.blue2factor.com"
loginUrl = "LOGIN_URL that was entered at https://secure.blue2factor.com"
b2f = Authentication.Auth()
def index(request):
if not b2f.authenticateDjangoRequest(request, companyId, loginUrl, privateKeyStr):
return b2f.redirect
#do what you normall do
template = loader.get_template('sample.html')
response = HttpResponse(template.render())
@app.after_request
def setCookie(response):
return b2f.setB2fCookie(response)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Blue2FactorPy-0.1.3.tar.gz
(4.7 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
File details
Details for the file Blue2FactorPy-0.1.3.tar.gz.
File metadata
- Download URL: Blue2FactorPy-0.1.3.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b6fec2d21df5ef0790882248649c1ca9d197cc756f6c3811059de337c41319a
|
|
| MD5 |
134ce61bba84ab9e5ffbb0c2fc514219
|
|
| BLAKE2b-256 |
d8242f05545faf9ec6a14bf75e33ade01176afd5e29749177b0a93729fcb1697
|
File details
Details for the file Blue2FactorPy-0.1.3-py3-none-any.whl.
File metadata
- Download URL: Blue2FactorPy-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ac507baa094fa450d5568d086cf4b366ad1344d7529f105c347633fac13bf32
|
|
| MD5 |
0cfeda1f02fb4a7ee4f1eb23aa0002a0
|
|
| BLAKE2b-256 |
a7a6ee568ce991d99b4427064dee3a2b26db3e2015a62c3d5958ed38741c5e99
|