Support multiple path segments in management path
Updated selenium tests to tests against 2 path segments rather than just one
This commit is contained in:
parent
4f3e5398f6
commit
edabd8816b
|
@ -4,8 +4,9 @@ var _management_logger;
|
||||||
|
|
||||||
function oauth_initialize_if_required() {
|
function oauth_initialize_if_required() {
|
||||||
rabbit_port = window.location.port ? ":" + window.location.port : ""
|
rabbit_port = window.location.port ? ":" + window.location.port : ""
|
||||||
|
rabbit_path_prefix = window.location.pathname.replace(/(\/js\/oidc-oauth\/.*$|\/+$)/, "")
|
||||||
rabbit_base_uri = window.location.protocol + "//" + window.location.hostname
|
rabbit_base_uri = window.location.protocol + "//" + window.location.hostname
|
||||||
+ rabbit_port + rabbit_path_prefix()
|
+ rabbit_port + rabbit_path_prefix
|
||||||
|
|
||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
request.open("GET", rabbit_base_uri + "/api/auth", false);
|
request.open("GET", rabbit_base_uri + "/api/auth", false);
|
||||||
|
@ -17,10 +18,7 @@ function oauth_initialize_if_required() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
function rabbit_path_prefix() {
|
|
||||||
paths = window.location.pathname.split("/")
|
|
||||||
return paths[1] === "js" || paths[1] === "" ? "" : "/" + paths[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
function auth_settings_apply_defaults(authSettings) {
|
function auth_settings_apply_defaults(authSettings) {
|
||||||
if (authSettings.enable_uaa == "true") {
|
if (authSettings.enable_uaa == "true") {
|
||||||
|
@ -144,13 +142,13 @@ function oauth_initiateLogin() {
|
||||||
|
|
||||||
function oauth_redirectToHome(oauth) {
|
function oauth_redirectToHome(oauth) {
|
||||||
set_auth_pref(oauth.user_name + ":" + oauth.access_token);
|
set_auth_pref(oauth.user_name + ":" + oauth.access_token);
|
||||||
location.href = "/"
|
location.href = rabbit_path_prefix + "/"
|
||||||
}
|
}
|
||||||
function oauth_redirectToLogin(error) {
|
function oauth_redirectToLogin(error) {
|
||||||
_management_logger.debug("oauth_redirectToLogin called");
|
_management_logger.debug("oauth_redirectToLogin called");
|
||||||
if (!error) location.href = "/"
|
if (!error) location.href = rabbit_path_prefix + "/"
|
||||||
else {
|
else {
|
||||||
location.href = "/?error=" + error
|
location.href = rabbit_path_prefix + "/?error=" + error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function oauth_completeLogin() {
|
function oauth_completeLogin() {
|
||||||
|
|
|
@ -49,6 +49,24 @@ And this is how we run all suites:
|
||||||
run-suites.sh
|
run-suites.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you want to test your local changes, you can still build an image with these 2 commands from the
|
||||||
|
root folder of the `rabbitmq-server` repo:
|
||||||
|
```
|
||||||
|
cd ../../../../
|
||||||
|
make package-generic-unix
|
||||||
|
make docker-image
|
||||||
|
```
|
||||||
|
|
||||||
|
The last command prints something like this:
|
||||||
|
```
|
||||||
|
=> => naming to docker.io/pivotalrabbitmq/rabbitmq:3.11.0-rc.2.51.g4f3e539.dirty 0.0s
|
||||||
|
```
|
||||||
|
|
||||||
|
To run a suite with a particular docker image we do it like this:
|
||||||
|
```
|
||||||
|
cd deps/rabbitmq_management/selenium/suites
|
||||||
|
RABBITMQ_DOCKER_IMAGE=pivotalrabbitmq/rabbitmq:3.11.0-rc.2.51.g4f3e539.dirty ./oauth-with-uaa-with-mgt-prefix.sh
|
||||||
|
```
|
||||||
|
|
||||||
## Run tests interactively using your local chrome browser
|
## Run tests interactively using your local chrome browser
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@ UAA_CONFIG_PATH=/uaa-with-mgt-prefix
|
||||||
# Name of the rabbitmq config file. It is relative to the TEST_CONFIG_PATH
|
# Name of the rabbitmq config file. It is relative to the TEST_CONFIG_PATH
|
||||||
RABBITMQ_CONFIG_FILENAME=rabbitmq-with-mgt-prefix.config
|
RABBITMQ_CONFIG_FILENAME=rabbitmq-with-mgt-prefix.config
|
||||||
|
|
||||||
|
RABBITMQ_URL=http://rabbitmq:15672/my-prefix/another-prefix/
|
||||||
|
|
||||||
source $SCRIPT/suite_template
|
source $SCRIPT/suite_template
|
||||||
|
|
||||||
_setup () {
|
_setup () {
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
{auth_backends, [rabbit_auth_backend_oauth2]}
|
{auth_backends, [rabbit_auth_backend_oauth2]}
|
||||||
]},
|
]},
|
||||||
{rabbitmq_management, [
|
{rabbitmq_management, [
|
||||||
{login_session_timeout, 1}, %% in minutes
|
{login_session_timeout, 150}, %% in minutes
|
||||||
{enable_uaa, true},
|
{enable_uaa, true},
|
||||||
{oauth_enabled, true},
|
{oauth_enabled, true},
|
||||||
%% {path_prefix, "/my-prefix"},
|
{path_prefix, "/my-prefix/another-prefix"},
|
||||||
{oauth_client_id, "rabbit_client_code"},
|
{oauth_client_id, "rabbit_client_code"},
|
||||||
{oauth_client_secret, "rabbit_client_code"},
|
{oauth_client_secret, "rabbit_client_code"},
|
||||||
{oauth_provider_url, "http://localhost:8080"}
|
{oauth_provider_url, "http://localhost:8080"}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{login_session_timeout, 1}, %% in minutes
|
{login_session_timeout, 1}, %% in minutes
|
||||||
{enable_uaa, true},
|
{enable_uaa, true},
|
||||||
{oauth_enabled, true},
|
{oauth_enabled, true},
|
||||||
{path_prefix, "/my-prefix"},
|
{path_prefix, "/my-prefix/another-prefix"},
|
||||||
{oauth_client_id, "rabbit_client_code"},
|
{oauth_client_id, "rabbit_client_code"},
|
||||||
{oauth_client_secret, "rabbit_client_code"},
|
{oauth_client_secret, "rabbit_client_code"},
|
||||||
{oauth_provider_url, "http://uaa:8080"}
|
{oauth_provider_url, "http://uaa:8080"}
|
||||||
|
|
|
@ -62,7 +62,7 @@ jwt:
|
||||||
token:
|
token:
|
||||||
policy:
|
policy:
|
||||||
# Will override global validity policies for the default zone only.
|
# Will override global validity policies for the default zone only.
|
||||||
accessTokenValiditySeconds: 15
|
accessTokenValiditySeconds: 1500
|
||||||
keys:
|
keys:
|
||||||
legacy-token-key:
|
legacy-token-key:
|
||||||
signingKey: |
|
signingKey: |
|
||||||
|
@ -131,8 +131,8 @@ oauth:
|
||||||
authorized-grant-types: authorization_code
|
authorized-grant-types: authorization_code
|
||||||
scope: rabbitmq.*,openid,profile
|
scope: rabbitmq.*,openid,profile
|
||||||
authorities: uaa.resource,rabbitmq
|
authorities: uaa.resource,rabbitmq
|
||||||
redirect-uri: http://localhost:15672
|
#redirect-uri: http://localhost:15672
|
||||||
# redirect-uri: http://localhost:15672/my-prefix/
|
redirect-uri: http://localhost:15672/my-prefix/another-prefix/
|
||||||
autoapprove: true
|
autoapprove: true
|
||||||
|
|
||||||
mgt_api_client_2:
|
mgt_api_client_2:
|
||||||
|
|
|
@ -131,7 +131,7 @@ oauth:
|
||||||
authorized-grant-types: authorization_code
|
authorized-grant-types: authorization_code
|
||||||
scope: rabbitmq.*,openid,profile
|
scope: rabbitmq.*,openid,profile
|
||||||
authorities: uaa.resource,rabbitmq
|
authorities: uaa.resource,rabbitmq
|
||||||
redirect-uri: http://rabbitmq:15672/my-prefix/
|
redirect-uri: http://rabbitmq:15672/my-prefix/another-prefix/
|
||||||
autoapprove: true
|
autoapprove: true
|
||||||
|
|
||||||
mgt_api_client_2:
|
mgt_api_client_2:
|
||||||
|
|
Loading…
Reference in New Issue