A versatile extension for Phabricator, enabling seamless integration with various OAuth 2.0 identity providers. Simplify authentication setup and enhance security with this customizable extension.
Code is based on Evan Priestley's comments here: https://secure.phabricator.com/T524.
- Copy extension PHP files to
phabricator/src/extensions
- Restart Phabricator services
- Add
Auth Provider
and chooseKeycloak
- Input Keycloak Base URL and Realm Name
- Click Next step
- Re-edit the provider
- Configure App ID(Keycloak client), App Secret(Keycloak client secret)
Update the attributes to get it right for you:
final class PhutilKeycloakAuthAdapter extends PhutilOAuthAuthAdapter {
...
public function getAccountID() {
return $this->getOAuthAccountData('sub');
}
public function getAccountEmail() {
return $this->getOAuthAccountData('email');
}
public function getAccountName() {
return $this->getOAuthAccountData('preferred_username');
}
public function getAccountRealName() {
return $this->getOAuthAccountData('name');
}
...
}