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

Optional resource attribute enforcement #82

Merged
merged 3 commits into from
Dec 18, 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
5 changes: 1 addition & 4 deletions src/idpyoidc/server/oauth2/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,7 @@ def check_unknown_scopes_policy(request_info, client_id, context):

def validate_resource_indicators_policy(request, context, **kwargs):
if "resource" not in request:
return oauth2.AuthorizationErrorResponse(
error="invalid_target",
error_description="Missing resource parameter",
)
return request

resource_servers_per_client = kwargs["resource_servers_per_client"]
client_id = request["client_id"]
Expand Down
7 changes: 5 additions & 2 deletions tests/test_server_24_oauth2_resource_indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,11 @@ def test_authorization_code_req_no_resource(self, create_endpoint_ri_enabled):
)

msg = self.endpoint._post_parse_request(request, "client_1", endpoint_context)
assert "error" in msg
assert msg["error_description"] == "Missing resource parameter"

assert "error" not in msg
assert isinstance(msg, AuthorizationRequest)
for key, _ in request.items():
assert msg[key] == request[key]

def test_authorization_code_req_no_resource_indicators_disabled(
self, create_endpoint_ri_disabled
Expand Down
Loading