cviebrock/discourse-php
Composer 安装命令:
composer require cviebrock/discourse-php
包简介
Helper class for building a single sign-on source for Discourse forums
关键字:
README 文档
README
This is a small class to help with providing an SSO source for Discourse forums. It provides 3 helper functions for validating incoming requests, extracting nonce, and building the returning query string.
For more information on the SSO settings in Discourse, visit https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045
Original code from Johan Jatko: https://github.com/ArmedGuy/discourse_sso_php
Installation
The package is registered at Packagist as cviebrock/discourse-php and can be installed using composer:
composer require "cviebrock/discourse-php"
Usage
$sso = new Cviebrock\DiscoursePHP\SSOHelper(); // this should be the same in your code and in your Discourse settings: $secret = 'super_secret_sso_key'; $sso->setSecret( $secret ); // load the payload passed in by Discourse $payload = $_GET['sso']; $signature = $_GET['sig']; // validate the payload if (!($sso->validatePayload($payload,$signature))) { // invaild, deny header("HTTP/1.1 403 Forbidden"); echo("Bad SSO request"); die(); } $nonce = $sso->getNonce($payload); // Insert your user authentication code here ... // Required and must be unique to your application $userId = '...'; // Required and must be consistent with your application $userEmail = '...'; // Optional - if you don't set these, Discourse will generate suggestions // based on the email address $extraParameters = array( 'username' => $userUsername, 'name' => $userFullName ); // build query string and redirect back to the Discourse site $query = $sso->getSignInString($nonce, $userId, $userEmail, $extraParameters); header('Location: http://discourse.example.com/session/sso_login?' . $query); exit(0);
Bugs, Suggestions and Contributions
Please use Github for bugs, comments, suggestions.
- Fork the project.
- Create your bugfix/feature branch and write your (well-commented) code.
- Commit your changes and push to your repository.
- Create a new pull request against this project's
masterbranch.
Copyright and License
discourse-php was written by Colin Viebrock and released under the MIT License. See the LICENSE file for details.
Copyright 2015 Colin Viebrock
cviebrock/discourse-php 适用场景与选型建议
cviebrock/discourse-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 525.4k 次下载、GitHub Stars 达 66, 最近一次更新时间为 2015 年 01 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「forum」 「discourse」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cviebrock/discourse-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cviebrock/discourse-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cviebrock/discourse-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Discourse API library for PHP
A Laravel 5 package providing a solid foundation for building discussion forums
A frontend for riari/laravel-forum providing views written with Bootstrap 3
Packed version of the Discourse API PHP library from discoursehosting.
This Bundle provides threaded comment functionality for Symfony applications
Single Sign-On for Discourse
统计信息
- 总下载量: 525.4k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 67
- 点击次数: 17
- 依赖项目数: 9
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-20