Skip to content

Commit

Permalink
Merge pull request #1075 from CrowleyRajapakse/master
Browse files Browse the repository at this point in the history
Fixing token issuer CR not creating issue
  • Loading branch information
tharindu1st authored Feb 14, 2024
2 parents 5bf22c2 + eed524d commit d04dddf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apim-apk-agent/internal/eventhub/marshaller.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func MarshalKeyManager(keyManagerInternal *types.KeyManager) eventhubTypes.Resol
Name: keyManagerInternal.Name,
Enabled: keyManagerInternal.Enabled,
Type: keyManagerInternal.Type,
TenantDomain: keyManagerInternal.TenantDomain,
Organization: keyManagerInternal.Organization,
TokenType: keyManagerInternal.TokenType,
KeyManagerConfig: marshalKeyManagrConfig(keyManagerInternal.Configuration),
}
Expand Down
8 changes: 4 additions & 4 deletions apim-apk-agent/internal/k8sClient/k8s_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func DeployBackendCR(backends *dpv1alpha1.Backend, k8sClient client.Client) {
func CreateAndUpdateTokenIssuersCR(keyManager eventhubTypes.ResolvedKeyManager, k8sClient client.Client) error {
conf, _ := config.ReadConfigs()
sha1ValueofKmName := getSha1Value(keyManager.Name)
sha1ValueOfOrganization := getSha1Value(keyManager.TenantDomain)
sha1ValueOfOrganization := getSha1Value(keyManager.Organization)
labelMap := map[string]string{"name": sha1ValueofKmName, "organization": sha1ValueOfOrganization}

tokenIssuer := dpv1alpha2.TokenIssuer{
Expand All @@ -353,7 +353,7 @@ func CreateAndUpdateTokenIssuersCR(keyManager eventhubTypes.ResolvedKeyManager,
},
Spec: dpv1alpha2.TokenIssuerSpec{
Name: keyManager.Name,
Organization: keyManager.TenantDomain,
Organization: keyManager.Organization,
Issuer: keyManager.KeyManagerConfig.Issuer,
ClaimMappings: marshalClaimMappings(keyManager.KeyManagerConfig.ClaimMappings),
SignatureValidation: marshalSignatureValidation(keyManager.KeyManagerConfig),
Expand Down Expand Up @@ -412,7 +412,7 @@ func DeleteTokenIssuersCR(k8sClient client.Client, keymanagerName string, tenant
func UpdateTokenIssuersCR(keyManager eventhubTypes.ResolvedKeyManager, k8sClient client.Client) error {
conf, _ := config.ReadConfigs()
sha1ValueofKmName := getSha1Value(keyManager.Name)
sha1ValueOfOrganization := getSha1Value(keyManager.TenantDomain)
sha1ValueOfOrganization := getSha1Value(keyManager.Organization)
labelMap := map[string]string{"name": sha1ValueofKmName, "organization": sha1ValueOfOrganization}
tokenIssuer := &dpv1alpha2.TokenIssuer{}
err := k8sClient.Get(context.Background(), client.ObjectKey{Name: keyManager.UUID, Namespace: conf.DataPlane.Namespace}, tokenIssuer)
Expand All @@ -422,7 +422,7 @@ func UpdateTokenIssuersCR(keyManager eventhubTypes.ResolvedKeyManager, k8sClient
}
tokenIssuer.ObjectMeta.Labels = labelMap
tokenIssuer.Spec.Name = keyManager.Name
tokenIssuer.Spec.Organization = keyManager.TenantDomain
tokenIssuer.Spec.Organization = keyManager.Organization
tokenIssuer.Spec.Issuer = keyManager.KeyManagerConfig.Issuer
tokenIssuer.Spec.ClaimMappings = marshalClaimMappings(keyManager.KeyManagerConfig.ClaimMappings)
tokenIssuer.Spec.SignatureValidation = marshalSignatureValidation(keyManager.KeyManagerConfig)
Expand Down
4 changes: 2 additions & 2 deletions apim-apk-agent/pkg/eventhub/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ type KeyManager struct {
Name string `json:"name"`
Type string `json:"type"`
Enabled bool `json:"enabled"`
TenantDomain string `json:"tenantDomain,omitempty"`
Organization string `json:"organization,omitempty"`
TokenType string `json:"tokenType"`
Configuration map[string]interface{} `json:"additionalProperties"`
}
Expand All @@ -175,7 +175,7 @@ type ResolvedKeyManager struct {
Name string `json:"name"`
Type string `json:"type"`
Enabled bool `json:"enabled"`
TenantDomain string `json:"tenantDomain,omitempty"`
Organization string `json:"organization,omitempty"`
TokenType string `json:"tokenType"`
KeyManagerConfig KeyManagerConfig `json:"configuration"`
}
Expand Down

0 comments on commit d04dddf

Please sign in to comment.