lamarus/stormpath

该软件包已被弃用且不再维护。未建议替代软件包。
此软件包的最新版本(dev-master)没有可用的许可信息。

用于替换 Laravel 4 Auth Driver 的即插即用方案。

dev-master 2013-10-01 04:36 UTC

This package is not auto-updated.

Last update: 2020-01-19 16:28:31 UTC


README

这是一个为 Laravel 4 添加 stormpath 驱动的认证系统的提供者。
endorse

什么是 Stormpath?

logo

Stormpath 是开发者第一个简单且安全的用户管理和认证服务。通过简单的 REST API 集成,开发者可以降低开发和运营成本,同时保护用户使用最先进的网络安全。

安装

首先通过 Composer 安装此软件包。编辑您的项目 composer.json 文件以需要 lamarus/stormpath

"require": {
	"laravel/framework": "4.0.*",
	"lamarus/stormpath": "dev-master"
},
"minimum-stability" : "dev"

接下来,从终端更新 Composer

composer update

在命令完成后,运行以下命令

php artisan config:publish lamarus/stormpath

然后,前往 app/config/packages/lamarus/stormpath/config.php 并输入您的 idsecret 和您的 applicationId

添加配置后,添加服务提供者。打开 app/config/app.php,并向提供者数组中添加一个新项。

'Lamarus\Stormpath\StormpathServiceProvider'

最后一步是更改认证驱动。打开 app/config/auth.php,将驱动程序更改为 stormpath

用法

此驱动替换已被创建,以便轻松替换当前认证。所有命令都与当前方式相同。

示例

Route::get('attempt', function() {
	$user = Auth::attempt(array('username' => 'test', 'password' => '1234Abcd'));
});

Route::get('check',function() {
	Auth::check();
});

Route::get('loginUsingId',function() {
	$user = 'xXxXxXxX'; // the id from stormpath for the user
	Auth::loginUsingId($user);
});

Route::get('once', function() {
	Auth::once(array('username' => 'test', 'password' => '1234Abcd'));
});

Route::get('login', function() {
	$user = new \Lamarus\Stormpath\StormpathUser('https://api.stormpath.com/v1/accounts/xXxXxXxX');
	Auth::login($user);
});

Route::get('logout', function() {
	Auth::logout();
});