Skip to content

Commit

Permalink
fix(sql): fixing persister_grant_jwk having an OR statement without b…
Browse files Browse the repository at this point in the history
…racket leading to not using the last part of the query
  • Loading branch information
StarAurryon committed Apr 21, 2023
1 parent ca85a17 commit 40c0725
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions persistence/sql/persister_grant_jwk.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (p *Persister) GetPublicKey(ctx context.Context, issuer string, subject str
var data trust.SQLData
query := p.QueryWithNetwork(ctx).
Where("issuer = ?", issuer).
Where("subject = ? OR allow_any_subject IS TRUE", subject).
Where("(subject = ? OR allow_any_subject IS TRUE)", subject).
Where("key_id = ?", keyId).
Where("nid = ?", p.NetworkID(ctx))
if err := query.First(&data); err != nil {
Expand All @@ -135,7 +135,7 @@ func (p *Persister) GetPublicKeys(ctx context.Context, issuer string, subject st
grantsData := make([]trust.SQLData, 0)
query := p.QueryWithNetwork(ctx).
Where("issuer = ?", issuer).
Where("subject = ? OR allow_any_subject IS TRUE", subject).
Where("(subject = ? OR allow_any_subject IS TRUE)", subject).
Where("nid = ?", p.NetworkID(ctx))

if err := query.All(&grantsData); err != nil {
Expand Down Expand Up @@ -170,7 +170,7 @@ func (p *Persister) GetPublicKeyScopes(ctx context.Context, issuer string, subje
var data trust.SQLData
query := p.QueryWithNetwork(ctx).
Where("issuer = ?", issuer).
Where("subject = ? OR allow_any_subject IS TRUE", subject).
Where("(subject = ? OR allow_any_subject IS TRUE)", subject).
Where("key_id = ?", keyId).
Where("nid = ?", p.NetworkID(ctx))

Expand Down

0 comments on commit 40c0725

Please sign in to comment.