Skip to content

Commit

Permalink
Merge pull request #299 from averevki/remove-unnecessary-identities-m…
Browse files Browse the repository at this point in the history
…anipulations

Remove unnecessary identities management
  • Loading branch information
pehala authored Dec 4, 2023
2 parents 40ffea1 + 4448ce7 commit 55e1450
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def credentials(request):
@pytest.fixture(scope="module")
def authorization(authorization, api_key, credentials):
"""Add API key identity to AuthConfig"""
authorization.identity.clear_all()
authorization.identity.add_api_key(
"api_key", credentials=Credentials(credentials, "APIKEY"), selector=api_key.selector
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def credentials(request):
@pytest.fixture(scope="module")
def authorization(authorization, rhsso, credentials):
"""Add RHSSO identity to Authorization"""
authorization.identity.clear_all()
authorization.identity.add_oidc("rhsso", rhsso.well_known["issuer"], credentials=Credentials(credentials, "Token"))
return authorization

Expand Down
4 changes: 1 addition & 3 deletions testsuite/tests/kuadrant/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ def authorization_name(blame):
def authorization(authorino, kuadrant, oidc_provider, route, authorization_name, openshift, module_label):
"""Authorization object (In case of Kuadrant AuthPolicy)"""
if kuadrant:
policy = AuthPolicy.create_instance(openshift, authorization_name, route, labels={"testRun": module_label})
policy.identity.add_oidc("rhsso", oidc_provider.well_known["issuer"])
return policy
return AuthPolicy.create_instance(openshift, authorization_name, route, labels={"testRun": module_label})
return None


Expand Down
7 changes: 0 additions & 7 deletions testsuite/tests/kuadrant/reconciliation/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
import pytest


@pytest.fixture(scope="module")
def authorization(authorization):
"""Add anonymous identity"""
authorization.identity.add_anonymous("anonymous")
return authorization


@pytest.fixture(scope="module", autouse=True)
def commit(request, authorization):
"""Only commit authorization"""
Expand Down
5 changes: 3 additions & 2 deletions testsuite/tests/kuadrant/test_rate_limit_authz.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ def rate_limit(rate_limit):


@pytest.fixture(scope="module")
def authorization(authorization):
"""Adds JSON injection, that wraps the response as Envoy Dynamic Metadata for rate limit"""
def authorization(authorization, oidc_provider):
"""Adds rhsso identity and JSON injection, that wraps the response as Envoy Dynamic Metadata for rate limit"""
authorization.identity.add_oidc("rhsso", oidc_provider.well_known["issuer"])
authorization.responses.add_success_dynamic(
"identity", JsonResponse({"user": ValueFrom("auth.identity.preferred_username")})
)
Expand Down

0 comments on commit 55e1450

Please sign in to comment.