Ejemplo n.º 1
0
 def _get_auth_info(self):
     key = bakery.PrivateKey.deserialize(
         Config.objects.get_config('external_auth_key'))
     agent = Agent(
         url=self._get_url(),
         username=Config.objects.get_config('external_auth_user'))
     return AuthInfo(key=key, agents=[agent])
Ejemplo n.º 2
0
def get_auth_info():
    """Return the `AuthInfo` to authentication with Candid."""
    configs = Config.objects.get_configs(
        ['external_auth_key', 'external_auth_user', 'external_auth_url'])
    key = bakery.PrivateKey.deserialize(configs['external_auth_key'])
    agent = Agent(url=configs['external_auth_url'],
                  username=configs['external_auth_user'])
    return AuthInfo(key=key, agents=[agent])
Ejemplo n.º 3
0
    def setUp(self):
        super().setUp()
        key = PrivateKey.deserialize(
            'x0NeASLPFhOFfq3Q9M0joMveI4HjGwEuJ9dtX/HTSRY=')
        agent = Agent(url='https://auth.example.com', username='******')
        auth_info = AuthInfo(key=key, agents=[agent])
        url = 'https://rbac.example.com/'

        self.mock_request = self.patch(requests, 'request')
        self.client = RBACClient(url=url, auth_info=auth_info)
Ejemplo n.º 4
0
 def test_with_auth_info(self):
     agent = Agent(url="http://auth.example.com", username="******")
     auth_info = AuthInfo(key="a key", agents=[agent])
     client = _get_bakery_client(auth_info=auth_info)
     [interaction_method] = client._interaction_methods
     self.assertIsInstance(interaction_method, AgentInteractor)