Saravanan666/pypi-org huggingface dataset:
Package: oauth2-proxy
Flask application to serve static files to authenticated users (via OAuth 2 authorization flow).$sudopip3install-rrequirements.txt$python3-moauth2_proxy.appEnvironment VariablesThe following environment variables can be used for configuration:APP_DEBUGEnable debug output via HTTP by setting this property totrue. Do not set this flag in production.APP_ROOT_DIRDirectory to serve static files from.APP_SECRET_KEYRandom secret key to sign the session cookie.APP_URLBase URL of the application (needed for OAuth 2 redirect).CREDENTIALS_DIRDirectory containing client.json
Package: oauth2-proxy-cookie
Support library to be used withbitly/oauth2_proxyto validate and decode the Cookie
passed upstream. The library provide a Flask extension to authorize requests
based on the Cookie.The reference implementation in Go is locatedhere.Examplefromflaskimportrequest,abortfromoauth2_proxy_cookieimportValidatorsecret=<oauth2_proxycookiesecret>validator=Validator(secret,'_oauth2_proxy')cookie=request.headers.get('Cookie')value,time=validator.validate(cookie)Or with Flask extension:fromflaskimportrequest,abortfromoauth2_proxy_cookieimportValidatorapp=flask.Flask('Foo')oauth2_proxy=OAuth2ProxyCookie()oauth2_proxy.init_app(app,allowed=['/public_path'])
Package: oauth2-proxy-cookie-256
Support library to be used withbitly/oauth2_proxyto validate and decode the Cookie
passed upstream. The library provide a Flask extension to authorize requests
based on the Cookie.The reference implementation in Go is locatedhere.Forked fromhttps://github.com/isra17/oauth2-proxy-cookieto modify sign from sha1 to sha256.Examplefromflaskimportrequest,abortfromoauth2_proxy_cookieimportValidatorsecret=<oauth2_proxycookiesecret>validator=Validator(secret,'_oauth2_proxy')cookie=request.headers.get('Cookie')value,time=validator.validate(cookie)Or with Flask extension:fromflaskimportrequest,abortfromoauth2_proxy_cookieimportValidatorapp=flask.Flask('Foo')app.config.OAUTH2_PROXY_COOKIE_SECRET=<oauth2_proxycookiesecret>oauth2_proxy=OAuth2ProxyCookie(force_https=True,allowed=['/public_path'])oauth2_proxy.init_app(app)
Package: oauth2py
oauth2pya simple, lightweight oauth clientrequirepython 2.7+python 3.3+supported[x] Weibo[x] QQ[x] Facebook[x] Github[x] Twitter[ ] Other…useagecreate clientputoauth2py.jsonin your app root folder[{"name":"github","client_id":"","client_secret":"","redirect_uri":"","scope":""},{"name":"twitter","client_id":"","client_secret":"","redirect_uri":"","scope":""}]fromoauth2py.clientimportOauthClientasoauthgithub=oauth.load('github')or set config in codegithub.init({'client_id':'','client_secret':'','redirect_uri':'','scope':''})oauthget login urlurl=github.get_login_url(state='abc')get user infouser=github.get_user_info('code=12345&state=abc')# oruser=github.get_user_info({'code':'12345','state':'abc'})save access tokentoken=github.get_access_token()# save token ...access resourceget github repo listgithub.set_access_token({'access_token':'...'})github.access_resource('GET','https://api.github.com/user/repos')another example: post status to twittertwitter.set_access_token({'access_token':'...','access_token_secret':'...'})twitter.access_resource('POST',url='https://api.twitter.com/1.1/statuses/update.json',data={'status':'test from oauth2py!'})implement new providersinheritoauth2py.Oauth2oroauth2py.Oauthand set oauth urlsclassGithub(Oauth2):NAME='Github'AUTHORIZATION_URL='https://github.com/login/oauth/authorize'ACCESS_TOKEN_URL='https://github.com/login/oauth/access_token'GET_USERINFO_URL='https://api.github.com/user'def__init__(self):super(Github,self).__init__()parse user info from responsedefparse_user_info(self,response):return{'uid':str(response.get('id')),'name':response.get('name'),'avatar':response.get('avatar_url'),'raw':response}
Package: oauth2token
Simple cli tools to create and use oauth2tokenConfigurationYou need to createconfig.jsonandscopes.jsonat$XDG_CONFIG_HOME/oauth2token/<provider>/for each provider you want
to use.config.jsonThe main configuration file.
Follow the format onclient_secret.json, using your own information obtained
from your provider.Example (Just change theclient_idandclient_secretvalues to
the ones you got from Google):{"web":{"client_id":"asdfjasdljfasdkjf","client_secret":"1912308409123890","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://accounts.google.com/o/oauth2/token"}}scopes.jsonThe scope your application needs. It’s a json array containing the URLs.Example :["https://mail.google.com/"]Usageoauth2create<provider> <account>Obtain and store credentials for the account in$XDG_DATA_HOME/oauth2token/<provider>/<account>, using the configuration
for that provider. It opens a browser where you’ll need to log in the account
you want to use.oauth2get<provider> <account>Output the access token for that account, refreshing it if needed with the
associated refresh token.
Package: oauth2tools
OAuth2ToolsA toolset for the most requirements dealing with OAuth2 and OpenID Connect.SamplesBuilding the URL for the authentication endpointfrom oauth2tools import OAuthTools

