r/java • • 18m ago

Has your authorization logic ever drifted between your REST API and your GraphQL/MCP layer?

Title: Has your authorization logic ever drifted between your REST API and your GraphQL/MCP layer?

I'm curious how Java teams deal with this. Say you restrict a field in a REST controller. Months later you add a GraphQL endpoint, or an MCP tool so an AI agent can use the same service, and the old rule isn't applied there. Nothing is technically broken, but the same data is now reachable another way.

I've been building an open-source project called Foundgine (Apache-2.0, Java and .NET implementations) around one idea: define entities, relationships, operations and authorization rules (entity, field, relationship and row level) once, and make every transport go through the same resolve, authorize, plan, execute path. An AI agent gets no more authority than any other client.

It's meant to work with JPA, PostgreSQL and Keycloak, not replace them. It's not an ORM, a web framework or an agent framework.

Things I'd like to hear from this sub:
- How do you keep rules consistent today: Spring Security method rules, a shared policy layer, OPA/Cedar/OpenFGA, or review discipline?
- Is a central rule model something you'd adopt, or does it feel like too much indirection compared with annotations on your entities?
- What would you need to see in a Java library like this before trying it on a real service?

There's a reference supply-chain app (customer ownership, procurement and warehouse roles, sensitive supplier data). If you can read something through one transport that another hides, please tell me.

Website: https://foundgine.io
Source: https://github.com/Foundgine/Foundgine
Overview: https://foundgine.io/foundgine-overview

0 Upvotes

0 comments sorted by