-
Notifications
You must be signed in to change notification settings - Fork 368
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
Fix the issue https://github.com/wso2/product-is/issues/21192 #2587
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2587 +/- ##
=============================================
+ Coverage 41.99% 53.88% +11.89%
- Complexity 6005 8504 +2499
=============================================
Files 601 632 +31
Lines 44553 50603 +6050
Branches 7010 8533 +1523
=============================================
+ Hits 18710 27268 +8558
+ Misses 22382 19222 -3160
- Partials 3461 4113 +652
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -53,6 +54,8 @@ | |||
import java.util.TimeZone; | |||
import java.util.UUID; | |||
|
|||
import static org.wso2.carbon.identity.oauth2.device.constants.Constants.SLOW_DOWN; |
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.
We already imported
org.wso2.carbon.identity.oauth2.device.constants.Constants
in line 36.
We don't need to import this static constant, we can directly use
Constants.SLOW_DOWN
...entity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/device/grant/DeviceFlowGrant.java
Outdated
Show resolved
Hide resolved
...entity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/device/grant/DeviceFlowGrant.java
Outdated
Show resolved
Hide resolved
deviceFlowDO.setDeviceCode(deviceCode); | ||
setLastPollTime(deviceCode); | ||
} catch (IdentityOAuth2Exception e) { | ||
deviceStatus = e.getMessage(); |
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.
we don't need this line right?
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.
As we need to pass it here, https://github.com/wso2-extensions/identity-inbound-auth-oauth/pull/2587/files#diff-04c8d9d96bce4315cd10faf6cee77e67804ef26f765ac63eda3f36ab5767b945R80 we need to specify here.
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 catch block don't get execute after line 76, cause handleInvalidRequests
method throws identityOAuthException anyway.
...entity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/device/grant/DeviceFlowGrant.java
Outdated
Show resolved
Hide resolved
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.
can improve the code with said comments, LGTM. Let's run integration tests for safe side.
6e6e436
to
eac5a95
Compare
This PR contains a basic set of unit tests to cover the flow I added. However, this flow requires comprehensive unit tests to cover the whole flow. I will work on improving those. |
@@ -47,14 +61,19 @@ public class DeviceFlowGrantTest { | |||
private Timestamp newTime = new Timestamp(date.getTime()); | |||
private DeviceFlowDO deviceFlowDO1 = new DeviceFlowDO(); | |||
private DeviceFlowDO deviceFlowDO2 = new DeviceFlowDO(); | |||
private DeviceFlowGrant deviceFlowGrant; | |||
private OAuthTokenReqMessageContext oAuthTokenReqMessageContext; | |||
private DeviceFlowDO deviceFlowDO3; |
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.
cant we move near to other DOs
Proposed changes in this pull request
Fix Inconsistent Error Responses in Device Flow
When should this PR be merged
Immediately
Follow-up actions
Checklist (for reviewing)
General
Functionality
Code
Tests
Security
Documentation