Usage
Install
pip install mlc_auth
Initialize
Before initializing MLC_Auth, the app.config['SECRET_KEY'] must be set.
from mlc_auth import MLC_Auth
mlc_auth = MLC_Auth(app=app)
Use on routes
The accessable_by parameter is optional. When accessable_by is None, all logged in users have access.
@app.route('/edit', methods=['GET'])
@mlc_auth.auth_required(accessable_by=['guest', 'user', 'manager', 'administrator'])
def edit_page():
return render_template('edit.html')
Current user model
User model properties:
- id
- name
- role
- organisation_id
- organisation_name
usage:
from flask_login import current_user
print(current_user.id)
Fetch data from the API
from mlc_auth import MLC_Auth
organisation_info = MLC_Auth.api.get(endpoint='/api/organisation/1', params={'key':'value'})
response = MLC_Auth.api.put(endpoint='/api/user/1/settings', body={'key': 'value'}, params={'key':'value'})
Development environment
- The following line needs to be added to your Hosts file:
127.0.0.1 local-<Your app name here>.mlc-services.com
- Start the application development server.
- Go to
http://local-<Your app name here>.mlc-services.com:5000
Metadata
Release files for mlc-auth 1.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mlc_auth-1.5.2.tar.gz | 4.0 kB | Without provenance | Details for mlc_auth-1.5.2.tar.gz |
Release files / mlc_auth-1.5.2.tar.gz
| Download URL | mlc_auth-1.5.2.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1936bfe022a5727401dc572db41f9725d51a3c1256db684756ec3adf156f5a8e
|
|
BLAKE2b-256 checksum How to use checksums |
babdb8cf61f927ed54b79e6891dfbc08a4bf6b89f16dd6e82633d20c3b11c5b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2
|
Security for mlc-auth 1.5.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.