mirror of
http://124.126.16.154:8888/singularity/hyperf-saml.git
synced 2026-01-15 07:15:05 +08:00
feat(assertion): 在退出登录时移除 is_login cookie
Signed-off-by: 李东云 <dongyun.li@luxcreo.ai>
This commit is contained in:
@@ -28,7 +28,6 @@ use Singularity\HyperfSaml\Constants\SamlErrorCode;
|
||||
use Singularity\HyperfSaml\Exceptions\RuntimeException;
|
||||
use Singularity\HyperfSaml\Exceptions\ValidationException;
|
||||
use Singularity\HyperfSaml\Services\Base;
|
||||
use Teapot\StatusCode\RFC\RFC7231;
|
||||
|
||||
/**
|
||||
* 断言操作类
|
||||
@@ -140,8 +139,23 @@ class Assertion
|
||||
public function consumeLogoutResponse(LogoutResponse $response): \Psr\Http\Message\ResponseInterface
|
||||
{
|
||||
$relayState = $response->getRelayState();
|
||||
|
||||
$landing_url = config('landing_host') . $relayState;
|
||||
return $this->response->redirect($landing_url, RFC7231::FOUND);
|
||||
$login_status_cookie = new Cookie(
|
||||
'is_login',
|
||||
"0",
|
||||
time() - 1,
|
||||
'/',
|
||||
domain: config('session.options.domain'),
|
||||
httpOnly: false,
|
||||
sameSite: Cookie::SAMESITE_LAX
|
||||
);
|
||||
return $this->response
|
||||
->withCookie($login_status_cookie)
|
||||
->raw(
|
||||
new SwooleStream(
|
||||
sprintf('<script>window.location.href="%s"</script>', $landing_url)
|
||||
)
|
||||
)->withHeader(Header::CONTENT_TYPE, 'text/html');
|
||||
// return $this->response->redirect($landing_url, RFC7231::FOUND);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user