From 6ab9895de78bb97f56c4c4ed57a47c1bf55f273c Mon Sep 17 00:00:00 2001 From: Chen Wang Date: Mon, 24 Jun 2024 12:46:12 -0500 Subject: [PATCH] remove insecure client --- CHANGELOG.md | 7 +++++++ docs/source/modules.rst | 2 -- pyincore/__init__.py | 1 - pyincore/client.py | 21 --------------------- tests/pyincore/test_client.py | 2 +- 5 files changed, 8 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e48d19cd0..71bf9a7ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). + +## [Unreleased] + +### Changed +- Remove unused insecure IN-CORE client [#581](https://github.com/IN-CORE/pyincore/issues/581) + + ## [1.19.0] - 2024-06-12 ### Changed diff --git a/docs/source/modules.rst b/docs/source/modules.rst index 41c356929..3e9d357e2 100644 --- a/docs/source/modules.rst +++ b/docs/source/modules.rst @@ -575,8 +575,6 @@ client :members: .. autoclass:: client.IncoreClient :members: -.. autoclass:: client.InsecureIncoreClient - :members: dataservice =========== diff --git a/pyincore/__init__.py b/pyincore/__init__.py index 6e7b7e558..f0387038e 100644 --- a/pyincore/__init__.py +++ b/pyincore/__init__.py @@ -8,7 +8,6 @@ # The order of import matters. You need to import module by order of dependency from pyincore.client import Client from pyincore.client import IncoreClient -from pyincore.client import InsecureIncoreClient from pyincore.hazardservice import HazardService from pyincore.utils.expressioneval import Parser from pyincore.utils.cge_ml_file_util import CGEMLFileUtil diff --git a/pyincore/client.py b/pyincore/client.py index 966f81c14..0267b1dd8 100644 --- a/pyincore/client.py +++ b/pyincore/client.py @@ -422,24 +422,3 @@ def clear_cache(self): # clear entry from service.json update_hash_entry("edit", hashed_url=self.hashed_service_url) return - - -class InsecureIncoreClient(Client): - """IN-CORE service client class that bypasses Ambassador auth. It contains token and service root url. - - Args: - service_url (str): Service url. - username (str): Username string. - - """ - - def __init__(self, service_url: str = None, username: str = None): - super().__init__() - if service_url is None or len(service_url.strip()) == 0: - service_url = pyglobals.INCORE_API_PROD_URL - self.service_url = service_url - if username is None or len(username.strip()) == 0: - self.session.headers["x-auth-userinfo"] = pyglobals.INCORE_LDAP_TEST_USER_INFO - else: - user_info = "{\"preferred_username\": \"" + username + "\"}" - self.session.headers["x-auth-userinfo"] = user_info diff --git a/tests/pyincore/test_client.py b/tests/pyincore/test_client.py index fa77cdad7..aa1243bfa 100644 --- a/tests/pyincore/test_client.py +++ b/tests/pyincore/test_client.py @@ -8,7 +8,7 @@ import pytest import requests -from pyincore import Client, IncoreClient, InsecureIncoreClient, DataService +from pyincore import Client, IncoreClient, DataService def test_client_success(monkeypatch):