Merge pull request #11689 from JimMoen/0926-fix-sso-redirect-header
fix: lower sso saml redirect http header
This commit is contained in:
commit
1f8985d09e
2
Makefile
2
Makefile
|
@ -16,7 +16,7 @@ endif
|
||||||
# Dashboard version
|
# Dashboard version
|
||||||
# from https://github.com/emqx/emqx-dashboard5
|
# from https://github.com/emqx/emqx-dashboard5
|
||||||
export EMQX_DASHBOARD_VERSION ?= v1.4.1
|
export EMQX_DASHBOARD_VERSION ?= v1.4.1
|
||||||
export EMQX_EE_DASHBOARD_VERSION ?= e1.2.1
|
export EMQX_EE_DASHBOARD_VERSION ?= e1.3.0-beta.6
|
||||||
|
|
||||||
# `:=` should be used here, otherwise the `$(shell ...)` will be executed every time when the variable is used
|
# `:=` should be used here, otherwise the `$(shell ...)` will be executed every time when the variable is used
|
||||||
# In make 4.4+, for backward-compatibility the value from the original environment is used.
|
# In make 4.4+, for backward-compatibility the value from the original environment is used.
|
||||||
|
|
|
@ -29,7 +29,11 @@
|
||||||
|
|
||||||
-dialyzer({nowarn_function, do_create/1}).
|
-dialyzer({nowarn_function, do_create/1}).
|
||||||
|
|
||||||
-define(RESPHEADERS, #{<<"Cache-Control">> => <<"no-cache">>, <<"Pragma">> => <<"no-cache">>}).
|
-define(RESPHEADERS, #{
|
||||||
|
<<"cache-control">> => <<"no-cache">>,
|
||||||
|
<<"pragma">> => <<"no-cache">>,
|
||||||
|
<<"content-type">> => <<"text/plain">>
|
||||||
|
}).
|
||||||
-define(REDIRECT_BODY, <<"Redirecting...">>).
|
-define(REDIRECT_BODY, <<"Redirecting...">>).
|
||||||
|
|
||||||
-define(DIR, <<"saml_sp_certs">>).
|
-define(DIR, <<"saml_sp_certs">>).
|
||||||
|
@ -129,7 +133,7 @@ login(
|
||||||
Html = esaml_binding:encode_http_post(IDP, SignedXml, <<>>),
|
Html = esaml_binding:encode_http_post(IDP, SignedXml, <<>>),
|
||||||
{200, ?RESPHEADERS, Html};
|
{200, ?RESPHEADERS, Html};
|
||||||
false ->
|
false ->
|
||||||
{302, ?RESPHEADERS#{<<"Location">> => Target}, ?REDIRECT_BODY}
|
{302, ?RESPHEADERS#{<<"location">> => Target}, ?REDIRECT_BODY}
|
||||||
end,
|
end,
|
||||||
{redirect, Redirect}.
|
{redirect, Redirect}.
|
||||||
|
|
||||||
|
@ -209,7 +213,7 @@ gen_redirect_response(DashboardAddr, Username) ->
|
||||||
case ensure_user_exists(Username) of
|
case ensure_user_exists(Username) of
|
||||||
{ok, Role, Token} ->
|
{ok, Role, Token} ->
|
||||||
Target = login_redirect_target(DashboardAddr, Username, Role, Token),
|
Target = login_redirect_target(DashboardAddr, Username, Role, Token),
|
||||||
{redirect, {302, ?RESPHEADERS#{<<"Location">> => Target}, ?REDIRECT_BODY}};
|
{redirect, {302, ?RESPHEADERS#{<<"location">> => Target}, ?REDIRECT_BODY}};
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
{error, Reason}
|
{error, Reason}
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Reference in New Issue