Skip to content

Commit

Permalink
Update and rename Slack.php to Logto.php
Browse files Browse the repository at this point in the history
  • Loading branch information
peteryang1756 authored Aug 4, 2024
1 parent 044c07a commit 308894d
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions src/Providers/Slack.php → src/Providers/Logto.php
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
<?php

/*
* This file is part of blomstra/oauth-slack.
*
* Copyright (c) 2022 Team Blomstra.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/

namespace Blomstra\OAuthSlack\Providers;
namespace Ssangyongsports\OAuthLogto\Providers;

use Flarum\Forum\Auth\Registration;
use FoF\OAuth\Provider;
use League\OAuth2\Client\Provider\AbstractProvider;

class Slack extends Provider
class Logto extends Provider
{
/**
* @var OpenIDProvider
* @var LogtoProvider
*/
protected $provider;

public function name(): string
{
return 'openid';
return 'logto';
}

public function link(): string
{
return 'https://auth.ssangyongsports.eu.org/oidc'; // 更改為 OpenID Connect 的文檔鏈接
return 'https://auth.ssangyongsports.eu.org/oidc';
}

public function fields(): array
Expand All @@ -42,7 +33,7 @@ public function fields(): array

public function provider(string $redirectUri): AbstractProvider
{
return $this->provider = new OpenIDProvider([
return $this->provider = new LogtoProvider([
'clientId' => $this->getSetting('client_id'),
'clientSecret' => $this->getSetting('client_secret'),
'redirectUri' => $redirectUri,
Expand All @@ -51,7 +42,7 @@ public function provider(string $redirectUri): AbstractProvider

public function options(): array
{
return ['scope' => ['openid', 'email', 'profile']]; // 確保範圍符合 OpenID Connect 標準
return ['scope' => ['openid', 'email', 'profile']];
}

public function suggestions(Registration $registration, $user, string $token)
Expand All @@ -60,7 +51,7 @@ public function suggestions(Registration $registration, $user, string $token)

$registration
->provideTrustedEmail($email)
->provideAvatar($user->getImage192()) // 確保用戶圖像符合 OpenID Connect 的要求
->provideAvatar($user->getImage())
->suggestUsername($user->getName())
->setPayload($user->toArray());
}
Expand Down

0 comments on commit 308894d

Please sign in to comment.