mirror of
https://github.com/friendica/friendica
synced 2025-04-29 05:44:22 +02:00
OpenWebAuth moved to a separate class / Improved authentication handling
This commit is contained in:
parent
b3c7e96b73
commit
55cec6c61d
14 changed files with 595 additions and 410 deletions
|
@ -80,9 +80,9 @@ interface IHandleUserSessions extends IHandleSessions
|
|||
public function getMyUrl(): string;
|
||||
|
||||
/**
|
||||
* Returns if the current visitor is authenticated
|
||||
* Returns if the current visitor is a local user
|
||||
*
|
||||
* @return bool "true" when visitor is either a local or remote user
|
||||
* @return bool "true" when visitor is a local user
|
||||
*/
|
||||
public function isAuthenticated(): bool;
|
||||
|
||||
|
@ -100,6 +100,20 @@ interface IHandleUserSessions extends IHandleSessions
|
|||
*/
|
||||
public function isModerator(): bool;
|
||||
|
||||
/**
|
||||
* Returns if the current visitor is a verified remote user
|
||||
*
|
||||
* @return bool "true" when visitor is a verified remote user
|
||||
*/
|
||||
public function isVisitor(): bool;
|
||||
|
||||
/**
|
||||
* Returns if the current visitor is an unauthenticated user
|
||||
*
|
||||
* @return bool "true" when visitor is an unauthenticated user
|
||||
*/
|
||||
public function isUnauthenticated(): bool;
|
||||
|
||||
/**
|
||||
* Returns User ID of the managed user in case it's a different identity
|
||||
*
|
||||
|
|
|
@ -130,7 +130,7 @@ class UserSession implements IHandleUserSessions
|
|||
/** {@inheritDoc} */
|
||||
public function isAuthenticated(): bool
|
||||
{
|
||||
return $this->session->get('authenticated', false);
|
||||
return $this->session->get('authenticated', false) && $this->getLocalUserId();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
@ -145,6 +145,18 @@ class UserSession implements IHandleUserSessions
|
|||
return User::isModerator($this->getLocalUserId());
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function isVisitor(): bool
|
||||
{
|
||||
return $this->session->get('authenticated', false) && $this->session->get('visitor_id') && !$this->session->get('uid');
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function isUnauthenticated(): bool
|
||||
{
|
||||
return !$this->session->get('authenticated', false);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function setVisitorsContacts(string $my_url)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue