发布于 2018-03-07 07:46:10
PowerSchool的开放ID SSO (单点登录)目前只有在请求从PowerSchool的站点启动时才能工作。因此,从创建Open链接插件开始。
SSO链接插件
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://plugin.powerschool.pearson.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation='http://plugin.powerschool.pearson.com plugin.xsd'
name="Insert Your PluginsName"
version="1.0.0"
description="Insert a description here">
<!-- The host name without scheme i.e., https. This is the host with which PowerSchool will perform the handshake -->
<!-- and will pass the attributes to. -->
<!-- NOTE: This host must have a valid SSL for this to work. -->
<openid host="www.myopenid.com">
<links>
<link display-text="Insert links display text here"
title="Insert links title here"
path="/openidlogin">
<!-- The relative path to the hostname Open ID initiation is performed on the host specified above i.e., -->
<!-- www.myopenid.com/openidlogin -->
<ui_contexts>
<!-- You may add other user contexts too i.e., guardian etc -->
<ui_context id="admin.header" />
<ui_context id="admin.left_nav" />
</ui_contexts>
</link>
</links>
</openid>
<publisher name="XYZ">
<contact email="xyzAtmyopenId.com"/>
</publisher>
</plugin>xyzps.com/admin/home.htmlLightOpenID
转到LightOpenID并将其添加到您的项目中。
使用PowerSchool和属性请求进行身份验证
在openid主机插件中提到的路径上,/openidlogin添加所需的属性并重定向到身份验证url:
$openid = new LightOpenID("Insert hostname i.e., www.myopenid.com");
$openid->identity = $_GET['openid_identifier'];
$openid->required = array(
'email'=>'http://powerschool.com/entity/email'
);
$openid->returnUrl = 'Insert SSL enabled hostname i.e., https://www.myopenid.com/authenticateopenid';
header('Location: ' . $openid->authUrl());自定义LightOpenID
在继续之前,我们需要修改LightOpenID,因为它以http://axschema.org/作为属性的前缀,因此不会返回属性值。为此,请执行以下操作:
LightOpenID.php -> axParams()并进行更改
$this->别名$别名= 'http://axschema.org/‘。$field;
至
$this->别名$别名= $field;LightOpenID.php -> getAxAttributes()并进行更改
$key = substr($this->getItem($prefix )。'_type_‘.( $key),$length);
至
$key = $this->getItem($prefix )。'_type_‘.$key);验证和检索用户属性
在Open的返回URL (即authenticateopenid )中指定的路径上,验证用户并检索其属性:
$openid = new LightOpenID("Insert hostname i.e., www.myopenid.com");
if ($openid->mode)
{
if ($openid->mode == 'cancel') {
echo "User has canceled authentication !";
} elseif ($openid->validate()) {
$data = $openid->getAttributes();
$email = $data['http://powerschool.com/entity/email'];
echo "</br>Email: " . $email . "</br>";
}
else {
echo "The user has not logged in";
}
}
else {
echo "Go to PowerSchool to log in.";
}https://stackoverflow.com/questions/49146474
复制相似问题