mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 02:54:20 +00:00
fix: list mapping of saml provider configuration (#6804)
Co-authored-by: Tim Möhlmann <tim+github@zitadel.com>
This commit is contained in:
parent
94cf30c547
commit
b51ad53e5a
@ -1,6 +1,7 @@
|
|||||||
package idp
|
package idp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/crewjam/saml"
|
||||||
"google.golang.org/protobuf/types/known/durationpb"
|
"google.golang.org/protobuf/types/known/durationpb"
|
||||||
|
|
||||||
obj_grpc "github.com/zitadel/zitadel/internal/api/grpc/object"
|
obj_grpc "github.com/zitadel/zitadel/internal/api/grpc/object"
|
||||||
@ -476,6 +477,10 @@ func configToPb(config *query.IDPTemplate) *idp_pb.ProviderConfig {
|
|||||||
appleConfigToPb(providerConfig, config.AppleIDPTemplate)
|
appleConfigToPb(providerConfig, config.AppleIDPTemplate)
|
||||||
return providerConfig
|
return providerConfig
|
||||||
}
|
}
|
||||||
|
if config.SAMLIDPTemplate != nil {
|
||||||
|
samlConfigToPb(providerConfig, config.SAMLIDPTemplate)
|
||||||
|
return providerConfig
|
||||||
|
}
|
||||||
return providerConfig
|
return providerConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -637,3 +642,28 @@ func appleConfigToPb(providerConfig *idp_pb.ProviderConfig, template *query.Appl
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func samlConfigToPb(providerConfig *idp_pb.ProviderConfig, template *query.SAMLIDPTemplate) {
|
||||||
|
providerConfig.Config = &idp_pb.ProviderConfig_Saml{
|
||||||
|
Saml: &idp_pb.SAMLConfig{
|
||||||
|
MetadataXml: template.Metadata,
|
||||||
|
Binding: bindingToPb(template.Binding),
|
||||||
|
WithSignedRequest: template.WithSignedRequest,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func bindingToPb(binding string) idp_pb.SAMLBinding {
|
||||||
|
switch binding {
|
||||||
|
case "":
|
||||||
|
return idp_pb.SAMLBinding_SAML_BINDING_UNSPECIFIED
|
||||||
|
case saml.HTTPPostBinding:
|
||||||
|
return idp_pb.SAMLBinding_SAML_BINDING_POST
|
||||||
|
case saml.HTTPRedirectBinding:
|
||||||
|
return idp_pb.SAMLBinding_SAML_BINDING_REDIRECT
|
||||||
|
case saml.HTTPArtifactBinding:
|
||||||
|
return idp_pb.SAMLBinding_SAML_BINDING_ARTIFACT
|
||||||
|
default:
|
||||||
|
return idp_pb.SAMLBinding_SAML_BINDING_UNSPECIFIED
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user