當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Authenticator::addProvider方法代碼示例

本文整理匯總了PHP中Authenticator::addProvider方法的典型用法代碼示例。如果您正苦於以下問題:PHP Authenticator::addProvider方法的具體用法?PHP Authenticator::addProvider怎麽用?PHP Authenticator::addProvider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Authenticator的用法示例。


在下文中一共展示了Authenticator::addProvider方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Authenticator

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
require_once 'Authenticator.php';
require_once 'Github.php';
require_once 'GooglePlus.php';
require_once 'config.php';
session_start();
$config = parse_ini_file("config.ini", true);
/* Authenticator */
$authenticator = new Authenticator();
$gplus = new GooglePlus($config['googleplus']['clientid'], $config['googleplus']['clientsecret']);
$authenticator->addProvider($gplus);
$github = new Github($config['github']['clientid'], $config['github']['clientsecret'], $config['github']['redirect_uri']);
$authenticator->addProvider($github);
/* Routing */
$controller = null;
$url = $_SERVER['PHP_SELF'];
if (strpos($url, '/static/') === 0) {
    return false;
} else {
    if (strpos($url, '/callback') === 0) {
        require_once "controllers/callback.php";
        $controller = new CallbackController($authenticator);
    } else {
        if (strpos($url, '/login') === 0) {
            require_once "controllers/login.php";
            $controller = new LoginController($authenticator);
開發者ID:hudovisk,項目名稱:googleIO-811,代碼行數:31,代碼來源:router.php


注:本文中的Authenticator::addProvider方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。