commit | 45da6185655c133fe91d879d15f6f66a8e97c78d | [log] [tgz] |
---|---|---|
author | Luca Milanesio <luca.milanesio@gmail.com> | Thu May 12 11:33:30 2016 +0100 |
committer | Luca Milanesio <luca.milanesio@gmail.com> | Tue Oct 25 08:00:28 2016 +0100 |
tree | e9aa5cc12c6bbf2183ca074ede7cc7c2bfb20632 | |
parent | dce95ae8a9af3dc228e0b696d31f53ab331bfee9 [diff] |
Allow to listen to Web login/logout events When using Gerrit with external authentication systems (OAuth or other) it would be necessary to enforce additional requirements (e.g. 2-factor) or introduce some plug-in specific post-login screen for finalising the user's on boarding. Similarly when the user logs out, we may need to invalidate its token from an external SSO system or to perform some other plugin-specific operations or even simply request a feedback. With the introduction of this new extension point WebLoginListener it is possible to filter the HTTP response and override the status code to redirect or perform additional adjustments to comply with the company or the plugin's requirements. It is possible to experiment this new extension with a simple Groovy scripting plugin (see below). ``` import com.google.gerrit.extensions.annotations.* import javax.servlet.http.* import com.google.inject.* import com.google.gerrit.httpd.* import com.google.gerrit.server.* @Singleton @Listen public class MyPostLogin implements WebLoginListener { public void onLogin(IdentifiedUser user, HttpServletRequest req, HttpServletResponse resp) { println "Post-login user=$user" resp.sendRedirect("https://twophase.mycompany.com/auth") } public void onLogout(IdentifiedUser user, HttpServletRequest req, HttpServletResponse resp) { println "Post-logout user=$user" resp.sendRedirect("https://ssologout.mycompany.com") } } ``` Change-Id: I76e8ec040072e317061234665a0d865927da55b9
Gerrit is a code review and project management tool for Git based projects.
Gerrit makes reviews easier by showing changes in a side-by-side display, and allowing inline comments to be added by any reviewer.
Gerrit simplifies Git based project maintainership by permitting any authorized user to submit changes to the master Git repository, rather than requiring all approved changes to be merged in by hand by the project maintainer.
For information about how to install and use Gerrit, refer to the documentation.
Our canonical Git repository is located on googlesource.com. There is a mirror of the repository on Github.
Please report bugs on the issue tracker.
Gerrit is the work of hundreds of contributors. We appreciate your help!
Please read the contribution guidelines.
Note that we do not accept Pull Requests via the Github mirror.
The IRC channel on freenode is #gerrit. An archive is available at: echelog.com.
The Developer Mailing list is repo-discuss on Google Groups.
Gerrit is provided under the Apache License 2.0.
Install Buck and run the following:
git clone --recursive https://gerrit.googlesource.com/gerrit cd gerrit && buck build release
The instruction how to configure GerritForge/BinTray repositories is here
On Debian/Ubuntu run:
apt-get update & apt-get install gerrit=<version>-<release>
NOTE: release is a counter that starts with 1 and indicates the number of packages that have been released with the same version of the software.
On CentOS/RedHat run:
yum clean all && yum install gerrit-<version>[-<release>]
NOTE: release is optional. Last released package of the version is installed if the release number is omitted.