FastComments.com

FastComments PHP SSO SDK


これは FastComments の公式 PHP SSO SDK です。

FastComments SSO 統合用の PHP SDK

リポジトリ

GitHub で表示


インストール Internal Link

composer require fastcomments/sso

使用方法 Internal Link

シンプルなSSO

シンプルなSSOは使いやすいですが、セキュアなSSOよりもセキュリティが低くなります:

use FastComments\SSO\FastCommentsSSO;
use FastComments\SSO\SimpleSSOUserData;

// ユーザーデータを作成
$userData = SimpleSSOUserData::create(
    'username123',
    'user@example.com',
    'https://example.com/avatar.png'
);

// URLベースのログイン/ログアウトを使用
$sso = FastCommentsSSO::createWithUrls(
    null,
    $userData,
    'https://example.com/login',
    'https://example.com/logout'
);

// またはコールバックを使用
$sso = FastCommentsSSO::createWithCallbacks(
    $userData,
    function($url) { /* ログインを処理 */ },
    function($url) { /* ログアウトを処理 */ }
);

// FastCommentsに渡すトークンを取得
$token = $sso->prepareToSend();

セキュアなSSO

セキュアなSSOはHMAC検証によって高度なセキュリティを提供します:

use FastComments\SSO\FastCommentsSSO;
use FastComments\SSO\SecureSSOUserData;

// ユーザーデータを作成
$userData = SecureSSOUserData::create(
    'user-123',
    'user@example.com',
    'username123',
    'https://example.com/avatar.png'
);

// 必要に応じてオプションのデータを追加
$userData->isAdmin = true;
$userData->groupIds = ['group-1', 'group-2'];

// APIキーを使用してSSOオブジェクトを作成
$sso = FastCommentsSSO::createSecure('your-api-key', $userData);

// FastCommentsに渡すトークンを取得
$token = $sso->prepareToSend();

ドキュメント Internal Link

FastComments SSO の詳細については、FastComments のドキュメント をご覧ください。

ヘルプが必要ですか?

PHP SSO SDK に関して問題が発生した場合や質問がある場合は、次のいずれかを行ってください:

貢献

ご貢献を歓迎します! 貢献ガイドラインについては GitHubリポジトリ をご覧ください。