我正在尝试为php web应用程序设置SSO。我已经将mod_auth_mellon配置为apache以重定向到我的Idp页面,并且在登录时得到一个cookie。
我的httpd.conf包含以下内容:
MellonCacheSize 100
MellonLockFile "/var/run/mod_auth_mellon.lock"
MellonPostTTL 900
MellonPostSize 1048576
MellonPostCount 100
<Location /secret>
Require valid-user
AuthType "Mellon"
MellonEnable "auth"
MellonVariable "cookie"
MellonSecureCookie On
MellonCookiePath /
MellonUser "NAME_ID"
MellonMergeEnvVars On
MellonMergeEnvVars On ":"
MellonEnvVarsIndexStart 1
MellonSessionDump Off
MellonSamlResponseDump Off
MellonEndpointPath "/secret/endpoint"
MellonDefaultLoginPath "/"
MellonSessionLength 86400
MellonNoCookieErrorPage "https://example.com/no_cookie.html"
MellonSPMetadataFile /etc/apache2/mellon/sp-metadata.xml
MellonSPPrivateKeyFile /etc/apache2/ssl.key
MellonSPCertFile /etc/apache2/ssl.crt
MellonIdPMetadataFile /etc/apache2/mellon/idp-metadata.xml
MellonSamlResponseDump Off
MellonSessionDump Off
MellonAuthnContextClassRef "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport"
MellonECPSendIDPList Off
MellonRedirectDomains [self]
</Location>当我有一个index.php时,我会得到一个结果:
<?php
print_r( $_COOKIE["mellon-cookie"] );
?>看起来像:6ce7d6484360f5a98683e0ae87738635
如何使用它获取要发送到我的应用程序的用户名?
编辑:--我试过查看以下输出:
print_r( $_REQUEST );
print_r( $_SESSION );
print_r( $_POST );
print_r( $_GET );发布于 2016-06-15 17:05:14
数据存储在php中的$_SERVER变量中。
下面的php打印所有键和值。
<?php
header('Content-Type: text/plain');
foreach($_SERVER as $key=>$value) {
if(substr($key, 0, 7) == 'MELLON_') {
echo($key . '=' . $value . "\r\n");
}
}
?>https://stackoverflow.com/questions/37839967
复制相似问题