003 File Manager
Current Path:
/usr/local/lib/python3.8/site-packages/salt/auth
usr
/
local
/
lib
/
python3.8
/
site-packages
/
salt
/
auth
/
📁
..
📄
__init__.py
(20.98 KB)
📁
__pycache__
📄
auto.py
(211 B)
📄
django.py
(6.47 KB)
📄
file.py
(8.37 KB)
📄
keystone.py
(943 B)
📄
ldap.py
(22.42 KB)
📄
mysql.py
(3.05 KB)
📄
pam.py
(5.76 KB)
📄
pki.py
(4.06 KB)
📄
rest.py
(1.56 KB)
📄
sharedsecret.py
(1.02 KB)
📄
yubico.py
(1.95 KB)
Editing: keystone.py
""" Provide authentication using OpenStack Keystone :depends: - keystoneclient Python module """ try: from keystoneclient.v2_0 import client from keystoneclient.exceptions import AuthorizationFailure, Unauthorized except ImportError: pass def get_auth_url(): """ Try and get the URL from the config, else return localhost """ try: return __opts__["keystone.auth_url"] except KeyError: return "http://localhost:35357/v2.0" def auth(username, password): """ Try and authenticate """ try: keystone = client.Client( username=username, password=password, auth_url=get_auth_url() ) return keystone.authenticate() except (AuthorizationFailure, Unauthorized): return False if __name__ == "__main__": __opts__ = {} if auth("test", "test"): print("Authenticated") else: print("Failed to authenticate")
Upload File
Create Folder