Skip to content

Commit

Permalink
Merge pull request #262 from azgabur/dynamic_enovy
Browse files Browse the repository at this point in the history
Authpolicy upgrade to v2 Dynamic Envoy Metadata
  • Loading branch information
pehala authored Nov 6, 2023
2 parents 230bcc1 + ae46fba commit 0ef7127
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
25 changes: 17 additions & 8 deletions testsuite/openshift/objects/auth_config/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,27 +197,36 @@ 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."""
"""Nested dict for items wrapped as HTTP headers."""
return self.section.setdefault("success", {}).setdefault("headers", {})

@modify
def clear_success_headers(self):
"""Clears content of a success headers"""
self.success_headers.clear()
@property
def success_dynamic_metadata(self):
"""Nested dict for items wrapped as Envoy Dynamic Metadata."""
return self.section.setdefault("success", {}).setdefault("dynamicMetadata", {})

def _add(
self,
name: str,
value: dict,
wrapper: Literal["headers", "dynamicMetadata"] = "headers",
**common_features,
):
"""Add response to AuthConfig"""
"""
Add response to AuthConfig.
:param wrapper: This variable configures if the response should be wrapped as HTTP headers or
as Envoy Dynamic Metadata. Default is "headers"
"""
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 0ef7127

Please sign in to comment.