tools = OAuthTools(
    well_known_url="<url>", 
    client_id="<cid>", 
    client_secret="<secret>")
auth_url = tools.authorization_url(redirect_uri="<uri>")Using the Browser in a CLI script for authenticationfrom oauth2tools import OAuth4CLI

o4c = OAuth4CLI(
    well_known_url="<url>", 
    client_id="<cid>", 
    client_secret="<secret>")
response = o4c.login()
access_token = response.get('access_token')Validate an received tokenfrom oauth2tools import jwt_helper

try:
    jwt_helper.validate_by_jwks(
        token="<jwt>", 
        jwks_url="<jwks_url>",
        claims={"<claim_name>": "expected_value"})
except Exception as e:
    ...
Package: oauthenticator
OAuth + JupyterHub Authenticator = OAuthenticator :heart:OAuthis a token based login mechanism that doesn't rely on a username and password mapping.
In order to use this login mechanism with JupyerHub the login handlers need to be overridden.
OAuthenticator overrides these handlers for the common OAuth2 identity providers allowing them to be
plugged in and used with JupyterHub.The following authentication services are supported through their own authenticator:Auth0,Azure AD,Bitbucket,CILogon,FeiShu,GitHub,GitLab,Globus,Google,MediaWiki,OpenShift.There is also aGenericAuthenticatorthat can be configured with any OAuth 2.0 identity provider or can be used
to create a new authenticator class when additional customization is needed.InstallationThe installation guide can be found in thedocs.Thedocsalso provide example setups for different OAuth2 identity providers.Running testsTo run the tests locally, first setup a development environment as described inCONTRIBUTING.md, and then do:pytest -v ./oauthenticator/tests/Or you run a specific test file with:pytest -v ./oauthenticator/tests/<test-file-name>
Package: oauthenticator-plus
OAuth + JupyterHub Authenticator = OAuthenticator :heart:OAuthis a token based login mechanism that doesn't rely on a username and password mapping.
In order to use this login mechanism with JupyerHub the login handlers need to be overridden.
OAuthenticator overrides these handlers for the common OAuth2 identity providers allowing them to be
plugged in and used with JupyterHub.The following authentication services are supported through their own authenticator:Auth0,Azure AD,Bitbucket,CILogon,FeiShu,GitHub,GitLab,Globus,Google,MediaWiki,Okpy,OpenShift.There is also aGenericAuthenticatorthat can be configured with any OAuth 2.0 identity provider or can be used
to create a new authenticator class when additional customization is needed.InstallationThe installation guide can be found in thedocs.The docs also provide example setups for different OAuth2 identity providers:General SetupAzure ADFeiShuGitHubGitLabGoogleOpenShiftOkpyGlobusMoodleYandexRunning testsTo run the tests locally:$ pip install --upgrade --pre -r test-requirements.txt$ pytest -v ./oauthenticator/tests/Or you run a specific test file with:$ pytest -v ./oauthenticator/tests/<test-file-name>
Package: oauther
This project is based onhttp://github.com/leah/python-oauth,
but only the client is used.Done> Split the source file into several modules
> Edited the OAuthClient class to do more easy to use in client
> applications only.Use examples:> To extending the OAuthClient,git@github.com:carlitux/twython.git could be used
> as an example.
> To do a client app using this, there is an example here
>http://github.com/carlitux/ITwittBookthis app is implemented
> by me for learning purpose.
Package: oauth-jaccount
python-oauth-jaccountInstallationpipinstalloauth-jaccountOr addoauth-jaccountintorequirements.txt.Usage (Example)fromoauth_jaccountimportJaccountClientclient=JaccountClient(client_id="client_id",client_secret="client_secret")# Suppose you are using flask-like web frameworkfromflaskimportredirect,sessionfromyour_great_projectimportapp# The redirect url must be the same in both authorization and get_token!REDIRECT_URL="https://example.com/jaccount/auth"# This route is used by user@app.get("/jaccount/login")defjaccount_login():url,state=client.get_authorize_url(REDIRECT_URL)# url is the redirect url sent to the browser# state is a random string, you can save it to verify the client request# (optional but more secure) save the state in sessionsession['jaccount_state']=statereturnredirect(url)# This route is used by jaccount server# We set it in REDIRECT_URL so that the server can redirect the browser to it# The server will send back the random state and a code@app.get("/jaccount/auth")defjaccount_auth(state:str,code:str):# (optional but more secure) verify the state in sessionifstate!=session.get('jaccount_state',''):returnredirect("url after login error")access_token,refresh_token,id_token=client.get_token(code,REDIRECT_URL)# access_token is used for api calls (has an expire time)# refresh_token can get a new access_token with refreshed expire time# id_token is a dict (parsed from jwt) with the basic information of a user# the format is defined by# {#   aud: str   # client_id#   iss: str   # 'https://jaccount.sjtu.edu.cn/oauth2/'#   sub: str   # jaccount username#   exp: str   # expiration time (UNIX epoch)#   iat: str   # issue time (UNIX epoch)#   name: str  # real name#   code: str  # seems empty?#   type: str  # jaccount type (student/faculty/alumni)# }# usually id_token is enough for your application# If you want to call other jaccount apis, you can useresult=client.call_rest_api(access_token,JaccountClient.API.PROFILE)# most jaccount id/secret can only access a limited range of apis (e.g., API.PROFILE)# the API list in JaccountClient.API is copied from an old version of jaccount documentation# they are not guaranteed to work properly in the futurereturnredirect("url after login")# This route is used by user, use it to clear jaccount cookies# If you do not logout the user before new user login,# there will be a problem: since the cookies are not cleared,# the jaccount server will induce that the previous user is still active,# so that the username/password page will be skipped and the previous user logins directly@app.get("/jaccount/logout")defjaccount_logout():# note that this redirect_url is usually different from REDIRECT_URLredirect_url="url after logout"url=client.get_logout_url(redirect_url)returnredirect(url)Advance Usageget_tokenandcall_rest_apihave more flexible version:get_token_urlandget_rest_api_url. You can use them to get the corresponding urls if you want to call them by yourselves (e.g., useaiohttpto make async requests).You may check the source code for details.LicenseMIT
Package: oauthkit-google
oauthkit-googleOAuthKit for GoogleDevelopment environmentTo setup development environment:virtualenv -p python2.7 .
bin/pip install -U setuptools pip pip-tools
make
make testChanges0.1.2 (2018-11-05)Enhance GoogleClientSecret struct.0.1.1 (2018-11-04)Change how to create proxies.Removevalidateclass methods.requires jsonable-objects >= 0.1.40.1.0 (2018-10-31)Initial release.
Package: oauthlib
A generic, spec-compliant, thorough implementation of the OAuth request-signing
logic for Python 3.6+.OAuth often seems complicated and difficult-to-implement. There are several
prominent libraries for handling OAuth requests, but they all suffer from one or
both of the following:They predate theOAuth 1.0 spec, AKA RFC 5849.They predate theOAuth 2.0 spec, AKA RFC 6749.They assume the usage of a specific HTTP request library.OAuthLib is a framework which implements the logic of OAuth1 or OAuth2 without
assuming a specific HTTP request object or web framework. Use it to graft OAuth
client support onto your favorite HTTP library, or provide support onto your
favourite web framework. If you’re a maintainer of such a library, write a thin
veneer on top of OAuthLib and get OAuth support for very little effort.DocumentationFull documentation is available onRead the Docs. All contributions are very
welcome! The documentation is still quite sparse, please open an issue for what
you’d like to know, or discuss it in ourGitter community, or even better, send a
pull request!Interested in making OAuth requests?Then you might be more interested in usingrequestswhich has OAuthLib
powered OAuth support provided by therequests-oauthliblibrary.Which web frameworks are supported?The following packages provide OAuth support using OAuthLib.For Django there isdjango-oauth-toolkit, which includesDjango REST frameworksupport.For Flask there isflask-oauthlibandFlask-Dance.For Pyramid there ispyramid-oauthlib.For Bottle there isbottle-oauthlib.If you have written an OAuthLib package that supports your favorite framework,
please open a Pull Request, updating the documentation.Using OAuthLib? Please get in touch!Patching OAuth support onto an http request framework? Creating an OAuth
provider extension for a web framework? Simply using OAuthLib to Get Things Done
or to learn?No matter which we’d love to hear from you in ourGitter communityor if you have
anything in particular you would like to have, change or comment on don’t
hesitate for a second to send a pull request or open an issue. We might be quite
busy and therefore slow to reply but we love feedback!Chances are you have run into something annoying that you wish there was
documentation for, if you wish to gain eternal fame and glory, and a drink if we
have the pleasure to run into each other, please send a docs pull request =)LicenseOAuthLib is yours to use and abuse according to the terms of the BSD license.
Check the LICENSE file for full details.CreditsOAuthLib has been started and maintained several years by Idan Gazit and other
amazingAUTHORS. Thanks to their wonderful work, the open-sourcecommunitycreation has been possible and the project can stay active and reactive to users
requests.ChangelogOAuthLib is in active development, with the core of both OAuth1 and OAuth2
completed, for providers as well as clients.Seesupported featuresfor
details.For a full changelog seeCHANGELOG.rst.
Package: oauthlib-activecampaign
A generic, spec-compliant, thorough implementation of the OAuth request-signing
logic for Python 2.7 and 3.4+.OAuth often seems complicated and difficult-to-implement. There are several
prominent libraries for handling OAuth requests, but they all suffer from one or
both of the following:They predate theOAuth 1.0 spec, AKA RFC 5849.They predate theOAuth 2.0 spec, AKA RFC 6749.They assume the usage of a specific HTTP request library.OAuthLib is a framework which implements the logic of OAuth1 or OAuth2 without
assuming a specific HTTP request object or web framework. Use it to graft OAuth
client support onto your favorite HTTP library, or provide support onto your
favourite web framework. If you’re a maintainer of such a library, write a thin
veneer on top of OAuthLib and get OAuth support for very little effort.DocumentationFull documentation is available onRead the Docs. All contributions are very
welcome! The documentation is still quite sparse, please open an issue for what
you’d like to know, or discuss it in ourGitter community, or even better, send a
pull request!Interested in making OAuth requests?Then you might be more interested in usingrequestswhich has OAuthLib
powered OAuth support provided by therequests-oauthliblibrary.Which web frameworks are supported?The following packages provide OAuth support using OAuthLib.For Django there isdjango-oauth-toolkit, which includesDjango REST frameworksupport.For Flask there isflask-oauthlibandFlask-Dance.For Pyramid there ispyramid-oauthlib.For Bottle there isbottle-oauthlib.If you have written an OAuthLib package that supports your favorite framework,
please open a Pull Request, updating the documentation.Using OAuthLib? Please get in touch!Patching OAuth support onto an http request framework? Creating an OAuth
provider extension for a web framework? Simply using OAuthLib to Get Things Done
or to learn?No matter which we’d love to hear from you in ourGitter communityor if you have
anything in particular you would like to have, change or comment on don’t
hesitate for a second to send a pull request or open an issue. We might be quite
busy and therefore slow to reply but we love feedback!Chances are you have run into something annoying that you wish there was
documentation for, if you wish to gain eternal fame and glory, and a drink if we
have the pleasure to run into eachother, please send a docs pull request =)LicenseOAuthLib is yours to use and abuse according to the terms of the BSD license.
Check the LICENSE file for full details.CreditsOAuthLib has been started and maintained several years by Idan Gazit and other
amazingAUTHORS. Thanks to their wonderful work, the open-sourcecommunitycreation has been possible and the project can stay active and reactive to users
requests.ChangelogOAuthLib is in active development, with the core of both OAuth1 and OAuth2
completed, for providers as well as clients.Seesupported featuresfor
details.For a full changelog seeCHANGELOG.rst.
Package: oauth-middleware
# WSGI middleware for OAuth
[![Build Status](https://travis-ci.org/last-g/oauth_middleware.svg?branch=master)](https://travis-ci.org/last-g/oauth_middleware)This is simple (not really) middleware based on flask_oauthlib that provides
full protection with oauth for your WSGI application.Featuressupport for any WSGI based applicationweb-based authenticationbasic auth with token authentication for scriptsInstallation:pip install oauth_middlewareorjust mentionoauth_middlewarein your requirements
Package: oauthnesia
OAUTHnesia for PythonA Python module to interact with Urbanesia’s OAUTH v1.0a API usingrequestsandrequests-oauthlib:Examplefrom oauthnesia import oauthnesia

urb = oauthnesia(cons_key="xxxxxx", cons_sec="xxxxxx")

print "OAUTH Request"
print urb.call(uri='get/super_search', post=None, get={
    'what': 'steak'
})

print "\nXAUTH Request"
print urb.xauth('URBANESIA EMAIL', 'URBANESIA PASSWORD')Available at <https://github.com/tistaharahap/python-bayes-redis/blob/master/test.py>Get AccessRegister at Urbanesia - <https://www.urbanesia.com/auth/register>Go here to register your application and receive consumer tokens by email - <http://v1.urbanesia.com/auth/api_reg/>
Package: oauth-slave-accounts
If you’ve read RFCs on OAuth or (more likely) thedjango-oauth-toolkitdocs, you know that aRessource Serversorts
of delegates user authentication to theAuthorization Server.But the current implementation inDjango OAuth Toolkitonly copies the username from theAuthorization Serverin its
database. This implies that all users have no special permissions, i.e. you lose administrator rights when you access
theRessource Server!The class FullUserOAuthBackend aims to fix this by fetching the full user model from theAuthorization Serverafter
you’ve accessed theRessource Server.Installationpip install oauth-slave-accountsSetupAuthorization ServerYou need to create an endpoint that exposes user data in a json manner (or further override my methods), the easiest being
a DjangoRestFramework ModelViewset.
The current implementation uses the user’s Authorization token aslookup_field.classUserViewSet(viewset.ReadOnlyModelViewSet):queryset=User.objects.all()serializer_class=UserSerializerpermission_classes=[ServerServerPermission]defget_object(self):returnAccessToken.objects.get(token=self.kwargs.get('pk')).userpro tip:you should exclude the password from the serializer, because its confidential even if salted, and furthermore its useability probably depends on theSECRET_KEYRessource ServerSubclassressource_server_utils.backend.FullUserOAuthBackendand override the following :property fetch_url : a string that describes yourAuthorization Server’s endpoint to get User data e.g.http://auth.srv/user/{}/property UserSerializer : a DjangoRestFramework Serializer that defines how to parse yourAuthorization Server’s responseAnd optionnallymethod get_auth_token()method refresh_auth_token()
Package: oauth-tools
An easy interface for Microsoft Office 365 Oauth Device Code authentication.Installpip install oauth_toolsExamplefrom oauth_tools import AuthManager
import webbrowser
import creds
import os

if not os.path.exists('users.json'):
    open('users.json', mode='wt').write(json.dumps({}))

authManager = AuthManager(
    # Get your client/tenant ID by following these instructions:
    # https://docs.microsoft.com/en-us/azure/storage/common/storage-auth-aad-app
    microsoftClientID=creds.clientID,
    microsoftTenantID=creds.tenantID,
)

authManager.SaveIncompleteOACallback = lambda ID, data: open('incomplete.json', mode='wt').write(
    json.dumps({ID: data}, indent=2))
authManager.GetIncompleteOACallback = lambda ID: json.loads(open('incomplete.json', mode='rt').read()).get(ID, None)

authManager.SaveToDBCallback = lambda ID, data: open('users.json', mode='wt').write(
    json.dumps({ID: data}, indent=2))
authManager.GetFromDBCallback = lambda ID: json.loads(open('users.json', mode='rt').read()).get(ID, None)

MY_ID = 'Grant'

user = authManager.GetUserByID(MY_ID)
if user is None:
    # the user has not authenticated before
    d = authManager.CreateNewUser(MY_ID)
    webbrowser.open(d['verification_uri'])
    print('Enter the code', d['user_code'])

    while True:
        time.sleep(d['interval'])
        status = authManager.CheckOAStatus(MY_ID)
        print('status=', status)
        if status == 'Success':
            break

    user = authManager.GetUserByID(MY_ID)

print('user=', user)The output looks like>>> Enter the code A4S4QS4EG
>>> status= Waiting for user to authenticate
>>> status= Success
>>> user= <User: ID=Grant, EmailAddress=grant@grant-miller.com, AccessToken=abcdefghijklm...>