lyseontech / drupal-external-auth
外部身份验证用户进入Drupal
0.2.1
2019-04-09 22:19 UTC
Requires
- php: >=7.2
- drupal/core-utility: ^8.6
- symfony/http-foundation: ^4.2
- wikimedia/php-session-serializer: ^1.0
Requires (Dev)
- overtrue/phplint: ^0.2.1
- phpstan/phpstan: ^0.7.0
- phpunit/phpunit: ^6.1
- satooshi/php-coveralls: ^2.1
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2024-08-29 05:00:32 UTC
README
Drupal External Auth
Composer包,用于外部验证Drupal用户
如果用户存在于Drupal中,则验证用户。
如果用户不存在于Drupal中,则创建用户并验证。
如何使用?
composer require lyseontech/drupal-external-auth
登录
$response = new Response(); $pdo = new PDO(...); (new \DrupalExternalAuth\Auth($response, $pdo))->auth([ 'name' => 'username', 'pass' => 'PrefixHash$' . 'hashOfPassord', 'timezone' => 'America/Sao_Paulo', 'langcode' => 'pt-br', 'roles' => ['administrator'] ]); foreach ($response->headers->getCookies() as $cookie) { header('Set-Cookie: '.$cookie->getName().strstr($cookie, '=')); }
在PrefixHash中,放置前缀哈希以从您的系统中识别哈希密码。
在hashPassord中放置用户的哈希,如果不使用,则用户可以通过Drupal默认登录页面在Drupal中进行验证,在此字段中放置任何内容。
如果您没有在Drupal中实现自定义验证哈希,则用户只能通过您的系统访问Drupal。
注销
$response = new Response(); $pdo = new PDO(...); (new \DrupalExternalAuth\Auth($response, $pdo))->logout(); foreach ($response->headers->getCookies() as $cookie) { header('Set-Cookie: '.$cookie->getName().strstr($cookie, '=')); }