Skip to content

Commit

Permalink
Authpolicy upgrade to v2 dynamic envoy
Browse files Browse the repository at this point in the history
  • Loading branch information
azgabur committed Nov 2, 2023
1 parent 37a26c4 commit bf3b556
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
28 changes: 21 additions & 7 deletions testsuite/openshift/objects/auth_config/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,27 +197,41 @@ def add_uma(self, name, endpoint, credentials_secret, **common_features):


class ResponseSection(Section):
"""Section which contains response configuration. todo envoyDynamicMetadata"""
"""Section which contains response configuration."""

@property
def success_headers(self):
"""Nested dict for most of the section."""
return self.section.setdefault("success", {}).setdefault("headers", {})
def success(self):
"""Nested dict for success dictionary."""
return self.section.setdefault("success", {})

@modify
def clear_success_headers(self):
"""Clears content of a success headers"""
def clear_success(self):
"""Clears content of a success dictionary."""
self.success_headers.clear()

@property
def success_headers(self):
"""Nested dict for items wrapped as HTTP headers."""
return self.success.setdefault("headers", {})

@property
def success_dynamic_metadata(self):
"""Nested dict for items wrapped as Envoy Dynamic Metadata."""
return self.success.setdefault("dynamicMetadata", {})

def _add(
self,
name: str,
value: dict,
wrapper: Literal["headers", "dynamicMetadata"] = "headers",
**common_features,
):
"""Add response to AuthConfig"""
add_common_features(value, **common_features)
self.success_headers.update({name: value})
if wrapper == "headers":
self.success_headers.update({name: value})
if wrapper == "dynamicMetadata":
self.success_dynamic_metadata.update({name: value})

def add_simple(self, auth_json: str, name="simple", key="data", **common_features):
"""
Expand Down
4 changes: 1 addition & 3 deletions testsuite/tests/kuadrant/authorino/wristband/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ def wristband_endpoint(openshift, authorino, authorization_name):
@pytest.fixture(scope="module")
def authorization(authorization, wristband_secret, wristband_endpoint) -> AuthConfig:
"""Add wristband response with the signing key to the AuthConfig"""
authorization.responses.add_wristband(
"wristband", wristband_endpoint, wristband_secret, wrapper="envoyDynamicMetadata"
)
authorization.responses.add_wristband("wristband", wristband_endpoint, wristband_secret, wrapper="dynamicMetadata")
return authorization


Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
"""Test api authentication with wristband-token that was acquired after authentication on the edge layer"""
import pytest
from jose import jwt

pytest.skip("Envoy dynamic metadata not yet implemented due to v1beta2 AuthConfig change", allow_module_level=True)


def test_wristband_token_claims(oidc_provider, auth, wristband_token, wristband_endpoint, certificates):
"""Verify acquired jwt token claims"""
Expand Down

0 comments on commit bf3b556

Please sign in to comment.