Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test for pki ca-user-show #4870

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion .github/workflows/ca-basic-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -431,13 +431,52 @@ jobs:

diff expected output

- name: Test CA admin
- name: Check pki ca-user-show with default API
run: |
docker exec pki pki pkcs12-import \
--pkcs12 /root/.dogtag/pki-tomcat/ca_admin_cert.p12 \
--pkcs12-password Secret.123

docker exec pki pki -n caadmin ca-user-show caadmin

# check HTTP methods, paths, protocols, status, and authenticated users
docker exec pki find /var/log/pki/pki-tomcat \
-name "localhost_access_log.*" \
-exec cat {} \; \
| tail -4 \
| sed -e 's/^.* .* \(.*\) \[.*\] "\(.*\)" \(.*\) .*$/\2 \3 \1/' \
| tee output

cat > expected << EOF
GET /pki/v1/info HTTP/1.1 200 -
GET /ca/v1/account/login HTTP/1.1 200 caadmin
GET /ca/v1/admin/users/caadmin HTTP/1.1 200 caadmin
GET /ca/v1/account/logout HTTP/1.1 204 caadmin
EOF

diff expected output

- name: Check pki ca-user-show with API v2
run: |
docker exec pki pki -n caadmin --api v2 ca-user-show caadmin

# check HTTP methods, paths, protocols, status, and authenticated users
docker exec pki find /var/log/pki/pki-tomcat \
-name "localhost_access_log.*" \
-exec cat {} \; \
| tail -4 \
| sed -e 's/^.* .* \(.*\) \[.*\] "\(.*\)" \(.*\) .*$/\2 \3 \1/' \
| tee output

cat > expected << EOF
GET /pki/v2/info HTTP/1.1 200 -
GET /ca/v2/account/login HTTP/1.1 200 caadmin
GET /ca/v2/admin/users/caadmin HTTP/1.1 200 caadmin
GET /ca/v2/account/logout HTTP/1.1 204 caadmin
EOF

diff expected output

- name: Check cert requests in CA
run: |
docker exec pki pki -n caadmin ca-cert-request-find
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class AccountClient extends Client {
public boolean loggedIn;

public AccountClient(PKIClient client, String subsystem) throws Exception {
super(client, subsystem, null, "account");
super(client, subsystem, "account");
}

public AccountClient(PKIClient client, String subsystem, String prefix) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public SubsystemClient(PKIClient client, String name) throws Exception {
// subsystem name should match the client name
super(client, name, name);

accountClient = new AccountClient(client, name, "rest");
accountClient = new AccountClient(client, name);
addClient(accountClient);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ public void logout(HttpServletRequest request, HttpServletResponse response) thr
logger.info("AccountServlet: Destroying session {}", session.getId());
session.invalidate();
}
response.sendError(HttpServletResponse.SC_NO_CONTENT);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void execute(String[] args) throws Exception {
if (subsystem == null) subsystem = defaultSubsystem;

PKIClient client = module.getClient();
accountClient = new AccountClient(client, subsystem, "rest");
accountClient = new AccountClient(client, subsystem);
accountClient.login();
}

Expand Down
Loading