Add oidcapp clientsecretname

[ZITADOPER-1]
This commit is contained in:
Haim Kortovich
2024-05-21 19:20:48 -05:00
parent dac9d1a52f
commit dd782c0fc4
2 changed files with 6 additions and 1 deletions

View File

@@ -143,6 +143,10 @@ func (d *OIDCApp) Project(ctx context.Context, refresolver *RefResolver) (*Proje
return project, nil
}
func (d *OIDCApp) ClientSecretName() string {
return d.Name + "-client-secret"
}
//+kubebuilder:object:root=true
// OIDCAppList contains a list of OIDCApp

View File

@@ -117,6 +117,7 @@ func (wr *wrappedOIDCAppReconciler) Reconcile(ctx context.Context, ztdClient *ma
for _, r := range wr.OIDCApp.Spec.GrantTypes {
grantTypes = append(grantTypes, app.OIDCGrantType(app.OIDCGrantType_value[string(r)]))
}
if wr.OIDCApp.Status.AppId != "" {
appResp, err := ztdClient.GetAppByID(middleware.SetOrgID(ctx, org.Status.OrgId), &pb.GetAppByIDRequest{
ProjectId: project.Status.ProjectId,
@@ -180,7 +181,7 @@ func (wr *wrappedOIDCAppReconciler) Reconcile(ctx context.Context, ztdClient *ma
return fmt.Errorf("error creating OIDCApp in Zitadel: %v", err)
}
key := types.NamespacedName{
Name: wr.OIDCApp.Name + "-client-secret",
Name: wr.OIDCApp.ClientSecretName(),
Namespace: wr.OIDCApp.Namespace,
}