neos/ldap
Composer 安装命令:
composer require neos/ldap
包简介
Ldap Authentication for Flow
README 文档
README
Example LoginController
LoginController.php:
<?php
namespace My\Package\Controller;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Security\Authentication\Controller\AbstractAuthenticationController;
/**
* @Flow\Scope("singleton")
*/
class LoginController extends AbstractAuthenticationController {
/**
* Default action, displays the login screen
*
* @param string $username Optional: A username to prefill into the username field
* @return void
*/
public function indexAction($username = NULL) {
$this->view->assign('username', $username);
}
/**
* @param \Neos\Flow\Mvc\ActionRequest $originalRequest
* @return string|void
*/
public function onAuthenticationSuccess(\Neos\Flow\Mvc\ActionRequest $originalRequest = NULL) {
$this->redirect('status');
}
/**
* Logs out a - possibly - currently logged in account.
*
* @return void
*/
public function logoutAction() {
$this->authenticationManager->logout();
$this->addFlashMessage('Successfully logged out.');
$this->redirect('index');
}
/**
* @return void
*/
public function statusAction() {
$this->view->assign('activeTokens', $this->securityContext->getAuthenticationTokens());
}
}
Index.html:
<f:form action="authenticate" >
<f:flashMessages class="errorMessages" />
<div>
<label>User</label>
<input type="text" name="__authentication[Neos][Flow][Security][Authentication][Token][UsernamePassword][username]" id="username" value="{username}" />
</div>
<div>
<label>Password</label>
<input type="password" name="__authentication[Neos][Flow][Security][Authentication][Token][UsernamePassword][password]" id="password" />
</div>
<f:form.submit value="Login" />
</div>
</f:form>
Status.html:
Status: Logged in<br/>
User: {activeTokens.LdapProvider.account.accountIdentifier}<br/>
<f:link.action action="logout">Logout</f:link.action>
Make sure you configure the policies so that the login and logout actions are available for the user. For that use a Policy.yaml like:
resources:
methods:
My_Package_LoginController: 'method(My\Package\Controller\LoginController->(index|status|login|authenticate|logout)Action())'
acls:
Everybody:
methods:
My_Package_LoginController: GRANT
Configuration examples
You can find examples of a Settings.yaml file for Ldap and Active Directory in the Configuration/ folder
of the Neos.Ldap package.
neos/ldap 适用场景与选型建议
neos/ldap 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.92k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2017 年 01 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 neos/ldap 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 neos/ldap 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 6.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-01-17