mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-10 14:51:06 +01:00
48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
|
<?php
|
||
|
|
||
|
final class PhabricatorAuthProviderOAuthGitHub
|
||
|
extends PhabricatorAuthProviderOAuth {
|
||
|
|
||
|
public function getProviderName() {
|
||
|
return pht('GitHub');
|
||
|
}
|
||
|
|
||
|
protected function newOAuthAdapter() {
|
||
|
return new PhutilAuthAdapterOAuthGitHub();
|
||
|
}
|
||
|
|
||
|
public function isEnabled() {
|
||
|
return parent::isEnabled() &&
|
||
|
PhabricatorEnv::getEnvConfig('github.auth-enabled');
|
||
|
}
|
||
|
|
||
|
protected function getOAuthClientID() {
|
||
|
return PhabricatorEnv::getEnvConfig('github.application-id');
|
||
|
}
|
||
|
|
||
|
protected function getOAuthClientSecret() {
|
||
|
$secret = PhabricatorEnv::getEnvConfig('github.application-secret');
|
||
|
if ($secret) {
|
||
|
return new PhutilOpaqueEnvelope($secret);
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public function shouldAllowLogin() {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public function shouldAllowRegistration() {
|
||
|
return PhabricatorEnv::getEnvConfig('github.registration-enabled');
|
||
|
}
|
||
|
|
||
|
public function shouldAllowAccountLink() {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public function shouldAllowAccountUnlink() {
|
||
|
return !PhabricatorEnv::getEnvConfig('github.auth-permanent');
|
||
|
}
|
||
|
|
||
|
}
|