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

adding changes for the grant type client credentials mechanism #1

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

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.

@@ -941,6 +960,13 @@ PAGINATION_INDEX_PLACEHOLDER, getPaginationType()),
}
}

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.

@@ -961,8 +965,10 @@ PAGINATION_INDEX_PLACEHOLDER, getPaginationType()),
}

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.

3 participants