Skip to content

Conversation

@ZohebShaikh
Copy link
Contributor

@ZohebShaikh ZohebShaikh commented Sep 26, 2025

Checklist

  • Add a Changelog entry
  • Add the ticket number which this PR closes to the comment section

@ZohebShaikh ZohebShaikh changed the title Add opa Add external Policy Decision Point for Authorization Oct 1, 2025
Base automatically changed from allow-bearer-access-token to main October 15, 2025 17:06
Comment on lines +1842 to +1845
"saml-user-attribute-mapper",
"oidc-usermodel-attribute-mapper",
"oidc-usermodel-property-mapper",
"oidc-address-mapper",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This and other changes to this file that aren't related (e.g. the list being re-order, the config being re-generated with a new UUID) makes it harder to see exactly what config is new to allow AuthZ config to work with keycloak

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to the realm-export.json can be ignored. It is only changing some small configs in the keycloak client

I can make another PR for it if it helps ?

Comment on lines 531 to 532
if not decision.result:
raise ValueError("Permission denied not able to add the node")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retur

Suggested change
if not decision.result:
raise ValueError("Permission denied not able to add the node")
if not decision.result:
return False, None

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Comment on lines -294 to -295
if self.client_id:
client.headers = {"Content-Type": "application/x-www-form-urlencoded"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this something we added?

Copy link
Contributor Author

@ZohebShaikh ZohebShaikh Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I added this..I think this might have slipped when I was doing testing to see if it was working because this header are added where it is necessary to have them

Comment on lines +426 to +428
"Not enough permissions. "
f"Requires scopes {settings.authenticator.scopes}. "
f"Request had scopes {list(scopes)}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something about the scopes in the passed token to be more explicit?

Copy link
Contributor Author

@ZohebShaikh ZohebShaikh Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It felt sufficient to me as it is the same as the one below.Plus the scopes in the token are not checked here

We will need to add scopes in keycloak client which is not the way we want our authZ to work

I scopes are coming from authZ(OPA)

@DiamondJoseph
Copy link
Contributor

We're aiming to try this out on our test beamline today 🤞
We're deploying OPA with some additional policies we need to add to make this work (the endpoints in the AccessPolicy), and Tiled built from this branch behind the oauth2_proxy service (although it is squatting on another service's DNS)

Copy link
Member

@danielballan danielballan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did your local test go?

@nmaytan took a look at this and have some quick comments.

"read:data",
"write:data",
"read:metadata",
"write:metadata",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the intent here to make public nodes world-writable? Generally I would expect world-readable, but not world-writable.

],
"public": [
"read:data",
"write:data",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tag configures what unauthenticated requests can do. Generally I would expect those would never be allowed to write (or create, register, delete).

result: Union[List[str], bool]


class ExternalPolicyDecisionPoint(AccessPolicy):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nmaytan and I wonder if the TagBasedAccessPolicy could be reused, using the tag_parser argument to inject OPA-specific integration (_get_external_decision). Most of the AccessPolicy interface will be the same across our local solution, OPA, OpenFGA, and others. The TagParser abstraction might be a more tightly-scoped way of injecting framework-specific integration.

Nate will aim to find the bandwidth to implement this suggestion as a PR into your PR. But I mention this now in case you have any immediate thoughts on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants