mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-30 16:08:56 +00:00
feat: get/list Zitadel IdP (#12394)
# Which Problems Are Solved This PR extends the functionality of `GetProviderByID`, `ListProviders` v1 endpoints and `GetIDPByID` v2 endpoint to also return Zitadel IdP when queried. # How the Problems Are Solved - Add `PROVIDER_TYPE_ZITADEL` and a `ZitadelConfig` to `zitadel.idp.v1.ProviderConfig` (v1 APIs). - Add `IDP_TYPE_ZITADEL`, `ZitadelConfig`, `InstanceRolesInfo` in v2 `idp.proto` - Extend internal/query IDP template querying to include a `ZitadelIDPTemplate` (incl. issuer, client credentials, scopes, instance roles info). - Add/extend integration tests for updating + fetching providers by ID and listing providers. # Additional Changes N/A # Additional Context Closes https://github.com/zitadel/zitadel/issues/12051 --------- Co-authored-by: Copilot Autofix powered by AI <[email protected]>
This commit is contained in:
co-authored by
Copilot Autofix powered by AI
parent
39ad66bded
commit
77169181a3
@@ -85,6 +85,8 @@ func idpTypeToPb(idpType domain.IDPType) idp_pb.IDPType {
|
||||
return idp_pb.IDPType_IDP_TYPE_APPLE
|
||||
case domain.IDPTypeSAML:
|
||||
return idp_pb.IDPType_IDP_TYPE_SAML
|
||||
case domain.IDPTypeZitadel:
|
||||
return idp_pb.IDPType_IDP_TYPE_ZITADEL
|
||||
case domain.IDPTypeUnspecified:
|
||||
return idp_pb.IDPType_IDP_TYPE_UNSPECIFIED
|
||||
default:
|
||||
@@ -150,6 +152,10 @@ func configToPb(config *query.IDPTemplate) *idp_pb.IDPConfig {
|
||||
samlConfigToPb(idpConfig, config.SAMLIDPTemplate)
|
||||
return idpConfig
|
||||
}
|
||||
if config.ZitadelIDPTemplate != nil {
|
||||
zitadelConfigToPb(idpConfig, config.ZitadelIDPTemplate)
|
||||
return idpConfig
|
||||
}
|
||||
return idpConfig
|
||||
}
|
||||
|
||||
@@ -387,3 +393,21 @@ func signatureAlgorithmToPb(signatureAlgorithm string) idp_pb.SAMLSignatureAlgor
|
||||
return idp_pb.SAMLSignatureAlgorithm_SAML_SIGNATURE_UNSPECIFIED
|
||||
}
|
||||
}
|
||||
|
||||
func zitadelConfigToPb(idpConfig *idp_pb.IDPConfig, template *query.ZitadelIDPTemplate) {
|
||||
instanceRolesInfo := make([]*idp_pb.InstanceRolesInfo, 0, len(template.InstanceRolesInfo))
|
||||
for _, role := range template.InstanceRolesInfo {
|
||||
instanceRolesInfo = append(instanceRolesInfo, &idp_pb.InstanceRolesInfo{
|
||||
OrganizationId: role.OrganizationID,
|
||||
OrganizationDomain: role.OrganizationDomain,
|
||||
})
|
||||
}
|
||||
idpConfig.Config = &idp_pb.IDPConfig_Zitadel{
|
||||
Zitadel: &idp_pb.ZitadelConfig{
|
||||
ClientId: template.ClientID,
|
||||
Issuer: template.Issuer,
|
||||
Scopes: template.Scopes,
|
||||
InstanceRolesInfo: instanceRolesInfo,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user