added support for saml login (#1408)
This commit is contained in:
@@ -38,6 +38,10 @@ class User extends BaseUser implements UserInterface
|
||||
public const DEFAULT_ROLE = self::ROLE_USER;
|
||||
public const DEFAULT_LANGUAGE = 'en';
|
||||
|
||||
public const AUTH_INTERNAL = 'kimai';
|
||||
public const AUTH_LDAP = 'ldap';
|
||||
public const AUTH_SAML = 'saml';
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
@@ -111,6 +115,13 @@ class User extends BaseUser implements UserInterface
|
||||
*/
|
||||
private $teams;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="auth", type="string", length=20, nullable=true)
|
||||
*/
|
||||
private $auth = self::AUTH_INTERNAL;
|
||||
|
||||
/**
|
||||
* User constructor.
|
||||
*/
|
||||
@@ -308,6 +319,10 @@ class User extends BaseUser implements UserInterface
|
||||
*/
|
||||
public function addPreference(UserPreference $preference): User
|
||||
{
|
||||
if (null === $this->preferences) {
|
||||
$this->preferences = new ArrayCollection();
|
||||
}
|
||||
|
||||
$this->preferences->add($preference);
|
||||
$preference->setUser($this);
|
||||
|
||||
@@ -372,6 +387,33 @@ class User extends BaseUser implements UserInterface
|
||||
return $this->getUsername();
|
||||
}
|
||||
|
||||
public function getAuth(): ?string
|
||||
{
|
||||
return $this->auth;
|
||||
}
|
||||
|
||||
public function setAuth(string $auth): User
|
||||
{
|
||||
$this->auth = $auth;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isSamlUser(): bool
|
||||
{
|
||||
return $this->auth === self::AUTH_SAML;
|
||||
}
|
||||
|
||||
public function isLdapUser(): bool
|
||||
{
|
||||
return $this->auth === self::AUTH_LDAP;
|
||||
}
|
||||
|
||||
public function isInternalUser(): bool
|
||||
{
|
||||
return $this->auth === null || $this->auth === self::AUTH_INTERNAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user