feat: support third-party application to login with SAML rather than only Casdoor itself (#350)

Signed-off-by: Yixiang Zhao <seriouszyx@foxmail.com>
This commit is contained in:
Yixiang Zhao
2021-12-10 00:23:04 +08:00
committed by GitHub
parent 70a550d8bc
commit b73b9a65b6
5 changed files with 63 additions and 16 deletions

View File

@ -186,8 +186,15 @@ class LoginPage extends React.Component {
}
getSamlUrl(providerId) {
const params = new URLSearchParams(this.props.location.search);
let clientId = params.get("client_id")
let application = params.get("state");
let realRedirectUri = params.get("redirect_uri");
let redirectUri = `${window.location.origin}/callback/saml`
let providerName = providerId.split('/')[1];
AuthBackend.getSamlLogin(providerId).then((res) => {
window.location.href = res.data
const replyState = `${clientId}&${application}&${providerName}&${realRedirectUri}&${redirectUri}`;
window.location.href = `${res.data}&RelayState=${btoa(replyState)}`;
});
}