Skip to content

Commit 05caac3

Browse files
committed
nixos/keycloak: fixup login test after ui change
1 parent 0cdc3e2 commit 05caac3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

nixos/tests/keycloak.nix

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ let
4848
];
4949
};
5050
environment.systemPackages = with pkgs; [
51-
xmlstarlet
52-
html-tidy
51+
htmlq
5352
jq
5453
];
5554
};
@@ -151,16 +150,14 @@ let
151150
# post url.
152151
keycloak.succeed(
153152
"curl -sSf -c cookie '${frontendUrl}/realms/${realm.realm}/protocol/openid-connect/auth?client_id=${client.name}&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=openid+email&response_type=code&response_mode=query&nonce=qw4o89g3qqm' >login_form",
154-
"tidy -asxml -q -m login_form || true",
155-
"xml sel -T -t -m \"_:html/_:body/_:div/_:div/_:div/_:div/_:div/_:div/_:form[@id='kc-form-login']\" -v @action login_form >form_post_url",
153+
"htmlq '#kc-form-login' --attribute action --filename login_form --output form_post_url"
156154
)
157155
158156
# Post the login form and save the response. Once again tidy up
159157
# the HTML, then extract the authorization code.
160158
keycloak.succeed(
161159
"curl -sSf -L -b cookie -d 'username=${user.username}' -d 'password=${password}' -d 'credentialId=' \"$(<form_post_url)\" >auth_code_html",
162-
"tidy -asxml -q -m auth_code_html || true",
163-
"xml sel -T -t -m \"_:html/_:body/_:div/_:div/_:div/_:div/_:div/_:input[@id='code']\" -v @value auth_code_html >auth_code",
160+
"htmlq '#code' --attribute value --filename auth_code_html --output auth_code"
164161
)
165162
166163
# Exchange the authorization code for an access token.

0 commit comments

Comments
 (0)