の検索結果 :
×Laravel OAuth シングルサインオン (SSO) プラグインは、Laravel アプリケーションで OAuth シングルサインオン (SSO) を有効にする機能を提供します。シングルサインオンを使用すると、Laravel アプリケーションとサービスに 1 つのパスワードのみでアクセスできます。このプラグインは、OAuth 準拠のすべてのアイデンティティプロバイダーと互換性があります。ここでは、Laravel Passport を OAuth プロバイダーとして、Laravel と Laravel Passport 間のシングルサインオン (SSO) を設定する手順を段階的に説明します。Laravel OAuth クライアント シングルサインオン SSO プラグインで提供されるその他の機能の詳細については、こちらをご覧ください。 こちらをクリックしてください。.
composer require miniorange/oauth-laravel-free
{laravel-application-domain}/mo_oauth_admin
composer require laravel/passport
Laravel\Passport\PassportServiceProvider::class
namespace App;
use Laravel\Passport\HasApiTokens;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use HasApiTokens, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}
namespace App\Providers;
use Laravel\Passport\Passport;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
// 'App\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
Passport::routes();
//
}
}
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'passport',
'provider' => 'users',
'hash' => false,
],
],
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\User;
use Auth;
class UserController extends Controller
{
public function get(Request $request)
{
$user_id = Auth::id();
$user = User::find($user_id);
return $user;
}
}
//For Laravel below 8 and migrated to the 8 version:
Route::middleware('auth:api')->get('/user/get', 'UserController@get');
OR
//For Laravel 8 new users:
use App\Http\Controllers\UserController;
Route::middleware('auth:api')->get('/user/get', 'App\Http\Controllers\UserController@get');
Which user ID should the client be assigned to?:
> 1
What should we name the client?
> Demo OAuth2 Client Account
Where should we redirect the request after authorization?
[http://localhost/auth/callback]
> Click Here to copy the Redirect URL.
New client created successfully.
Client ID: 1
Client secret: zMm0tQ9Cp7LbjK3QTgPy1pssoT1X0u7sg0YWUW01
| 範囲: | スコープフィールドは空のままにしておきます |
| エンドポイントを承認します: | http://your-laravel-site-url/oauth/authorize |
| アクセストークンエンドポイント: | http://your-laravel-site-url/oauth/token |
| UserInfo エンドポイントの取得: | http://your-laravel-site-url/api/user/get |
{laravel-application-domain}/ssologin.php?option=oauthredirect
このガイドでは、正常に構成されています Laravel Passport シングルサインオン (SSO) OAuthクライアントとしてのLaravel。 このソリューションにより、Laravel サイトへの安全なアクセスを展開する準備が整います。 Laravelパスポートのログイン 数分以内に資格情報を取得します。
助けが必要? 私たちはここにいます!
お問い合わせありがとうございます。
24 時間以内に当社からのご連絡がない場合は、お気軽にフォローアップ メールを送信してください。 info@xecurify.com
リクエストが失敗しました。
メールを送信してみてください info@xecurify.com
