Add application.EnableSamlC14n10

This commit is contained in:
Yang Luo 2023-10-20 22:37:23 +08:00
parent b68e291f37
commit 22b57fdd23
3 changed files with 18 additions and 2 deletions

View File

@ -57,6 +57,7 @@ type Application struct {
EnableAutoSignin bool `json:"enableAutoSignin"` EnableAutoSignin bool `json:"enableAutoSignin"`
EnableCodeSignin bool `json:"enableCodeSignin"` EnableCodeSignin bool `json:"enableCodeSignin"`
EnableSamlCompress bool `json:"enableSamlCompress"` EnableSamlCompress bool `json:"enableSamlCompress"`
EnableSamlC14n10 bool `json:"enableSamlC14n10"`
EnableWebAuthn bool `json:"enableWebAuthn"` EnableWebAuthn bool `json:"enableWebAuthn"`
EnableLinkWithEmail bool `json:"enableLinkWithEmail"` EnableLinkWithEmail bool `json:"enableLinkWithEmail"`
OrgChoiceMode string `json:"orgChoiceMode"` OrgChoiceMode string `json:"orgChoiceMode"`

View File

@ -324,6 +324,11 @@ func GetSamlResponse(application *Application, user *User, samlRequest string, h
} }
ctx := dsig.NewDefaultSigningContext(randomKeyStore) ctx := dsig.NewDefaultSigningContext(randomKeyStore)
ctx.Hash = crypto.SHA1 ctx.Hash = crypto.SHA1
if application.EnableSamlC14n10 {
ctx.Canonicalizer = dsig.MakeC14N10RecCanonicalizer()
}
//signedXML, err := ctx.SignEnvelopedLimix(samlResponse) //signedXML, err := ctx.SignEnvelopedLimix(samlResponse)
//if err != nil { //if err != nil {
// return "", "", fmt.Errorf("err: %s", err.Error()) // return "", "", fmt.Errorf("err: %s", err.Error())

View File

@ -640,13 +640,23 @@ class ApplicationEditPage extends React.Component {
}} /> }} />
</Col> </Col>
</Row> </Row>
<Row style={{marginTop: "20px"}} >
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 19 : 2}>
{Setting.getLabel(i18next.t("application:Enable SAML C14N10"), i18next.t("application:Enable SAML C14N10 - Tooltip"))} :
</Col>
<Col span={1} >
<Switch checked={this.state.application.enableSamlC14n10} onChange={checked => {
this.updateApplicationField("enableSamlC14n10", checked);
}} />
</Col>
</Row>
<Row style={{marginTop: "20px"}} > <Row style={{marginTop: "20px"}} >
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}> <Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
{Setting.getLabel(i18next.t("general:SAML Attribute"), i18next.t("general:SAML Attribute - Tooltip"))} : {Setting.getLabel(i18next.t("general:SAML attributes"), i18next.t("general:SAML attributes - Tooltip"))} :
</Col> </Col>
<Col span={22} > <Col span={22} >
<SamlAttributeTable <SamlAttributeTable
title={i18next.t("general:SAML Attribute")} title={i18next.t("general:SAML attributes")}
table={this.state.application.samlAttributes} table={this.state.application.samlAttributes}
application={this.state.application} application={this.state.application}
onUpdateTable={(value) => {this.updateApplicationField("samlAttributes", value);}} onUpdateTable={(value) => {this.updateApplicationField("samlAttributes", value);}}