150 lines
8.9 KiB
Go
150 lines
8.9 KiB
Go
<div class="container-fluid">
|
||
<div class="panel panel-default">
|
||
<div class="panel-body">
|
||
<div class="page-header">
|
||
<h4><i class="fa fa-address-card-o"></i> 登录认证方式配置文档</h4>
|
||
</div>
|
||
<!-- Nav tabs -->
|
||
<ul class="nav nav-tabs" role="tablist">
|
||
<li role="presentation" class="active"><a href="#ldap" aria-controls="ldap" role="tab" data-toggle="tab">LDAP登录</a></li>
|
||
<li role="presentation"><a href="#http" aria-controls="http" role="tab" data-toggle="tab">HTTP登录</a></li>
|
||
</ul>
|
||
<br>
|
||
<!-- Tab panes -->
|
||
<div class="tab-content">
|
||
<div role="tabpanel" class="tab-pane active" id="ldap">
|
||
<div class="panel panel-default">
|
||
<table class="table table-bordered">
|
||
<tbody>
|
||
<tr>
|
||
<td class="w10p"><strong>认证URL</strong></td>
|
||
<td>
|
||
格式为:<code>ldap://ldap.server:port</code> 或 <code>ldaps://ldap.server:port</code>
|
||
其中 ldap.server 为 ldap 服务器地址 port 为 ldap 服务器端口;
|
||
ldaps 为 ssl 加密的 ldap;<br>
|
||
示例:<code>ldap://ldap.itd.umich.edu:389;</code> <code>ldaps://ldap.itd.umich.edu:636</code>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td><strong>附加参数(配置数据)</strong></td>
|
||
<td>配置数据格式必须为 json 字符串,字段含义如下
|
||
<pre>
|
||
{
|
||
"basedn": "dc=umich,dc=edu", // ldap base dn; 用于搜索的节点;必填不能为空
|
||
"bind_username": "cn=readonly,dc=umich,dc=edu", // ldap bind dn; 用来获取查询权限的 bind 用户;非必填可以为空
|
||
"bind_password": "password", // ldap bind dn password; bind 用户密码;非必填可以为空
|
||
"account_pattern": "(&(objectClass=User)(userPrincipalName=%s))" // ldap search pattern; 非必填可以为空,默认值为(&(objectClass=User)(userPrincipalName=%s))
|
||
"given_name_key": "displayName", // ldap 查询用户名对应的 key,非必填可以为空,默认为 displayName
|
||
"email_key": "mail", // ldap 查询邮箱对应的 key, 非必填可以为空
|
||
"mobile_key": "mobile", // ldap 查询手机号对应的 key,非必填可以为空
|
||
"phone_key": "telephoneNumber", // ldap 查询电话对应的 key,非必填可以为空
|
||
"department_key": "department", // ldap 查询部门对应的 key,非必填可以为空
|
||
"position_key": "Position", // ldap 查询职位对应的 key,非必填可以为空
|
||
"location_key": "physicalDeliveryOfficeName", // ldap 查询位置对应的 key,非必填可以为空
|
||
"im_key": "im" // ldap 查询 im 信息对应的 key,非必填可以为空
|
||
}
|
||
</pre>
|
||
示例:<code>{"basedn":"dc=umich,dc=edu","bind_username":"readonly","bind_password":"password","given_name_key":"displayName","email_key":"mail","mobile_key":"mobile","phone_key":"telephoneNumber","department_key":"department","position_key":"Position","location_key":"physicalDeliveryOfficeName","im_key":"im"}</code>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td><strong>注意事项</strong></td>
|
||
<td>
|
||
请确保配置数据为 <code>json</code> 格式字符串,且配置数据正确无误;
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<div role="tabpanel" class="tab-pane" id="http">
|
||
<div class="panel panel-default">
|
||
<table class="table table-bordered">
|
||
<tbody>
|
||
<tr>
|
||
<td class="w10p"><strong>认证URL</strong></td>
|
||
<td>
|
||
用户获取登录结果的接口 http/https 协议的 url
|
||
例如:<code>http://mmWiki.com/login</code> 或 <code>https://mmWiki.com/login</code>
|
||
<a target="_blank" href="https://github.com/phachon/mm-wiki/blob/master/docs/examples/auth_login/http_login.php">
|
||
<i class="fa fa-share"></i> PHP 开发接口示例
|
||
</a>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td><strong>附加参数(配置数据)</strong></td>
|
||
<td>
|
||
根据接口需要填写;例如某些统一登录接口需要携带登录来源,这里可以写 source=mm-wiki
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td><strong>URL请求方式</strong></td>
|
||
<td><code>POST</code>; MM-Wiki 会以 POST 表单提交的方式(即Content-Type: application/x-www-form-urlencoded)去请求登录认证接口;所以该 URL 必须支持 POST 请求</td>
|
||
</tr>
|
||
<tr>
|
||
<td>URL请求参数</td>
|
||
<td>
|
||
这里是指 MM-Wiki 以 POST 方式请求登录认证的 URL 接口时带的请求参数
|
||
<pre>
|
||
username: 用户名 string; 即用户统一登录输入的用户名;
|
||
password: 密码 string; 即用户统一登录输入的密码;
|
||
ext_data: 登录认证附加参数 string; 即登录配置填写的 附加参数(配置数据)
|
||
</pre>
|
||
示例:<code>username=mm-wiki&password=111111&ext_data=mm-wiki</code>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td><strong>URL返回格式</strong></td>
|
||
<td>
|
||
MM-Wiki 请求登录认证接口,登录认证接口认证完成后返回的数据格式必须为 json 协议,具体协议如下:
|
||
<li>
|
||
<strong>成功返回</strong>
|
||
<pre>
|
||
{
|
||
// 认证接口信息,必须返回,成功为空,失败非空
|
||
"message": "",
|
||
// 认证成功用户数据,必须返回, 成功时非空
|
||
"data": {
|
||
"given_name": "王哈哈", // 用户姓名,string,<code>不能为空</code>
|
||
"mobile": "111111111111", // 用户手机号,string,可以为空
|
||
"phone": "010-9929921", // 用户电话,string,可以为空
|
||
"email": "root@mmWiki.com", // 用户邮箱,string,<code>不能为空</code>
|
||
"department": "广告事业部.技术部.系统开发组", // 用户所属部门,string,可以为空
|
||
"position": "高级JAVA开发工程师", // 职位,string,可以为空
|
||
"location": "B座32层E区1002", // 工位位置,string,可以为空
|
||
"im": "QQ:12211", // 即时聊天工具,string,可以为空
|
||
}
|
||
}
|
||
</pre>
|
||
</li>
|
||
<li>
|
||
<strong>失败返回</strong>
|
||
<pre>
|
||
{
|
||
// 失败原因,失败时不能为空
|
||
"message": "密码错误",
|
||
// 失败时为空
|
||
"data": {}
|
||
}
|
||
</pre>
|
||
</li>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>注意事项</td>
|
||
<td> http 登录认证的原理是:当用户选择http方式的统一认证登录时,MM-Wiki 将用户名和密码一起发送到配置的登录认证接口,
|
||
根据接口返回的结果 message 为空判断登录成功,并从 data 字段获取到用户信息存储到 MM-Wiki 系统中;如果登录失败请参考以上文档说明!
|
||
<a target="_blank" href="https://github.com/phachon/mm-wiki/blob/master/docs/examples/auth_login/http_login.php">
|
||
<i class="fa fa-share"></i> PHP 开发接口示例
|
||
</a>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|