-
Notifications
You must be signed in to change notification settings - Fork 5
Description
This adds to RFC 1001 at #4
Overview
Features supported by HTTP:
AuthorizationheaderCookie- Basic and digest auth by browser (unusable)
Features suported by browser-based WebSockets:
Cookie- Authentication protocol packets
- Basic and digest auth by browser (unusable)
Authentication schemes:
- OAuth2 -- the most popular one
- OAuth1 -- deprecated by OAuth2
- SAML -- we probably want in commercial version
- LDAP -- doesn't map to the web by itself. Often used to validate username/password (not something we want to do) or to assign permissions by group (currently we're going to implement ACL in edgedb itself)
- Kerberos -- usually relies on system libraries providing authentication and not widely used outside of large enterprises and academia
Related protocols:
- SCIM -- identity management. Basically a way to create and manage accounts with unified (REST) API. Could potentially replace our
CREATE ROLE/ALTER ROLEstatements, but out of scope of this research. - WS-Federation -- does look like ecosystem of its own, with lots of standards including authorization
Commercial providers:
- Auth0 -- basically provide JWT+OpenID-Connect (OIDC) identity after authentication
- Authentiq -- is also a similar OIDC provider
- Atlassian Crowd -- looks like uses cookie for the actual authorization
- Okta SSO -- supports OIDC, SAML, and whatever they call "Secure Web Authentication"
Related tools:
`. JAAS, Pac4J, Apache Shiro -- java scpecific, not researched closely (but look like just Java interfaces for all other protocols)
Requirements
- Same or similar authentication for both HTTP and WebSockets
- Scheme should work both in browser and using custom clients
- Don't accept login/password or anything directly derived from it, so client doesn't need to keep password in memory for reconnects. And also to avoid handling 2FA. Use external application to verify passwords and multi-factor authentication and only authorize connection in edgedb.
Proposal
Generally authentication should work by providing a Bearer token which is either:
- An opaque token, in this case such token should be inserted into the edgedb database by the application beforehand
- A Self-Encoded access token, that implements OpenID Connect (OIDC) specification
The downside of (2) is that it's harder to revoke already created token, while the downside of (1) is that edgedb needs to keep track of all the tokens that are active now. Upside of (1) is that it's possible to integrate with more systems (in particular ones doesn't support OIDC, or that support OIDC in the way that is incompatible to edgedb).
The token can be transmitted in the one of three ways (all can be used interchangeably):
Authorization: Bearer <token>-- works for HTTP as well as non-browser websocketsCookie: <cookie_name>=<token>-- works everywhere, but can be problematic to set a cookie for a domain that is devoted solely to edgedb (we may add a mechanism for that later)- As a
paraminClientHandshake, this works on WebSockets only and is needed for browser-based websockets where usingCookieis not apropriate.We could use
AuthenticationSASLwith appropriate mechanism to provide token, but we don't need extra security here (i.e. passing token in theClientHandshakeis at least as good as passing it in theAuthorizationheader, which is an accepted security practice). Keeping less round-trips for authentication is useful.
RFC6750 allows passing access_token as form-encoded body parameter and as URI query parameter. We don't allow that now, but we may consider adding them in future if compelling use cases arise.
Configuration:
- Configure
cookie_namein the "port" configuration - Any things needed to configure to make ACLs work (to be determined when ACLs implemented)
It's unclear whether we want to allow configuring JWT parameters in particular encryption schema. Also I expect secret keys to be generated and replicated within the edgedb itself, but we can have a mechanism to provide users' keys.
Structure of the Self-Encoded Token
TO DO: research OpenID Connect
Future Extensions
In the future, we should consider at least following ways of authentication:
- SAML
- TLS Client ceritificates
- Kerberos
All of them might only be supported in commercial version.
Update: Note on RFC6750 of access_token usage