Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authpolicy upgrade to v2 Dynamic Envoy Metadata #262

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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):
pehala marked this conversation as resolved.
Show resolved Hide resolved
"""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",
jsmolar marked this conversation as resolved.
Show resolved Hide resolved
**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")
pehala marked this conversation as resolved.
Show resolved Hide resolved
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