def test_no_userinfo_request_is_made_if_no_userinfo_endpoint_is_configured(
         self):
     facade = PyoidcFacade(
         ProviderConfiguration(provider_metadata=self.PROVIDER_METADATA,
                               client_metadata=self.CLIENT_METADATA),
         REDIRECT_URI)
     assert facade.userinfo_request('test_token') is None
 def test_no_userinfo_request_is_made_if_no_access_token(self):
     provider_metadata = self.PROVIDER_METADATA.copy(
         userinfo_endpoint=self.PROVIDER_BASEURL + '/userinfo')
     facade = PyoidcFacade(
         ProviderConfiguration(provider_metadata=provider_metadata,
                               client_metadata=self.CLIENT_METADATA),
         REDIRECT_URI)
     assert facade.userinfo_request(None) is None
예제 #3
0
 def test_no_userinfo_request_is_made_if_no_userinfo_http_method_is_configured(
         self):
     facade = PyoidcFacade(
         ProviderConfiguration(
             provider_metadata=self.PROVIDER_METADATA,
             client_metadata=self.CLIENT_METADATA,
             userinfo_http_method=None,
         ),
         self.REDIRECT_URI,
     )
     assert facade.userinfo_request("test_token") is None
예제 #4
0
    def test_configurable_userinfo_endpoint_method_is_used(self, userinfo_http_method):
        userinfo_endpoint = self.PROVIDER_BASEURL + '/userinfo'
        userinfo_response = OpenIDSchema(sub='user1')
        responses.add(userinfo_http_method, userinfo_endpoint, json=userinfo_response.to_dict())

        provider_metadata = self.PROVIDER_METADATA.copy(userinfo_endpoint=userinfo_endpoint)
        facade = PyoidcFacade(ProviderConfiguration(provider_metadata=provider_metadata,
                                                    client_metadata=self.CLIENT_METADATA,
                                                    userinfo_http_method=userinfo_http_method),
                              self.REDIRECT_URI)
        assert facade.userinfo_request('test_token') == userinfo_response