#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)
Release files for Blue2FactorPy 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Blue2FactorPy-0.1.3.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Blue2FactorPy-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / Blue2FactorPy-0.1.3.tar.gz
| Download URL | Blue2FactorPy-0.1.3.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4b6fec2d21df5ef0790882248649c1ca9d197cc756f6c3811059de337c41319a
|
|
BLAKE2b-256 checksum How to use checksums |
d8242f05545faf9ec6a14bf75e33ade01176afd5e29749177b0a93729fcb1697
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|
Release files / Blue2FactorPy-0.1.3-py3-none-any.whl
| Download URL | Blue2FactorPy-0.1.3-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4ac507baa094fa450d5568d086cf4b366ad1344d7529f105c347633fac13bf32
|
|
BLAKE2b-256 checksum How to use checksums |
a7a6ee568ce991d99b4427064dee3a2b26db3e2015a62c3d5958ed38741c5e99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|