Skip to content

Commit c0b0b31

Browse files
committed
added optional user agent parameter for authentication helpers
1 parent 8a2a1ba commit c0b0b31

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/helpers/Auth.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ class Auth
2121
* None authorization
2222
* @return array
2323
*/
24-
public static function none(): array
24+
public static function none(?string $userAgent = null): array
2525
{
2626
return [
27-
'user_agent' => self::$defaultUserAgent,
27+
'user_agent' => $userAgent ?? self::$defaultUserAgent,
2828
'scheme' => 'none'
2929
];
3030
}
@@ -35,10 +35,10 @@ public static function none(): array
3535
* @param string $password
3636
* @return array
3737
*/
38-
public static function basic(string $username, string $password): array
38+
public static function basic(string $username, string $password, ?string $userAgent = null): array
3939
{
4040
return [
41-
'user_agent' => self::$defaultUserAgent,
41+
'user_agent' => $userAgent ?? self::$defaultUserAgent,
4242
'scheme' => 'basic',
4343
'principal' => $username,
4444
'credentials' => $password
@@ -50,10 +50,10 @@ public static function basic(string $username, string $password): array
5050
* @param string $token
5151
* @return array
5252
*/
53-
public static function bearer(string $token): array
53+
public static function bearer(string $token, ?string $userAgent = null): array
5454
{
5555
return [
56-
'user_agent' => self::$defaultUserAgent,
56+
'user_agent' => $userAgent ?? self::$defaultUserAgent,
5757
'scheme' => 'bearer',
5858
'credentials' => $token
5959
];

0 commit comments

Comments
 (0)