This commit is contained in:
wp-xwiki 2026-03-25 14:51:17 +00:00
parent f7da174c1a
commit 2cbddcb2b5
1 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,43 @@
<?php
namespace wp-xwiki\FlarumOAuthEntra\Providers;
use FoF\OAuth\Providers\AbstractProvider;
use League\OAuth2\Client\Provider\GenericProvider;
class EntraProvider extends AbstractProvider
{
public function options()
{
$tenant = resolve('flarum.settings')->get('sbp-entraid.tenant') ?: 'common';
return [
'clientId' => $this->settings->get('fof-oauth.microsoft.client_id'),
'clientSecret' => $this->settings->get('fof-oauth.microsoft.client_secret'),
'redirectUri' => $this->url->to('forum')->route('auth.msoft'),
'urlAuthorize' => "https://login.microsoftonline.com/{$tenant}/oauth2/v2.0/authorize",
'urlAccessToken' => "https://login.microsoftonline.com/{$tenant}/oauth2/v2.0/token",
'urlResourceOwnerDetails' => "https://graph.microsoft.com/v1.0/me"
];
}
public function provider()
{
return new GenericProvider($this->options());
}
public function getId()
{
return 'entra';
}
public function getDisplayName()
{
return 'Microsoft Entra ID';
}
public function getIcon()
{
return 'fab fa-microsoft';
}
}