about summary refs log tree commit diff
path: root/web/panettone/src/authentication.lisp (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-05-28 r/4182 fix(web/panettone): Don't add extra padding when already paddedGriffin Smith1-7/+1
Because of math being upsetting, we were adding 4 padding characters to an already-properly-padded base64 string, which broke tazjin. This also breaks this function out into panettone.util, and adds a test for it. Change-Id: I7bc8a440ad9d0917272dd9f2e341081ea14693da Reviewed-on: https://cl.tvl.fyi/c/depot/+/5782 Autosubmit: grfn <grfn@gws.fyi> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-05-28 r/4181 fix(web/panettone): Properly handle un-padded base64 in jwtsGriffin Smith1-1/+13
The JWT spec apparently specifies that base64 strings in jwts aren't to be padded - but the common lisp base64 library doesn't know how to decode unpadded base64 (it signals a condition in that case). This adds the extra padding characters (a number of `=` characters such that the length of the string is a multiple of 4) using some FORMAT wizardry (?). Change-Id: Ic6b66f05db2699bf1f93f870f5dd614c37eccc2d Reviewed-on: https://cl.tvl.fyi/c/depot/+/5781 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: grfn <grfn@gws.fyi>
2022-05-28 r/4180 feat(web/panettone): Implement OAuth2-based authenticationVincent Ambo1-105/+99
Instead of directly connecting to LDAP and attempting to bind usernames/password, authenticate users through an OAuth2 flow to Keycloak. This has the advantage of reusing the same SSO we already have for Gerrit, Buildkite, ... However, much of panettone's functionality makes assumptions about LDAP being used. As a result there are some warts introduced by this (for now): * Since LDAP DNs are used as primary keys for users, we have to construct fake DNs based on LDAP usernames It might be sensible to migrate this to the UUIDs used by Keycloak eventually. * LDAP is part of the serving path for issues (for fetching user information), however panettone no longer has a way to fetch arbitrary user information unless it is persisted in its database. To work around this, we construct a "fake" user based only on its DN (i.e. only the username is going to be "correct") and use that to serve issues. * Email notifications no longer work (panettone can not access email addresses) Some of these need to be worked around by persisting some of that information in the panettone database instead, as we don't want to give the service the ability to access arbitrary user information anymore. We can probably do this with the user settings feature that already exists and populate it on launch, but as of this commit email and displayName functionality is simply broken. Change-Id: Id32bf5e09d67f0f1e883024c6e013eb342f03b05 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5772 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-02-07 r/3777 fix(web/panettone): unbind LDAP connections after authVincent Ambo1-10/+10
unbind & close the stream of newly created LDAP connections after auth, which might prevent some of the resource leaking we've got going on i did actually verify in sly that this still works. yay. Change-Id: I92c8ca20de642585ae4c24aa455d051ee6e44a87 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5193 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
2021-04-12 r/2485 refactor(users/glittershark): Rename to grfnGriffin Smith1-1/+1
Rename my //users directory and all places that refer to glittershark to grfn, including nix references and documentation. This may require some extra attention inside of gerrit's database after it lands to allow me to actually push things. Change-Id: I4728b7ec2c60024392c1c1fa6e0d4a59b3e266fa Reviewed-on: https://cl.tvl.fyi/c/depot/+/2933 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in> Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: glittershark <grfn@gws.fyi>
2021-04-04 r/2426 feat(panettone): Add functions to send email notificationsGriffin Smith1-0/+2
Add a new package to panettone, :panettone.email with functions to send email notifications to users through the SMTP relay on whitby, respecting the value of `enable_email_notifications` on the user_settings table. Change-Id: Ia4ec65965abda06f1fadb178143d66bb8eae6482 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2804 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <mail@tazj.in>
2021-01-29 r/2152 fix(panettone): handle missing DNs when looking up displaynamessterni1-6/+12
* Fix find-user-by-dn raising an error condition if the search returns no results, return nil instead. * Adopt strategy of defaulting to “someone” as displayname if lookup fails for all usage of displaynames in panettone. I've tested this change for issues and comments created by missing users. Adjusting the displayname seems to fix all 500 being created by missing users both logged out and logged in. Change-Id: I0a84eb0631c4a49f1664bed6d03afa60dce6eb47 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2448 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-31 r/1746 fix(panettone): Automatically reconnect to ldapGriffin Smith1-16/+52
Wrap all ldap access in a macro that automatically reconnects and retries operations that fail due to a connection error, to handle the case where the ldap server restarts while we still have an open connection. Fixes: #44 Change-Id: I4859cf509106e480f97fed17e7f08e0eea909352 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1871 Tested-by: BuildkiteCI Reviewed-by: eta <eta@theta.eu.org>
2020-07-31 r/1509 feat(web/panettone): Log when users change issue statusesGriffin Smith1-0/+71
Log in the database, in a way that will generalize to tracking edit history as well, when users change the status of an issue. To facilitate easily knowing who is currently authenticated (without introducing a circular dependency) the authentication-relaated code has also been factored out into its own package, which is nice because we want to replace that sooner rather than later anyway. Fixes: #13 Change-Id: I65a544fab660ed1c295ee8f6b293e0d4945a8203 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1496 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>