Skip to content

Conversation

@prince-cs
Copy link
Owner

Added the grant type selection dropdown to select the OAuth grant type mechanism and based on that calling the function to generate the access token.

}

private boolean refreshTokenGrantType() {
if (getGrantType() == "refresh_token") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

create an enum for grant types and change the above code also accordingly. and write grant type specific if conditions. e.g.(if grant == enum.refreshtoken) else if grant=client_credentials

Copy link
Owner Author

Choose a reason for hiding this comment

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

Enum for grant type created and made changes to the conditions accordingly.

throws IOException {
URI uri;
try {
uri = new URIBuilder(tokenUrl).setParameter("grant_type", grantType).build();
Copy link
Collaborator

Choose a reason for hiding this comment

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

define constants where ever any keyword getting used multiple times or has scope of getting used in future

Copy link
Owner Author

Choose a reason for hiding this comment

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

Constants are defined for both client credentials method and refresh token method.

"name": "tokenUrl",
"type": "property"
"widget-type": "textbox",
"label": "Token URL",
Copy link
Collaborator

Choose a reason for hiding this comment

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

label is not required here.

Copy link
Owner Author

Choose a reason for hiding this comment

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

removed the labels attribute according to the filters conditions.

}
}

private boolean refreshTokenGrantType() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we need this method, I can directly check for the condition where ever we are using this. In case we will add multiple grant types in future, it will create issues

Copy link
Owner Author

Choose a reason for hiding this comment

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

checking the condition directly now.

@@ -0,0 +1,59 @@
/*
* Copyright © 2022 Cask Data, Inc.
Copy link
Collaborator

Choose a reason for hiding this comment

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

2023

Copy link
Owner Author

Choose a reason for hiding this comment

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

made the year to 2023

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.

4 participants