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

67 update poll transaction function #68

Merged
merged 9 commits into from
Nov 26, 2024

Conversation

lukasmatusiewicz
Copy link
Contributor

This pull request introduces a new enumeration ChallengeStatus to manage the poll transaction challenge status in the privacyIDEA project. The changes include updates across multiple files to integrate this new enum and modify the related logic accordingly.

Key changes include:

New Enumeration

Integration of ChallengeStatus

Test Updates

@lukasmatusiewicz lukasmatusiewicz linked an issue Nov 26, 2024 that may be closed by this pull request
{
Objects.requireNonNull(transactionID, "TransactionID is required!");

Map<String, String> params = new LinkedHashMap<>();
params.put(TRANSACTION_ID, transactionID);
String response = runRequestAsync(ENDPOINT_POLLTRANSACTION, params, Collections.emptyMap(), false, GET);
PIResponse piresponse = this.parser.parsePIResponse(response);
return piresponse.value;
if (piresponse.challengeStatus == ChallengeStatus.pending)
Copy link
Member

Choose a reason for hiding this comment

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

piresponse.challengestatus is of type challengestatus so why not just return that instead of all these if else

Copy link
Contributor Author

Choose a reason for hiding this comment

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

" \"versionnumber\": \"3.2.1\",\n" +
" \"signature\": \"rsa_sha256_pss:\"\n" + "}")
.withBody("{\n\" id\": 1,\n\" jsonrpc\": \"2.0\",\n" + challengeStatusParameter +
" \"result\": {\n \"status\": true\n },\n \"time\": 1589446811.1909237,\n \"version\": \"privacyIDEA 3.2.1\",\n" +
Copy link
Member

Choose a reason for hiding this comment

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

remove excess whitespaces

Copy link
Contributor Author

Choose a reason for hiding this comment

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

String challengeStatusParameter = "";
if (challengeStatus == ChallengeStatus.accept)
{
challengeStatusParameter = " \"detail\": {\n \"challenge_status\": \"accept\"\n },\n";
Copy link
Member

Choose a reason for hiding this comment

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

remove excess whitespaces

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nilsbehlen nilsbehlen self-requested a review November 26, 2024 12:08
@@ -174,6 +174,15 @@ else if ("interactive".equals(modeFromResponse))
response.type = getString(detail, TYPE);
response.otpLength = getInt(detail, OTPLEN);

String r = getString(detail, CHALLENGE_STATUS);
for (ChallengeStatus en : ChallengeStatus.values())
Copy link
Member

Choose a reason for hiding this comment

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

why call it en? could just be cs. also formatting, no whitespace after en

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lukasmatusiewicz lukasmatusiewicz merged commit 28488a5 into master Nov 26, 2024
1 check passed
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.

Update poll transaction function
2 participants