mirror of
http://124.126.16.154:8888/singularity/hyperf-saml.git
synced 2026-01-15 07:35:07 +08:00
fix(sso): 修复了登录和isLogin 没有区分的问题
Signed-off-by: 李东云 <dongyun.li@luxcreo.ai>
This commit is contained in:
@@ -100,6 +100,12 @@ class Assertion
|
||||
$this->redis->set($key, $token);
|
||||
}
|
||||
|
||||
// 据此判断是登录还是isLogin
|
||||
if (!empty($user['relayState'])) {
|
||||
$url = config('saml.client.landing_host');
|
||||
return $this->response->redirect($url, RFC7231::FOUND);
|
||||
}
|
||||
|
||||
return $user->toResponse();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,14 +29,12 @@ class Sso
|
||||
private string $idpAssertionUrl;
|
||||
private string $acsUrl;
|
||||
private string $issuer;
|
||||
private string $relayState;
|
||||
|
||||
public function __construct(
|
||||
private Base $base,
|
||||
private RequestInterface $request,
|
||||
private ResponseInterface $response,
|
||||
) {
|
||||
$this->relayState = $this->request->query('RelayState', '');
|
||||
|
||||
$this->idpId = config('saml.server.idp_id');
|
||||
$this->idpAssertionUrl = config('saml.server.idp_assertion_url');
|
||||
@@ -56,7 +54,6 @@ class Sso
|
||||
idpID: $this->idpAssertionUrl,
|
||||
acsUrl: $this->acsUrl,
|
||||
issuer: $this->issuer,
|
||||
relayState: $this->relayState,
|
||||
);
|
||||
return $this->response->redirect($url, RFC7231::FOUND);
|
||||
}
|
||||
@@ -69,12 +66,13 @@ class Sso
|
||||
public function redirectSso(): PsrResponseInterface
|
||||
{
|
||||
$language = $this->request->query('language') ?? config('language') ?? 'zh_CN';
|
||||
$relayState = $this->request->query('RelayState', '');
|
||||
|
||||
$url = $this->base->createSamlRequest(
|
||||
idpID: $this->idpId,
|
||||
acsUrl: $this->acsUrl,
|
||||
issuer: $this->issuer,
|
||||
relayState: $this->relayState,
|
||||
relayState: $relayState,
|
||||
exactArguments: [
|
||||
'language' => $language,
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user