Skip to content

Commit 9892338

Browse files
Fix issue with cookie path for oauth2 flows
1 parent b288d41 commit 9892338

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

deps/rabbitmq_management/src/rabbit_mgmt_login.erl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,11 @@ handleAccessToken(Req0, AccessToken, State) ->
120120
replyWithError(Reason, ReqData1, State)
121121
end.
122122

123-
redirect_to_home_with_cookie(CookieName, CookieValue, Req=#{scheme := Scheme}, State) ->
123+
redirect_to_home_with_cookie(CookiePath, CookieName, CookieValue, Req=#{scheme := Scheme}, State) ->
124+
FullCookiePath = iolist_to_binary([rabbit_mgmt_util:get_path_prefix(), CookiePath]),
124125
CookieSettings0 = #{
125126
http_only => true,
126-
path => rabbit_mgmt_util:get_oauth2_bootstrap_cookie_path(),
127+
path => FullCookiePath,
127128
max_age => 30,
128129
same_site => strict
129130
},

deps/rabbitmq_management/src/rabbit_mgmt_oauth_bootstrap.erl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ get_auth_mechanism(Req) ->
7676
<<"">>, Req, #{
7777
max_age => 0,
7878
http_only => true,
79-
path => rabbit_mgmt_util:get_oauth2_bootstrap_cookie_path(),
79+
path => iolist_to_binary([rabbit_mgmt_util:get_path_prefix(),
80+
?OAUTH2_BOOTSTRAP_PATH]),
8081
same_site => strict
8182
}),
8283
Auth
@@ -128,7 +129,12 @@ set_token_auth(AuthSettings, Req0) ->
128129
?OAUTH2_ACCESS_TOKEN, <<"">>, Req0, #{
129130
max_age => 0,
130131
http_only => true,
132+
<<<<<<< HEAD
131133
path => rabbit_mgmt_util:get_oauth2_bootstrap_cookie_path(),
134+
=======
135+
path => iolist_to_binary([rabbit_mgmt_util:get_path_prefix(),
136+
?OAUTH2_BOOTSTRAP_PATH]),
137+
>>>>>>> 053498c79b (Fix issue with cookie path for oauth2 flows)
132138
same_site => strict
133139
}),
134140
["set_token_auth(", rabbit_json:encode(Token), ");"]

0 commit comments

Comments
 (0)