-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
{ | ||
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove excess whitespaces
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove excess whitespaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -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()) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request introduces a new enumeration
ChallengeStatus
to manage the poll transaction challenge status in theprivacyIDEA
project. The changes include updates across multiple files to integrate this new enum and modify the related logic accordingly.Key changes include:
New Enumeration
src/main/java/org/privacyidea/ChallengeStatus.java
: Added a new enumChallengeStatus
with possible values:accept
,declined
,pending
, andnone
.Integration of
ChallengeStatus
src/main/java/org/privacyidea/JSONParser.java
: Updated the parsing logic to setresponse.challengeStatus
based on the newChallengeStatus
enum.src/main/java/org/privacyidea/PIConstants.java
: Added a new constantCHALLENGE_STATUS
to be used as a key for challenge status in JSON responses.src/main/java/org/privacyidea/PIResponse.java
: Added a new fieldchallengeStatus
of typeChallengeStatus
initialized toChallengeStatus.none
.src/main/java/org/privacyidea/PrivacyIDEA.java
: Modified thepollTransaction
method to return aChallengeStatus
instead of a boolean, reflecting the new challenge status values.Test Updates
src/test/java/org/privacyidea/TestPollTransaction.java
: Updated test cases to handle the newChallengeStatus
values and modified thesetPollTransactionResponse
method to useChallengeStatus
instead of boolean values. [1] [2]