Skip to content

Commit

Permalink
make PHPStan happy
Browse files Browse the repository at this point in the history
  • Loading branch information
warcooft committed Sep 13, 2024
1 parent 7bb976e commit b89edde
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/get_keys.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# How To Get Keys

Obviously, receiving Keys is not directly related to `Shield OAuth`, however, to improve the documentation and convenience of our users, Therefore, we have provided helpful links on how to get keys from the three most important Google, GitHub and Yahoo. For other services, you can find the relevant steps by searching.
Obviously, receiving Keys is not directly related to `Shield OAuth`, however, to improve the documentation and convenience of our users, Therefore, we have provided helpful links on how to get keys from the three most important Google, GitHub, Microsoft and Yahoo. For other services, you can find the relevant steps by searching.

- [How To Get Keys](#how-to-get-keys)
- [Explanation About Callback](#explanation-about-callback)
Expand Down
20 changes: 10 additions & 10 deletions src/Libraries/MicrosoftOAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@

class MicrosoftOAuth extends AbstractOAuth
{
private static $API_CODE_URL = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize';
private static $API_TOKEN_URL = 'https://login.microsoftonline.com/common/oauth2/v2.0/token';
private static $API_USER_INFO_URL = 'https://graph.microsoft.com/v1.0/me';
private static $APPLICATION_NAME = 'ShieldOAuth';

private static string $API_CODE_URL = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize';
private static string $API_TOKEN_URL = 'https://login.microsoftonline.com/common/oauth2/v2.0/token';
private static string $API_USER_INFO_URL = 'https://graph.microsoft.com/v1.0/me';
private static string $APPLICATION_NAME = 'ShieldOAuth';
protected string $token;
protected CURLRequest $client;
protected ShieldOAuthConfig $config;
Expand Down Expand Up @@ -44,12 +43,15 @@ public function makeGoLink(string $state): string
'approval_prompt' => 'auto',
'scope' => 'User.Read',
'state' => $state,
'sso_reload' => true
'sso_reload' => true,
]);

return self::$API_CODE_URL . '?' . $query;
}

/**
* @param array<string, string> $allGet
*/
public function fetchAccessTokenWithAuthCode(array $allGet): void
{
try {
Expand Down Expand Up @@ -108,16 +110,14 @@ public function setColumnsName(string $nameOfProcess, object $userInfo): array
}

if ($nameOfProcess === 'newUser') {
helper('text');

return [
'username' => $userInfo->mail,
'email' => $userInfo->mail,
'password' => random_string('crypto', 32),
'password' => bin2hex(random_bytes(16)),
'active' => 1, // if microsoft authentication is valid then the user account does not require an email activator
$this->config->usersColumnsName['first_name'] => $userInfo->givenName,
$this->config->usersColumnsName['last_name'] => $userInfo->surname ?? null,
$this->config->usersColumnsName['avatar'] => null
$this->config->usersColumnsName['avatar'] => null,
];
}

Expand Down

0 comments on commit b89edde

Please sign in to comment.