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

Add TPS TPSCertService to v2 APIs #4827

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

fmarco76
Copy link
Member

@edewata The current implementation requires to specify the filter (see here). In the wiki page for the CLI this is not needed. If I try the same command with the current implementation I get

root@pki pki]# pki -n caadmin tps-cert-find
BadRequestException: Filter is too short. Must be at least 3 characters.
[root@pki pki]# 

Additionally, the check on the filter is different to all the other cases.
For the v2 I have modified the filter to make it not mandatory and works like in the wiki page. Is this OK?

@fmarco76 fmarco76 requested a review from edewata August 19, 2024 14:03
@fmarco76 fmarco76 force-pushed the TPSCertService_v2 branch 3 times, most recently from cb48bdc to f00e48f Compare August 19, 2024 18:32
Copy link
Contributor

@edewata edewata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments, the rest looks fine.

Comment on lines 79 to 84
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
<version>9.0.62</version>
</dependency>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the common library (which is used by the client) should not depend on Servlet API. I'm not sure which code requires Servlet API, but it probably should be moved into the server library.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think the problem is with the error codes I have introduced in a previous PR. I'll remove this change and handle it in a separate PR.

Comment on lines 48 to 59
if (filter != null && filter.length() < PKIServlet.MIN_FILTER_LENGTH) {
throw new BadRequestException("Filter is too short. Must be at least " + PKIServlet.MIN_FILTER_LENGTH + " characters.");
}

if(tokenID == null) {
return findAllCerts(authorizedProfiles, filter, start, size);
}

Map<String, String> attributes = new HashMap<>();
if (tokenID != null) {
attributes.put("tokenID", tokenID);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC the problem is that the Certs page in TPS Web UI will pull all cert records in order to count the total number of entries so the UI can display the paging links such as Page 1, Page 2, ... Page N. If there are a lot of certs, this page will take a long time to open since by default there's no filter to narrow down the search, so that's why the minimum filter length was added, or if the token ID is available it can also be used to narrow down the search.

I think ideally we should change the UI to no longer require knowing the total entries, so the paging link we need to provide is just Next Page as long as there are more certs to display, then we don't have to require a minimum filter anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I have update the code to match current implementation and added a TODO to fix this behaviour when the UI will be fixed

Copy link

sonarcloud bot commented Aug 20, 2024

Copy link
Contributor

@edewata edewata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update! LGTM.

@fmarco76
Copy link
Member Author

@edewata Thanks!

@fmarco76 fmarco76 merged commit eb2456a into dogtagpki:master Aug 21, 2024
139 of 156 checks passed
@fmarco76 fmarco76 deleted the TPSCertService_v2 branch August 21, 2024 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants