# Path: tokenserver/verifiers.py
# DEFAULT_OAUTH_SCOPE = 'https://identity.mozilla.com/apps/oldsync'
# def get_browserid_verifier(registry=None):
# def get_oauth_verifier(registry=None):
#     def __init__(self, trusted_issuers=None, allowed_issuers=None, **kwargs):
#     def _emit_warning():
#     def verify(self, assertion, audience=None):
#     def __init__(self, audiences=None, trusted_issuers=None,
#                  allowed_issuers=None, verifier_url=None, timeout=None):
#     def verify(self, assertion, audience=None):
#     def __init__(self, server_url=None, default_issuer=None, timeout=30,
#                  scope=DEFAULT_OAUTH_SCOPE, jwks=None):
#     def server_url(self):
#     def timeout(self):
#     def verify(self, token):
# class IBrowserIdVerifier(Interface):
# class IOAuthVerifier(Interface):
# class LocalBrowserIdVerifier(browserid.verifiers.local.LocalVerifier):
# class RemoteBrowserIdVerifier(object):
# class RemoteOAuthVerifier(object):


import socket
import unittest
import responses
import contextlib
import fxa.errors
from pyramid.config import Configurator
from tokenserver.verifiers import (
    IOAuthVerifier,
    ConnectionError,
    RemoteOAuthVerifier,
)
                },
            }
        )
        config = self._make_config({  # noqa; indentation below is non-standard
            "oauth.server_url":
                "https://oauth-server.my-self-hosted-setup.com/",
        })
        verifier = config.registry.getUtility(IOAuthVerifier)
        self.assertEqual(len(responses.calls), 1)
        self.assertTrue(isinstance(verifier, RemoteOAuthVerifier))
        self.assertEquals(verifier.server_url,
                          "https://oauth-server.my-self-hosted-setup.com/v1")
        self.assertEquals(verifier.default_issuer,
                          "authy.my-self-hosted-setup.com")

    @responses.activate
    def test_verifier_config_handles_missing_default_issuer(self):
        responses.add(
            responses.GET,
            "https://oauth-server.my-self-hosted-setup.com/config",
            json={
                "browserid": {
                    "oh no": "the issuer is not configured here"
                },
            }
        )
        config = self._make_config({  # noqa; indentation below is non-standard
            "oauth.server_url":
                "https://oauth-server.my-self-hosted-setup.com/",
        })

# Path: tokenserver/verifiers.py
# DEFAULT_OAUTH_SCOPE = 'https://identity.mozilla.com/apps/oldsync'
# def get_browserid_verifier(registry=None):
# def get_oauth_verifier(registry=None):
#     def __init__(self, trusted_issuers=None, allowed_issuers=None, **kwargs):
#     def _emit_warning():
#     def verify(self, assertion, audience=None):
#     def __init__(self, audiences=None, trusted_issuers=None,
#                  allowed_issuers=None, verifier_url=None, timeout=None):
#     def verify(self, assertion, audience=None):
#     def __init__(self, server_url=None, default_issuer=None, timeout=30,
#                  scope=DEFAULT_OAUTH_SCOPE, jwks=None):
#     def server_url(self):
#     def timeout(self):
#     def verify(self, token):
# class IBrowserIdVerifier(Interface):
# class IOAuthVerifier(Interface):
# class LocalBrowserIdVerifier(browserid.verifiers.local.LocalVerifier):
# class RemoteBrowserIdVerifier(object):
# class RemoteOAuthVerifier(object):


# Path: tokenserver/tests/test_oauth_verifier.py
import socket
import unittest
import responses
import contextlib
import fxa.errors
from pyramid.config import Configurator
from tokenserver.verifiers import (
    IOAuthVerifier,
    ConnectionError,
    RemoteOAuthVerifier,
)

                },
            }
        )
        config = self._make_config({  # noqa; indentation below is non-standard
            "oauth.server_url":
                "https://oauth-server.my-self-hosted-setup.com/",
        })
        verifier = config.registry.getUtility(IOAuthVerifier)
        self.assertEqual(len(responses.calls), 1)
        self.assertTrue(isinstance(verifier, RemoteOAuthVerifier))
        self.assertEquals(verifier.server_url,
                          "https://oauth-server.my-self-hosted-setup.com/v1")
        self.assertEquals(verifier.default_issuer,
                          "authy.my-self-hosted-setup.com")

    @responses.activate
    def test_verifier_config_handles_missing_default_issuer(self):
        responses.add(
            responses.GET,
            "https://oauth-server.my-self-hosted-setup.com/config",
            json={
                "browserid": {
                    "oh no": "the issuer is not configured here"
                },
            }
        )
        config = self._make_config({  # noqa; indentation below is non-standard
            "oauth.server_url":
                "https://oauth-server.my-self-hosted-setup.com/",
        })

        verifier = config.registry.getUtility(IOAuthVerifier)