summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-14 00:28:47 +0200
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-14 00:28:47 +0200
commit8b928471412bbf9016df9b01b2308f003e455d7d (patch)
tree913a7bab845b8bfd72ba489746ea703159314f4b /core
parente70176b6e6f539754974117625eeab06c4c5dd01 (diff)
parentd9167fb5318d5370ba5445e94c0e0f9b64341df4 (diff)
downloadclassroom-8b928471412bbf9016df9b01b2308f003e455d7d.tar.gz
classroom-8b928471412bbf9016df9b01b2308f003e455d7d.tar.bz2
classroom-8b928471412bbf9016df9b01b2308f003e455d7d.zip
Merge branch 'authentication'
Diffstat (limited to 'core')
-rw-r--r--core/classes/authentication/Core/PasswordTrait.php (renamed from core/classes/authenticator/PasswordTrait.php)24
-rw-r--r--core/classes/authentication/Core/UserManager.php (renamed from core/classes/authenticator/UserManager.php)13
-rw-r--r--core/classes/authentication/Core/UserManagerInterface.php (renamed from core/classes/authenticator/UserManagerInterface.php)8
-rw-r--r--core/classes/authentication/Token/UserToken.php (renamed from core/classes/authenticator/UserToken.php)13
-rw-r--r--core/classes/authentication/Token/UserTokenInterface.php (renamed from core/classes/authenticator/UserTokenInterface.php)11
-rw-r--r--core/classes/authentication/User.php (renamed from core/classes/authenticator/User.php)9
-rw-r--r--core/classes/authentication/UserInterface.php (renamed from core/classes/authenticator/UserInterface.php)4
-rw-r--r--core/classes/authentication/info.md (renamed from core/classes/authenticator/info.md)0
8 files changed, 45 insertions, 37 deletions
diff --git a/core/classes/authenticator/PasswordTrait.php b/core/classes/authentication/Core/PasswordTrait.php
index 22976d8..18d67b5 100644
--- a/core/classes/authenticator/PasswordTrait.php
+++ b/core/classes/authentication/Core/PasswordTrait.php
@@ -1,33 +1,25 @@
<?php
-
-
+/** Trait PasswordTrait
+ *
+ * @package DevCoder\Authentication\Core
+ *
+ */
// namespace DevCoder\Authentication\Core;
-//
+
// use DevCoder\Authentication\UserInterface;
-/**
- * Trait PasswordTrait
- * @package DevCoder\Authentication\Core
- */
trait PasswordTrait
{
private $cost = 10;
public function cryptPassword(string $plainPassword): string
{
- return password_hash(
- $plainPassword,
- PASSWORD_BCRYPT,
- ['cost' => $this->cost]
- );
+ return password_hash($plainPassword, PASSWORD_BCRYPT, ['cost' => $this->cost]);
}
public function isPasswordValid(UserInterface $user, string $plainPassword): bool
{
- return password_verify(
- $plainPassword,
- $user->getPassword()
- );
+ return password_verify($plainPassword, $user->getPassword());
}
public function setCost(int $cost): void
diff --git a/core/classes/authenticator/UserManager.php b/core/classes/authentication/Core/UserManager.php
index 36f0d16..3b380b8 100644
--- a/core/classes/authenticator/UserManager.php
+++ b/core/classes/authentication/Core/UserManager.php
@@ -1,15 +1,15 @@
<?php
-
+/** Class UserManager
+ *
+ * @package DevCoder\Authentication\Core
+ *
+ */
// namespace DevCoder\Authentication\Core;
-//
+
// use DevCoder\Authentication\Token\UserToken;
// use DevCoder\Authentication\Token\UserTokenInterface;
// use DevCoder\Authentication\UserInterface;
-/**
- * Class UserManager
- * @package DevCoder\Authentication\Core
- */
class UserManager implements UserManagerInterface
{
@@ -66,4 +66,3 @@ class UserManager implements UserManagerInterface
}
}
}
-
diff --git a/core/classes/authenticator/UserManagerInterface.php b/core/classes/authentication/Core/UserManagerInterface.php
index ef120c1..4702992 100644
--- a/core/classes/authenticator/UserManagerInterface.php
+++ b/core/classes/authentication/Core/UserManagerInterface.php
@@ -1,7 +1,11 @@
<?php
-
+/** Interface UserManagerInterface
+ *
+ * @package DevCoder\Authentication\Core
+ *
+ */
// namespace DevCoder\Authentication\Core;
-//
+
// use DevCoder\Authentication\Token\UserTokenInterface;
// use DevCoder\Authentication\UserInterface;
diff --git a/core/classes/authenticator/UserToken.php b/core/classes/authentication/Token/UserToken.php
index 7758086..6ce2eb6 100644
--- a/core/classes/authenticator/UserToken.php
+++ b/core/classes/authentication/Token/UserToken.php
@@ -1,14 +1,13 @@
<?php
-
-
+/** Class UserToken
+ *
+ * @package DevCoder\Authentication
+ *
+ */
// namespace DevCoder\Authentication\Token;
-//
+
// use DevCoder\Authentication\UserInterface;
-/**
- * Class UserToken
- * @package DevCoder\Authentication\Token
- */
class UserToken implements UserTokenInterface
{
/**
diff --git a/core/classes/authenticator/UserTokenInterface.php b/core/classes/authentication/Token/UserTokenInterface.php
index 2a21d8f..f095a17 100644
--- a/core/classes/authenticator/UserTokenInterface.php
+++ b/core/classes/authentication/Token/UserTokenInterface.php
@@ -1,8 +1,13 @@
<?php
-/**
- * Interface UserTokenInterface
+/** Interface UserTokenInterface
+ *
* @package DevCoder\Authentication\Token
+ *
*/
+// namespace DevCoder\Authentication\Token;
+
+// use DevCoder\Authentication\UserInterface;
+
interface UserTokenInterface
{
const DEFAULT_PREFIX_KEY = 'user_security';
@@ -10,4 +15,4 @@ interface UserTokenInterface
public function getUser(): UserInterface;
public function serialize(): string;
-} \ No newline at end of file
+}
diff --git a/core/classes/authenticator/User.php b/core/classes/authentication/User.php
index b99fa70..8f5aecb 100644
--- a/core/classes/authenticator/User.php
+++ b/core/classes/authentication/User.php
@@ -1,6 +1,11 @@
<?php
-
-
+/**
+ * Class User
+ *
+ * based on
+ * @package DevCoder\Authentication
+ *
+ */
// namespace DevCoder\Authentication;
class User implements UserInterface
diff --git a/core/classes/authenticator/UserInterface.php b/core/classes/authentication/UserInterface.php
index 5cc6d2d..f81a9ee 100644
--- a/core/classes/authenticator/UserInterface.php
+++ b/core/classes/authentication/UserInterface.php
@@ -1,8 +1,12 @@
<?php
/**
* Interface UserInterface
+ *
* @package DevCoder\Authentication
+ *
*/
+// namespace DevCoder\Authentication;
+
interface UserInterface
{
public function getUsername() :?string;
diff --git a/core/classes/authenticator/info.md b/core/classes/authentication/info.md
index e6d1372..e6d1372 100644
--- a/core/classes/authenticator/info.md
+++ b/core/classes/authentication/info.md