Update how unique is handled in provider

This commit is contained in:
Abin Simon
2022-05-27 13:51:28 +05:30
parent f1e2e02891
commit 18269e0728
2 changed files with 5 additions and 3 deletions
@@ -25,9 +25,9 @@ ALTER TABLE authsrv_oidc_provider OWNER TO admindbuser;
ALTER TABLE ONLY authsrv_oidc_provider ADD CONSTRAINT authsrv_oidc_provider_pkey PRIMARY KEY (id);
ALTER TABLE ONLY authsrv_oidc_provider ADD CONSTRAINT authsrv_oidc_provider_id_name_key UNIQUE (id,name);
CREATE UNIQUE index authsrv_oidc_provider_issuer_url ON authsrv_oidc_provider (issuer_url) WHERE trash IS false;
ALTER TABLE ONLY authsrv_oidc_provider ADD CONSTRAINT authsrv_oidc_provider_issuer_url_key UNIQUE (issuer_url);
CREATE UNIQUE index authsrv_oidc_provider_name ON authsrv_oidc_provider (name) WHERE trash IS false;
CREATE INDEX authsrv_oidc_provider_organization_id_4219d6ee ON authsrv_oidc_provider USING btree (organization_id);
+3 -1
View File
@@ -389,7 +389,9 @@ func (s *oidcProvider) Update(ctx context.Context, provider *systemv3.OIDCProvid
}
_, err = dao.Update(ctx, s.db, existingP.Id, entity)
if err != nil {
return &systemv3.OIDCProvider{}, err
_log.Errorf("Unable to create oidc provider: %s", err)
// TODO: catch already existing issuer url and return exact error
return &systemv3.OIDCProvider{}, fmt.Errorf("unable to create oidc provider")
}
rclaims, _ := structpb.NewStruct(entity.RequestedClaims)