diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-12-05 20:31:27 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-12-05 20:31:27 -0500 |
commit | e9fedf3e5cd63aea4da7a71f6647ee427c62fa49 (patch) | |
tree | abc2de5aebace4a2d7c94805552264dab6b10bc7 /app/User/OAuthUserProvider.php | |
parent | 346b8312e5ac877ce3192c2db3a26b500018bbb5 (diff) |
Rewrite of the authentication and authorization system
Diffstat (limited to 'app/User/OAuthUserProvider.php')
-rw-r--r-- | app/User/OAuthUserProvider.php | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/app/User/OAuthUserProvider.php b/app/User/OAuthUserProvider.php new file mode 100644 index 00000000..3879fa76 --- /dev/null +++ b/app/User/OAuthUserProvider.php @@ -0,0 +1,141 @@ +<?php + +namespace Kanboard\User; + +use Kanboard\Core\User\UserProviderInterface; +use Kanboard\Core\Security\Role; + +/** + * OAuth User Provider + * + * @package user + * @author Frederic Guillot + */ +abstract class OAuthUserProvider implements UserProviderInterface +{ + /** + * Get external id column name + * + * @access public + * @return string + */ + abstract public function getExternalIdColumn(); + + /** + * User properties + * + * @access private + * @var array + */ + private $user = array(); + + /** + * Constructor + * + * @access public + * @param array $user + */ + public function __construct(array $user) + { + $this->user = $user; + } + + /** + * Return true to allow automatic user creation + * + * @access public + * @return boolean + */ + public function isUserCreationAllowed() + { + return false; + } + + /** + * Get internal id + * + * @access public + * @return string + */ + public function getInternalId() + { + return ''; + } + + /** + * Get external id + * + * @access public + * @return string + */ + public function getExternalId() + { + return $this->user['id']; + } + + /** + * Get user role + * + * @access public + * @return string + */ + public function getRole() + { + return ''; + } + + /** + * Get username + * + * @access public + * @return string + */ + public function getUsername() + { + return ''; + } + + /** + * Get full name + * + * @access public + * @return string + */ + public function getName() + { + return $this->user['name']; + } + + /** + * Get user email + * + * @access public + * @return string + */ + public function getEmail() + { + return $this->user['email']; + } + + /** + * Get external group ids + * + * @access public + * @return array + */ + public function getExternalGroupIds() + { + return array(); + } + + /** + * Get extra user attributes + * + * @access public + * @return array + */ + public function getExtraAttributes() + { + return array(); + } +} |