Skip to content

Commit 43f1cd4

Browse files
committed
Releasing 1.0.1
2 parents 828c8ea + c880899 commit 43f1cd4

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ foreach (Log::get() AS $message) {
153153
Log::clean();
154154
```
155155

156+
## Authentication Helper
157+
A simple authentication helper interface along with a default implementation is provided:
158+
159+
* [TgUtils\Auth\CredentialsProvider](https://github.com/technicalguru/php-utils/blob/src/TgUtils/Auth/CredentialsProvider.php) - Interface to provide username and password to other objects
160+
* [TgUtils\Auth\DefaultCredentialsProvider](https://github.com/technicalguru/php-utils/blob/src/TgUtils/Auth/DefaultCredentialsProvider.php) - Simple default implementation of the interface
161+
156162
## Other Utils
157163
There are some daily tasks that need to be done in applications. The `Utils` class addresses a few of them:
158164

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace TgUtils\Auth;
4+
5+
/**
6+
* A helper interface when user credentials are required.
7+
*/
8+
interface CredentialsProvider {
9+
10+
/**
11+
* Returns the username.
12+
* @return string the username
13+
*/
14+
public function getUsername();
15+
16+
/**
17+
* Returns the password.
18+
* @return string the password
19+
*/
20+
public function getPassword();
21+
22+
}
23+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace TgUtils\Auth;
4+
5+
class DefaultCredentialsProvider implements CredentialsProvider {
6+
7+
private $username;
8+
private $password;
9+
10+
public function __construct($username, $password) {
11+
$this->username = $username;
12+
$this->password = $password;
13+
}
14+
15+
/**
16+
* Returns the username.
17+
* @return string the username
18+
*/
19+
public function getUsername(){
20+
return $this->username;
21+
}
22+
23+
/**
24+
* Returns the password.
25+
* @return string the password
26+
*/
27+
public function getPassword() {
28+
return $this->password;
29+
}
30+
31+
}

0 commit comments

Comments
 (0)