ACIL FM
Dark
Refresh
Current DIR:
/usr/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749
/
usr
lib
python3.9
site-packages
oauthlib
oauth2
rfc6749
Upload
Zip Selected
Delete Selected
Pilih semua
Nama
Ukuran
Permission
Aksi
clients
-
chmod
Open
Rename
Delete
endpoints
-
chmod
Open
Rename
Delete
grant_types
-
chmod
Open
Rename
Delete
__pycache__
-
chmod
Open
Rename
Delete
errors.py
12.69 MB
chmod
View
DL
Edit
Rename
Delete
parameters.py
17.52 MB
chmod
View
DL
Edit
Rename
Delete
request_validator.py
27.19 MB
chmod
View
DL
Edit
Rename
Delete
tokens.py
10.84 MB
chmod
View
DL
Edit
Rename
Delete
utils.py
2.16 MB
chmod
View
DL
Edit
Rename
Delete
__init__.py
404 B
chmod
View
DL
Edit
Rename
Delete
Edit file: /usr/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/utils.py
""" oauthlib.utils ~~~~~~~~~~~~~~ This module contains utility methods used by various parts of the OAuth 2 spec. """ import datetime import os from urllib.parse import quote, urlparse from oauthlib.common import urldecode def list_to_scope(scope): """Convert a list of scopes to a space separated string.""" if isinstance(scope, str) or scope is None: return scope elif isinstance(scope, (set, tuple, list)): return " ".join([str(s) for s in scope]) else: raise ValueError("Invalid scope (%s), must be string, tuple, set, or list." % scope) def scope_to_list(scope): """Convert a space separated string to a list of scopes.""" if isinstance(scope, (tuple, list, set)): return [str(s) for s in scope] elif scope is None: return None else: return scope.strip().split(" ") def params_from_uri(uri): params = dict(urldecode(urlparse(uri).query)) if 'scope' in params: params['scope'] = scope_to_list(params['scope']) return params def host_from_uri(uri): """Extract hostname and port from URI. Will use default port for HTTP and HTTPS if none is present in the URI. """ default_ports = { 'HTTP': '80', 'HTTPS': '443', } sch, netloc, path, par, query, fra = urlparse(uri) if ':' in netloc: netloc, port = netloc.split(':', 1) else: port = default_ports.get(sch.upper()) return netloc, port def escape(u): """Escape a string in an OAuth-compatible fashion. TODO: verify whether this can in fact be used for OAuth 2 """ if not isinstance(u, str): raise ValueError('Only unicode objects are escapable.') return quote(u.encode('utf-8'), safe=b'~') def generate_age(issue_time): """Generate a age parameter for MAC authentication draft 00.""" td = datetime.datetime.now() - issue_time age = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10 ** 6) / 10 ** 6 return str(age) def is_secure_transport(uri): """Check if the uri is over ssl.""" if os.environ.get('OAUTHLIB_INSECURE_TRANSPORT'): return True return uri.lower().startswith('https://')
Simpan
Batal
Isi Zip:
Unzip
Create
Buat Folder
Buat File
Terminal / Execute
Run
Chmod Bulk
All File
All Folder
All File dan Folder
Apply