Repository navigation
Open
Description
Task Summary
Today tokens are checked by three setups: the shared filter, a second one in the Dashboard Service (#5428), and a copy in the notebook migration service. Access is checked by per-kind code (WorkflowAccess, ResourceAccess, ComputingUnitAccess, and a copy in the notebook migration service), which can disagree (#9227). This task puts both behind two interfaces in common/auth, with our own implementations first, so that Keycloak or OpenFGA can replace them later without changing the services.
// Who is calling?
trait Authenticator {
def authenticate(token: String): Either[AuthError, Principal] // a user, a service or a computing unit
}
// May they do it?
trait AccessControl {
def check(who: Principal, action: Action, rid: Rid): Boolean
def visible(who: Principal, action: Action, kind: Kind): Visible // what a list may show
def grant(rid: Rid, uid: Int, level: Level): Unit
def revoke(rid: Rid, uid: Int): Unit
}- Our implementations first.
Authenticatorverifies the tokens of Texera's own sign-in, and later it can verify the tokens of Keycloak or any other OpenID Connect provider (Add 3rd party Login Providers #7513).AccessControlreads theaccesstable of Adjust the database schema for unified resource management #9484, and later OpenFGA can hold the grants. - Rules that make the swap real. Services depend only on the interfaces, and configuration picks the implementation. Grants change only through
grantandrevoke. A check names an action from the API definition (Define the resource service's API in one contract and generate code from it #9485), not a level. A list asksvisible: ours returns a SQL condition for the list query, and OpenFGA would return ids. - One answer everywhere. Today's per-kind checks become calls to
AccessControl, after tests pin what they answer today.POST /access/evaluationgives the same answer to callers outside the JVM, such as the gateway and the agent service, which verifies tokens the same way (feat(agent-service): authenticate requests via JWT and gateway ext_authz #9043).
Discussion points
- Signing: sign tokens with a key pair now, so that only the issuer can sign and every other service can only verify, or keep the shared secret until an identity provider is chosen.
Done when every service checks tokens through Authenticator and access through AccessControl.
Task Type
- Refactor / Cleanup
- DevOps / Deployment / CI
- Testing / QA
- Documentation
- Performance
- Other
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]Verify tokens with one shared verifier in every service[/-][+]Put authentication and access control behind replaceable interfaces[/+]