使用LEAP平台进行身份验证的库
leap.auth的Python项目详细描述
此库可用于在LEAP平台中验证和管理密码。 它使用Secure Remote Password protocol。
要安装它:
$ pip install leap.auth
使用它:
fromleap.authimportSRPAuthapi_uri='https://api.leap.platform:4430/'ca_cert_path='./path_to_certificate.crt'# TIP: the certificate is usually at https://api.leap.platform/ca.crtuser='username'password='longandsecurepassword'srp_auth=SRPAuth(api_uri,ca_cert_path)# register a usersrp_auth.register(user,password)# authenticate with the defined LEAP server using the registered credentialsauth=srp_auth.authenticate(user,password)# then you can access:auth.usernameauth.session_idauth.uuidauth.token# changes the authenticated user password using the authentication datasrp_auth.change_password(username,current_password,new_password,auth.token,auth.uuid)# deletes the session on the server and resets the session locallysrp_auth.logout()