mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-15 20:23:50 +08:00
feat: add casdoor as saml idp support (#571)
* feat: add casdoor as saml idp support Signed-off-by: 0x2a <stevesough@gmail.com> * fix: merge code Signed-off-by: 0x2a <stevesough@gmail.com> * fix: modify response value Signed-off-by: Steve0x2a <stevesough@gmail.com> * fix: modify samlResponse generation method Signed-off-by: Steve0x2a <stevesough@gmail.com> * fix: generating a response using etree Signed-off-by: Steve0x2a <stevesough@gmail.com> * fix: change metadata url Signed-off-by: Steve0x2a <stevesough@gmail.com> * fix: modify front-end adaptation Signed-off-by: Steve0x2a <stevesough@gmail.com> * fix: recovering an incorrect override Signed-off-by: Steve0x2a <stevesough@gmail.com> * fix: change the samlResponse location Signed-off-by: Steve0x2a <stevesough@gmail.com> * fix: add relayState support Signed-off-by: Steve0x2a <stevesough@gmail.com>
This commit is contained in:
@ -49,6 +49,10 @@ class AuthCallback extends React.Component {
|
||||
const realRedirectUri = innerParams.get("redirect_uri");
|
||||
// Casdoor's own login page, so "code" is not necessary
|
||||
if (realRedirectUri === null) {
|
||||
const samlRequest = innerParams.get("SAMLRequest");
|
||||
if (samlRequest !== null && samlRequest !== undefined && samlRequest !== "") {
|
||||
return "saml"
|
||||
}
|
||||
return "login";
|
||||
}
|
||||
|
||||
@ -92,6 +96,7 @@ class AuthCallback extends React.Component {
|
||||
const applicationName = innerParams.get("application");
|
||||
const providerName = innerParams.get("provider");
|
||||
const method = innerParams.get("method");
|
||||
const samlRequest = innerParams.get("SAMLRequest");
|
||||
|
||||
let redirectUri = `${window.location.origin}/callback`;
|
||||
|
||||
@ -100,6 +105,7 @@ class AuthCallback extends React.Component {
|
||||
application: applicationName,
|
||||
provider: providerName,
|
||||
code: code,
|
||||
samlRequest: samlRequest,
|
||||
// state: innerParams.get("state"),
|
||||
state: applicationName,
|
||||
redirectUri: redirectUri,
|
||||
@ -127,6 +133,10 @@ class AuthCallback extends React.Component {
|
||||
} else if (responseType === "link") {
|
||||
const from = innerParams.get("from");
|
||||
Setting.goToLinkSoft(this, from);
|
||||
} else if (responseType === "saml") {
|
||||
const SAMLResponse = res.data;
|
||||
const redirectUri = res.data2;
|
||||
Setting.goToLink(`${redirectUri}?SAMLResponse=${encodeURIComponent(SAMLResponse)}&RelayState=${oAuthParams.relayState}`);
|
||||
}
|
||||
} else {
|
||||
this.setState({
|
||||
|
Reference in New Issue
Block a user