diff options
-rw-r--r-- | src/rabbit_channel.erl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index b9b39ac3..74f9cacf 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -504,10 +504,14 @@ check_user_id_header( #'P_basic'{}, #ch{user = #user{auth_backend = rabbit_auth_backend_dummy}}) -> ok; check_user_id_header(#'P_basic'{user_id = Claimed}, - #ch{user = #user{username = Actual}}) -> - precondition_failed( - "user_id property set to '~s' but authenticated user was '~s'", - [Claimed, Actual]). + #ch{user = #user{username = Actual, + tags = Tags}}) -> + case lists:member(impersonator, Tags) of + true -> ok; + false -> precondition_failed( + "user_id property set to '~s' but authenticated user was " + "'~s'", [Claimed, Actual]) + end. check_expiration_header(Props) -> case rabbit_basic:parse_expiration(Props) of |