def get_client_userinfo(app_config, data_adaptor):
    """
    Return the userinfo as required by the /userinfo REST route
    """

    server_config = app_config.server_config
    dataset_config = data_adaptor.dataset_config
    auth = server_config.auth

    # make sure the configuration has been checked.
    app_config.check_config()

    if dataset_config.app__authentication_enable and auth.is_valid_authentication_type():
        userinfo = {}
        userinfo["userinfo"] = {
            "is_authenticated": auth.is_user_authenticated(),
            "username": auth.get_user_name(),
            "user_id": auth.get_user_id(),
            "email": auth.get_user_email(),
            "picture": auth.get_user_picture(),
        }
        return userinfo