mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-28 15:08:51 +00:00
feat: command layer implementation for AddZitadelProvider (#12020)
# Which Problems Are Solved This PR contains the command-layer implementation to add an instance IDP of the type `ZitadelProvider` # How the Problems Are Solved - Implementing `AddZitadelProvider` in AdminService - Adding the command-layer to create a `ZitadelProvider` and push `ZitadelIDPAddedEvent` # Additional Changes N/A # Additional Context - Related to https://github.com/zitadel/zitadel/issues/11823 - Follow-up for PR https://github.com/zitadel/zitadel/pull/12018 --------- Co-authored-by: Copilot <[email protected]>
This commit is contained in:
co-authored by
Copilot
parent
01fe34a526
commit
bb3b52dda3
@@ -1,6 +1,8 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/crewjam/saml"
|
||||
"github.com/muhlemmer/gu"
|
||||
dsig "github.com/russellhaering/goxmldsig"
|
||||
@@ -11,6 +13,7 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
||||
"github.com/zitadel/zitadel/internal/query"
|
||||
"github.com/zitadel/zitadel/internal/repository/idp"
|
||||
"github.com/zitadel/zitadel/internal/zerrors"
|
||||
admin_pb "github.com/zitadel/zitadel/pkg/grpc/admin"
|
||||
idp_pb "github.com/zitadel/zitadel/pkg/grpc/idp"
|
||||
@@ -545,3 +548,22 @@ func signatureAlgorithmToCommand(signatureAlgorithm idp_pb.SAMLSignatureAlgorith
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func addZitadelProviderToCommand(req *admin_pb.AddZitadelProviderRequest) command.ZitadelProvider {
|
||||
instanceRolesInfo := make([]idp.RolesInfo, 0, len(req.InstanceRolesInfo))
|
||||
for _, info := range req.InstanceRolesInfo {
|
||||
instanceRolesInfo = append(instanceRolesInfo, idp.RolesInfo{
|
||||
OrganizationID: strings.TrimSpace(info.OrganizationId),
|
||||
OrganizationDomain: strings.TrimSpace(info.OrganizationDomain),
|
||||
})
|
||||
}
|
||||
return command.ZitadelProvider{
|
||||
Name: req.Name,
|
||||
Issuer: req.Issuer,
|
||||
ClientID: req.ClientId,
|
||||
ClientSecret: req.ClientSecret,
|
||||
Scopes: req.Scopes,
|
||||
IDPOptions: idp_grpc.OptionsToCommand(req.ProviderOptions),
|
||||
InstanceRolesInfo: instanceRolesInfo,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user