Skip to content

Commit 69366d7

Browse files
authored
SMQ-3171 - Add domain ID to channel authorization request (#3179)
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
1 parent fa8862c commit 69366d7

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

channels/postgres/channels.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ func (cr *channelRepository) CheckConnection(ctx context.Context, conn channels.
10101010
}
10111011

10121012
func (cr *channelRepository) ClientAuthorize(ctx context.Context, conn channels.Connection) error {
1013-
query := `SELECT 1 FROM connections WHERE channel_id = :channel_id AND client_id = :client_id AND type = :type LIMIT 1`
1013+
query := `SELECT 1 FROM connections WHERE channel_id = :channel_id AND client_id = :client_id AND domain_id = :domain_id AND type = :type LIMIT 1`
10141014
dbConn := toDBConnection(conn)
10151015
rows, err := cr.db.NamedQueryContext(ctx, query, dbConn)
10161016
if err != nil {

channels/private/service.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ func (svc service) Authorize(ctx context.Context, req channels.AuthzReq) error {
6767
case policies.ClientType:
6868
// Optimization: Add cache
6969
if err := svc.repo.ClientAuthorize(ctx, channels.Connection{
70+
DomainID: req.DomainID,
7071
ChannelID: req.ChannelID,
7172
ClientID: req.ClientID,
7273
Type: req.Type,

0 commit comments

Comments
 (0)