How to use the oauthenticator.OAuthenticator function in oauthenticator

To help you get started, we’ve selected a few oauthenticator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterhub / oauthenticator / oauthenticator / mediawiki.py View on Github external
class MWCallbackHandler(OAuthCallbackHandler):
    """
    Override OAuthCallbackHandler to take out state parameter handling.

    mwoauth doesn't seem to support it for now!
    """

    def check_arguments(self):
        pass

    def get_state_url(self):
        return None


class MWOAuthenticator(OAuthenticator):
    login_service = 'MediaWiki'
    login_handler = MWLoginHandler
    callback_handler = MWCallbackHandler

    mw_index_url = Unicode(
        os.environ.get('MW_INDEX_URL', 'https://meta.wikimedia.org/w/index.php'),
        config=True,
        help='Full path to index.php of the MW instance to use to log in'
    )

    executor_threads = Integer(12,
        help="""Number of executor threads.

        MediaWiki OAuth requests happen in this thread,
        so it is mostly waiting for network replies.
        """,
github jupyter-attic / jupyterhub-carina / jupyterhub_carina / CarinaAuthenticator.py View on Github external
from oauthenticator import OAuthLoginHandler, OAuthenticator
from .CarinaOAuthClient import CarinaOAuthClient


class CarinaLoginHandler(OAuthLoginHandler, OAuth2Mixin):
    """
    Carina OAuth dance magic
    """

    _OAUTH_AUTHORIZE_URL = CarinaOAuthClient.CARINA_AUTHORIZE_URL
    _OAUTH_ACCESS_TOKEN_URL = CarinaOAuthClient.CARINA_TOKEN_URL

    scope = ['identity', 'read', 'write', 'execute']


class CarinaAuthenticator(OAuthenticator, LoggingConfigurable):
    """
    Authenticate users with their Carina account
    """

    # Configure the base OAuthenticator
    login_service = 'Carina'
    login_handler = CarinaLoginHandler

    _carina_client = None
    @property
    def carina_client(self):
        if self._carina_client is None:
            self._carina_client = CarinaOAuthClient(self.client_id, self.client_secret, self.oauth_callback_url)

        return self._carina_client