Skip to content

[RFC] Data Authorizaton Middleware#1213

Merged
MikeNeilson merged 1 commit into
developfrom
docs/rfc/0001-data-authorization-middleware
Sep 2, 2025
Merged

[RFC] Data Authorizaton Middleware#1213
MikeNeilson merged 1 commit into
developfrom
docs/rfc/0001-data-authorization-middleware

Conversation

@vairav
Copy link
Copy Markdown
Collaborator

@vairav vairav commented Aug 5, 2025

Summary

  • RFC for the Data Authorization Middleware

Copy link
Copy Markdown
Contributor

@MikeNeilson MikeNeilson left a comment

Choose a reason for hiding this comment

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

Some minor picks that will really only matter at time of implementation. Otherwise everything seems reasonable to me.

Will wait on feedback from others.

public ResponseEntity<List<TimeSeries>> getTimeSeries(
String office, Context ctx) {

QueryBuilder query = QueryBuilder.create().table("cwms_ts_data");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The table information would either not be known at this point or possibly meaningless.

What CDA does know is the endpoint URL and the DTOs involved. I would suspect that would be able to provide the required information checks.

Doesn't negate the point the sample is making though, same concept different source.


1. **Dependency Injection**: `@Autowired` helper in controllers
2. **Annotation-Based**: `@CwmsAuthorized` with AOP interceptors
3. **Filter-Based**: Servlet filter for automatic processing
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Javalin has before handlers and a Context object:

https://github.com/USACE/cwms-data-api/blob/2c19ffccf88e3e5c2480760e3f138cfa5279763b/cwms-data-api/src/main/java/cwms/cda/ApiServlet.java#L353C17-L353C35

https://github.com/USACE/cwms-data-api/blob/develop/cwms-data-api/src/main/java/cwms/cda/security/Authenticator.java#L15

With the before handler functionally equivalent to the Filter Based approach.

I suspect a combination of work within an CdaAccessManager, a before handler, and the specific endpoints for any data specific issues will likely be what happens.

e.g. a POST call with no x-cwms-auth-context should fail before it before it even gets to the Time Series Controller.

Copy link
Copy Markdown

@jbkolze jbkolze left a comment

Choose a reason for hiding this comment

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

Looks good to me -- just had a couple quick questions for clarification.

**7 User Personas (PWS Exhibit 3):**

1. **Anonymous/Public User**: Read-only access to public data after embargo period
2. **Dam Operator**: Manual data entry only, 24-hour modification window, shift hours (6am-6pm)
Copy link
Copy Markdown

@jbkolze jbkolze Aug 6, 2025

Choose a reason for hiding this comment

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

For clarification, will the details of these personas (or the users themselves) be configurable? I believe that

  • User persona definitions with specific constraints and capabilities

below under Policy Data Management indicates that they will be, but just want to confirm.

Our current operations workflow would require potential modification by dam operators beyond the 24-hr window and outside of set shift hours.


#### Phase 3: Administration and Optimization

- React-based admin UI for policy management
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 assume that direct API access for policy management will be available prior to Phase 3?

@MikeNeilson MikeNeilson merged commit 6f08480 into develop Sep 2, 2025
7 checks passed
@MikeNeilson MikeNeilson deleted the docs/rfc/0001-data-authorization-middleware branch September 2, 2025 14:37
MikeNeilson pushed a commit that referenced this pull request Oct 23, 2025
### Summary

* RFC for the Data Authorization Middleware

(cherry picked from commit 6f08480)
MikeNeilson pushed a commit that referenced this pull request Oct 24, 2025
### Summary

* RFC for the Data Authorization Middleware

(cherry picked from commit 6f08480)
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.

3 participants