Skip to content

Commit c46e121

Browse files
paaragonElePT
andauthored
fix: remove old iqp authentication (#1788)
* fix: remove old iqp authentication * Update gateway/api/authentication.py Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com> * add release notes --------- Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
1 parent b20f53b commit c46e121

File tree

11 files changed

+16
-444
lines changed

11 files changed

+16
-444
lines changed

client/requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
coverage>=5.5
2-
pylint>=2.17.7
2+
pylint>=3.0.0
33
nbqa>=1.7.1
44
treon>=0.1.4
55
pytest>=6.2.5

gateway/api/authentication.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,17 @@ def authenticate(self, request):
3737

3838
crn = request.META.get("HTTP_SERVICE_CRN", None)
3939
channel_header = request.META.get("HTTP_SERVICE_CHANNEL", None)
40-
# This is to maintain backwards compatibility with previous user patterns.
41-
# In qiskit-serverless <=0.24.0 , the channel input was not provided to the
42-
# authenticator, but inferred from other inputs:
43-
# - IQP use case: Catalog(token=""")
44-
# - IBM cloud use case: Catalog(channel=", token="", crn="")
45-
46-
if channel_header is None and crn is None:
47-
channel_header = Channel.IBM_QUANTUM.value
48-
if channel_header is None and crn is not None:
40+
41+
if channel_header is None:
4942
channel_header = Channel.IBM_QUANTUM_PLATFORM.value
43+
5044
try:
5145
channel = Channel(channel_header)
5246
except ValueError as error:
5347
logger.warning("Channel value [%s] is not valid.", channel_header)
5448
raise exceptions.AuthenticationFailed(
5549
"The value of the channel is not correct. Verify that you are using one of these: "
56-
f"{Channel.IBM_QUANTUM.value}, {Channel.IBM_CLOUD.value}, "
57-
f"{Channel.IBM_QUANTUM_PLATFORM.value}"
50+
f"{Channel.IBM_CLOUD.value}, {Channel.IBM_QUANTUM_PLATFORM.value}"
5851
) from error
5952

6053
# Specific logic to guarantee access to public end-points

gateway/api/domain/authentication/channel.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ class Channel(str, Enum):
99
"""
1010
Channel values for the authentication process:
1111
- IBM_CLOUD
12-
- IBM_QUANTUM
1312
- IBM_QUANTUM_PLATFORM
1413
- LOCAL
1514
"""
1615

1716
IBM_CLOUD = "ibm_cloud"
18-
IBM_QUANTUM = "ibm_quantum"
1917
IBM_QUANTUM_PLATFORM = "ibm_quantum_platform"
2018
LOCAL = "local"

gateway/api/services/authentication/ibm_quantum.py

Lines changed: 0 additions & 187 deletions
This file was deleted.

gateway/api/use_cases/authentication.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from api.services.authentication.authentication_base import AuthenticationBase
1414
from api.services.authentication.ibm_quantum_platform import IBMQuantumPlatform
1515
from api.services.authentication.local_authentication import LocalAuthenticationService
16-
from api.services.authentication.ibm_quantum import IBMQuantum
1716
from api.domain.authentication.channel import Channel
1817

1918

@@ -47,10 +46,6 @@ def _get_authentication_service_instance(self) -> AuthenticationBase:
4746
)
4847
return IBMQuantumPlatform(api_key=self.authorization_token, crn=self.crn)
4948

50-
if self.channel == Channel.IBM_QUANTUM:
51-
logger.debug("Authentication will be executed with IQP.")
52-
return IBMQuantum(authorization_token=self.authorization_token)
53-
5449
logger.debug("Authentication will be executed with Local service.")
5550
return LocalAuthenticationService(authorization_token=self.authorization_token)
5651

gateway/api/utils.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,11 @@ def build_env_variables( # pylint: disable=too-many-positional-arguments
161161
extra = {
162162
"QISKIT_IBM_INSTANCE": str(instance),
163163
}
164-
# pylint: disable=fixme
165-
# TODO: remove this path once iqp classic is sunset for all users
166-
if channel.value == Channel.IBM_QUANTUM.value:
167-
url = "https://auth.quantum.ibm.com/api"
168-
else:
169-
url = settings.QISKIT_IBM_URL
170164
extra.update(
171165
{
172166
"QISKIT_IBM_TOKEN": str(token),
173167
"QISKIT_IBM_CHANNEL": channel.value,
174-
"QISKIT_IBM_URL": url,
168+
"QISKIT_IBM_URL": settings.QISKIT_IBM_URL,
175169
}
176170
)
177171

gateway/api/views/programs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def run(self, request): # pylint: disable=too-many-locals
241241
carrier = {}
242242
TraceContextTextMapPropagator().inject(carrier)
243243
arguments = serializer.data.get("arguments")
244-
channel = Channel.IBM_QUANTUM
244+
channel = Channel.IBM_QUANTUM_PLATFORM
245245
token = ""
246246
instance = None
247247
if request.auth:

0 commit comments

Comments
 (0)