我遇到了一个问题。我将laravel网站从4.2更新到6.12,这主要是一个手动项目,而我偶然发现了laravel,AWS和SimpleSamlphp的问题。当您将负载平衡器连接到AWS时,这使得在AWS的一台服务器上拥有两个网站变得相当困难。
在SimpleSamlphp中,您需要将部分软件包公开给互联网。但是,在Laravel中,要运行原生PHP文件/脚本而不通过框架过滤它们是相当困难的。由于我使用composer安装了SimpleSamlphp,因此所有内容都托管在vender目录中。很少有文档支持作曲家的安装,而且我不确定如何将simplesamlphp/simplesamlphp/www/*
公开到互联网。顺便说一句,我试图成为服务提供商。
我无法配置AWS以支持第二个网页,Laravel正在过滤我的路由,而SimpleSamlphp几乎没有关于PSR标准及其应如何配置的文档。
我无法进入simplesamlphp的欢迎页面。我可能会缺少发布脚本吗?
我已经尝试将simplesamlphp/www/*
放入public/
目录,并使用在2013年堆栈溢出中发现的以下内容。
Route::get("/", function() {
ob_start();
require("www/module.php");
return ob_get_clean();
});
Route::get("/", function() {
ob_start();
require("www/index.php");
return ob_get_clean();
});
但是它不起作用。由于这是一次升级,因此从技术上讲,我应该可以获取元数据,配置,并且使用一些新证书可以使它起作用。但是我不愿透露这些网页。现在,由于无法接收ACS呼叫,我陷入了身份验证循环。至少那是我最好的猜测。
这是我的元数据,我不排除自己弄错了。saml20-idp-remote.php
<?php
$metadata['CLIENTCONFIG'] = array (
'metadata-set' => 'saml20-idp-remote',
'entityid' => 'CLIENTCONFIG',
'AssertionConsumerService' => 'http://myServer.com/acs_response',
'SingleSignOnService' =>
array (
0 =>
array (
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
'Location' => 'https://www.destination.com/',
),
'SingleLogoutService' => '',
'certificate' => 'x509.crt',
'certFingerprint'=>'OP:K7:91:89:9G:AB:0Y:JF:2V:F9:90:2V:6O:5C:41:9D:PL:FG:45:34',
'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
)
);
?>
authsources.php:
<?php
$config = [
/* This is the name of this authentication source, and will be used to access it later. */
'admin' => array(
// The default is to use core:AdminPassword, but it can be replaced with
// any authentication source.
'core:AdminPassword',
),
'CLIENTCONFIG' => array(
'saml:SP',
'idp'=>'CLIENTCONFIG',
'acs.Bindings' => array(
'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
'urn:oasis:names:tc:SAML:1.0:profiles:browser-post',
),
'ForceAuthn' => TRUE,
'entityID' => 'CLIENTCONFIG',
'saml:idp' => 'CLIENTCONFIG',
'discoURL' => null,
'privatekey' => 'saml.pem',
'certificate' => 'saml.crt',
'redirect.sign' => TRUE,
'redirect.validate' => TRUE,
'OrganizationName' => array(
'en' => 'TheCompanyIWorkFor',
),
'OrganizationURL'=>'www.TheCompanyIWorkFor.com',
'sign.authnrequest'=> TRUE,
),
];
现在,当我尝试这是我的SAML检查器所说的:如果您发现我的ACS与我输入的ASC不匹配。我认为这是默认设置。
<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="_1234567890987654321234567890QWERTYUIOPASDFGHJKL"
Version="2.0"
IssueInstant="2020-02-10T14:36:01Z"
Destination=""
AssertionConsumerServiceURL="http://mywebsite.com/module.php/saml/sp/saml2-acs.php/CLIENTCONFIG"
ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
>
<saml:Issuer>CLIENTCONFIG</saml:Issuer>
<samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
AllowCreate="true"
/>
</samlp:AuthnRequest>
这是我的UserController方法,用于选择登录路径:
use SimpleSAML\Auth\Simple;
public function getLogin(){
if(!\Auth::check()) {
$auth = New Simple('CLIENTCONFIG');
dump('getLogin method');
$auth->requireAuth([
'ReturnTo' => 'http://myWebsite/dashboard',
'KeepPost' => FALSE,
]);
\SimpleSAML\Session::getSessionFromRequest()->cleanup();
}
$data=Array();
// I get throw into an infinite loop of request generation.
return view('user.login', $data);
}
我对SSO并不了解很多,而且我已经花了很长时间了!因此,如果有人可以帮助将其配置为作曲家软件包,我将不胜感激。目标是访问SSO URL,并重定向到IDP进行登录,然后将其发送回去。这可能是太多信息,并且已经被打乱了,但是在这一点上,我没有什么可失去的。
[不,这是不一样的:Single sign on using SimpleSamlPhp wrapper on Laravel该问题实际上是针对另一个软件包的。
谢谢!
这里有几个问题。主要的原因是我无法访问simplesamlphp的内置网页。
在我的本地环境中,laravel不会让我离开框架。但是我发现我可以在我的AWS开发服务器上使用www /到达那里。
由于此文件是使用composer安装的,因此我必须使用此链接并调整我的baseurlpath。http://example.com/www/module.php/core/frontpage_welcome.php
我无法强调打入simplesaml后端网页的重要性。这为您提供了完成项目所需的所有工具。如果无法理解,请尝试在URL的www
部分之前添加module.php
。
而且我的元数据有问题这个:
<?php
$metadata['CLIENTCONFIG'] = array (
'metadata-set' => 'saml20-idp-remote',
'entityid' => 'CLIENTCONFIG',
'AssertionConsumerService' => 'http://mysite/acs_response',
'SingleSignOnService' =>
array (
0 =>
array (
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
'Location' => 'https://www.destination.com/',
),
'SingleLogoutService' => '',
'certificate' => 'x509.crt',
'certFingerprint'=>'OP:K7:91:89:9G:AB:0Y:JF:2V:F9:90:2V:6O:5C:41:9D:PL:FG:45:34',
'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
)
);
?>
应该是:
<?php
$metadata['CLIENTCONFIG'] = array (
'metadata-set' => 'saml20-idp-remote',
'entityid' => 'CLIENTCONFIG',
'AssertionConsumerService' => 'http://mysite/acs_response',
'SingleSignOnService' =>
array (
0 =>
array (
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
'Location' => 'https://www.destination.com/',
),
),
'SingleLogoutService' => '',
'certificate' => 'x509.crt',
'certFingerprint'=>'OP:K7:91:89:9G:AB:0Y:JF:2V:F9:90:2V:6O:5C:41:9D:PL:FG:45:34',
'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
);
?>
我在数组中有最后一个块,它不应该在那里。同样,尝试访问该网页。
而且我还必须设置我的'baseurlpath' => 'http://example.com/www'
完成之后,所有生成的路径都包括www,而无需将其注入我的URL即可到达。
故事的道德感,尽一切可能达到www/module.php/core/frontpage_welcome.php
世界将从那里打开,包括用于创建元数据的工具。(并且example.com应该是您正在使用的网站。不是联合服务器。只是为了澄清。)