无意义2596/ez-authsch

Authsch 社交驱动程序

dev-main 2021-11-01 22:52 UTC

This package is auto-updated.

Last update: 2024-09-29 06:08:55 UTC


README

为 authsch(https://auth.sch.bme.hu/)提供的 Laravel socialite oauth2 模块

使用此命令安装

composer require nonsense2596/ez-authsch

将包文件发布到您的项目文件夹

php artisan vendor:publish

并选择 "nonsense2596/ez-authsch" 包的编号

编辑在 config/authsch.php 中要使用的作用域

可能的作用域列表

    'authsch_scopes' => [
        "basic",
        "displayName",
        "sn",
        "givenName",
        "mail",
        "linkedAccounts",
        "eduPersonEntitlement",
        "mobile",
        "niifEduPersonAttendedCourse",
        "entrants",
        "admembership",
        "bmeunitscope",
    ],

为 ez-authsch 创建所需的数据库表

php artisan migrate

要在 "ip:port/user" 路由显示已登录用户的所有可能信息,运行演示页面,请将以下内容添加到 web.php 文件中

Route::group(['middleware' => 'web'], function (){
    Route::get('/user',[UserController::class,'index'])->middleware('auth');
});

此外,登录、回调和注销函数的示例路由

Route::get('/auth/schonherz', [SocialController::class, 'schonherzRedirect'])->name('login');
Route::get('/auth/schonherz/callback', [SocialController::class, 'loginWithSchonherz']);
Route::get('/auth/schonherz/logout',[SocialController::class, 'logOutOfSchonFuckingHerz']);