def test_authentication_request(self): extra_user_auth_params = {"foo": "bar", "abc": "xyz"} config = ProviderConfiguration( provider_metadata=self.PROVIDER_METADATA, client_metadata=self.CLIENT_METADATA, auth_request_params=extra_user_auth_params, ) state = "test_state" nonce = "test_nonce" facade = PyoidcFacade(config, self.REDIRECT_URI) extra_lib_auth_params = {"foo": "baz", "qwe": "rty"} auth_request = facade.authentication_request(state, nonce, self.FULL_REDIRECT_URI, extra_lib_auth_params) assert auth_request.startswith( self.PROVIDER_METADATA["authorization_endpoint"]) auth_request_params = dict(parse_qsl(urlparse(auth_request).query)) expected_auth_params = { "scope": "openid", "response_type": "code", "client_id": self.CLIENT_METADATA["client_id"], "redirect_uri": self.FULL_REDIRECT_URI, "state": state, "nonce": nonce, } expected_auth_params.update(extra_user_auth_params) expected_auth_params.update(extra_lib_auth_params) assert auth_request_params == expected_auth_params
def test_authentication_request(self): extra_user_auth_params = {'foo': 'bar', 'abc': 'xyz'} config = ProviderConfiguration( provider_metadata=self.PROVIDER_METADATA, client_metadata=self.CLIENT_METADATA, auth_request_params=extra_user_auth_params) state = 'test_state' nonce = 'test_nonce' facade = PyoidcFacade(config, REDIRECT_URI) extra_lib_auth_params = {'foo': 'baz', 'qwe': 'rty'} auth_request = facade.authentication_request(state, nonce, extra_lib_auth_params) assert auth_request.startswith( self.PROVIDER_METADATA['authorization_endpoint']) auth_request_params = dict(parse_qsl(urlparse(auth_request).query)) expected_auth_params = { 'scope': 'openid', 'response_type': 'code', 'client_id': self.CLIENT_METADATA['client_id'], 'redirect_uri': REDIRECT_URI, 'state': state, 'nonce': nonce } expected_auth_params.update(extra_user_auth_params) expected_auth_params.update(extra_lib_auth_params) assert auth_request_params == expected_auth_params