From 9b9d823f30f7f7744f412df8ca4c52d7be3c9977 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Fri, 29 Jan 2016 23:59:58 -0500 Subject: Move Gitlab and Github authentication to external plugins --- app/Auth/GitlabAuth.php | 143 ------------------------------------------------ 1 file changed, 143 deletions(-) delete mode 100644 app/Auth/GitlabAuth.php (limited to 'app/Auth/GitlabAuth.php') diff --git a/app/Auth/GitlabAuth.php b/app/Auth/GitlabAuth.php deleted file mode 100644 index c0a2cf9b..00000000 --- a/app/Auth/GitlabAuth.php +++ /dev/null @@ -1,143 +0,0 @@ -getProfile(); - - if (! empty($profile)) { - $this->userInfo = new GitlabUserProvider($profile); - return true; - } - - return false; - } - - /** - * Set Code - * - * @access public - * @param string $code - * @return GitlabAuth - */ - public function setCode($code) - { - $this->code = $code; - return $this; - } - - /** - * Get user object - * - * @access public - * @return GitlabUserProvider - */ - public function getUser() - { - return $this->userInfo; - } - - /** - * Get configured OAuth2 service - * - * @access public - * @return \Kanboard\Core\Http\OAuth2 - */ - public function getService() - { - if (empty($this->service)) { - $this->service = $this->oauth->createService( - GITLAB_CLIENT_ID, - GITLAB_CLIENT_SECRET, - $this->helper->url->to('oauth', 'gitlab', array(), '', true), - GITLAB_OAUTH_AUTHORIZE_URL, - GITLAB_OAUTH_TOKEN_URL, - array() - ); - } - - return $this->service; - } - - /** - * Get Gitlab profile - * - * @access public - * @return array - */ - public function getProfile() - { - $this->getService()->getAccessToken($this->code); - - return $this->httpClient->getJson( - GITLAB_API_URL.'user', - array($this->getService()->getAuthorizationHeader()) - ); - } - - /** - * Unlink user - * - * @access public - * @param integer $userId - * @return bool - */ - public function unlink($userId) - { - return $this->user->update(array('id' => $userId, 'gitlab_id' => '')); - } -} -- cgit v1.2.3