Skip to content

Commit f624601

Browse files
Use better design to prefix paths
1 parent da564d9 commit f624601

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

deps/rabbitmq_management/src/rabbit_mgmt_login.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,9 @@ handleAccessToken(Req0, AccessToken, State) ->
122122
end.
123123

124124
redirect_to_home_with_cookie(CookiePath, CookieName, CookieValue, Req=#{scheme := Scheme}, State) ->
125-
FullCookiePath = list_to_binary(rabbit_mgmt_util:get_path_prefix() ++ binary_to_list(CookiePath)),
126125
CookieSettings0 = #{
127126
http_only => true,
128-
path => FullCookiePath,
127+
path => rabbit_mgmt_util:prefixed_path(CookiePath),
129128
max_age => 30,
130129
same_site => strict
131130
},

deps/rabbitmq_management/src/rabbit_mgmt_oauth_bootstrap.erl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ get_auth_mechanism(Req) ->
7676
<<"">>, Req, #{
7777
max_age => 0,
7878
http_only => true,
79-
path => bootstrap_cookie_path(),
79+
path => rabbit_mgmt_util:prefixed_path(?OAUTH2_BOOTSTRAP_PATH),
8080
same_site => strict
8181
}),
8282
Auth
@@ -128,7 +128,7 @@ set_token_auth(AuthSettings, Req0) ->
128128
?OAUTH2_ACCESS_TOKEN, <<"">>, Req0, #{
129129
max_age => 0,
130130
http_only => true,
131-
path => bootstrap_cookie_path(),
131+
path => rabbit_mgmt_util:prefixed_path(?OAUTH2_BOOTSTRAP_PATH),
132132
same_site => strict
133133
}),
134134
["set_token_auth(", rabbit_json:encode(Token), ");"]
@@ -141,10 +141,6 @@ set_token_auth(AuthSettings, Req0) ->
141141
}
142142
end.
143143

144-
bootstrap_cookie_path() ->
145-
list_to_binary(rabbit_mgmt_util:get_path_prefix() ++
146-
binary_to_list(?OAUTH2_BOOTSTRAP_PATH)).
147-
148144
import_dependencies(Dependencies) ->
149145
["import {", string:join(Dependencies, ","), "} from './helper.js';"].
150146

0 commit comments

Comments
 (0)