Skip to content

feat: Add OpaClient to wrap auth checks#1541

Open
tpoliaw wants to merge 5 commits into
depends-userfrom
opa-client
Open

feat: Add OpaClient to wrap auth checks#1541
tpoliaw wants to merge 5 commits into
depends-userfrom
opa-client

Conversation

@tpoliaw
Copy link
Copy Markdown
Contributor

@tpoliaw tpoliaw commented May 15, 2026

Proof of concept opa client with dependency injection and example check

@tpoliaw tpoliaw changed the title feat: Add OpaClient to wrap auth checks" feat: Add OpaClient to wrap auth checks May 15, 2026
Comment thread src/blueapi/service/main.py Fixed
@tpoliaw tpoliaw force-pushed the opa-client branch 2 times, most recently from e8ddc77 to db3325b Compare May 15, 2026 15:31
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.77%. Comparing base (e6ca161) to head (a093b5a).

Additional details and impacted files
@@               Coverage Diff                @@
##           depends-user    #1541      +/-   ##
================================================
+ Coverage         95.63%   95.77%   +0.14%     
================================================
  Files                43       44       +1     
  Lines              3228     3264      +36     
================================================
+ Hits               3087     3126      +39     
+ Misses              141      138       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tpoliaw tpoliaw changed the base branch from main to depends-user May 29, 2026 10:50
@tpoliaw tpoliaw marked this pull request as ready for review June 2, 2026 11:13
@tpoliaw tpoliaw requested a review from a team as a code owner June 2, 2026 11:13
Copy link
Copy Markdown

@fajinyuan fajinyuan left a comment

Choose a reason for hiding this comment

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

please see my questions.

Comment thread src/blueapi/config.py


class OpaConfig(BlueapiBaseModel):
root: HttpUrl = HttpUrl("http://localhost:8181")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why hard coded this URL in ? will this always the case on beamline?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The hardcoded value is a default (the opa server used in system tests) similar to the ones for numtracker and OIDC. On beamlines, this will be overwritten by the config (in the beamline's values.yaml)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for the explaination as from the codes I did see how this URL being replaced by other on beamline, I must have missed some codes that does the overwrite.

}
},
"additionalProperties": false
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I am new to cloud programming, but would like to understand why there are the same json section here as in config_schema.json above?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When deploying blueapi via helm, the config is included in the values.yaml file. When the schema of the config changes, the embedded config in the values file changes in the same way.

@tpoliaw tpoliaw requested a review from ZohebShaikh June 2, 2026 16:04
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.

2 participants