Skip to content

Conversation

@Amit-CloudSufi
Copy link
Contributor

@Amit-CloudSufi Amit-CloudSufi commented Feb 25, 2025

https://cdap.atlassian.net/browse/PLUGIN-1872

Update UI:

1. Grant Type: Refresh Token
image
image

2. Grant Type: Client Credentials and Client Authentication: Body
image
image

3. Grant Type: Client Credentials and Client Authentication: Request parameter
image
image

Older UI vs When pipeline upgraded to latest build

  1. Older Pipeline:
    image

  2. Older pipeline upgraded to latest UI:
    image
    image

Copy link
Contributor

@itsankit-google itsankit-google left a comment

Choose a reason for hiding this comment

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

How does UI looks like for existing pipelines?

I think we should handle the case where oauth2GrantType is null for older pipelines.

Copy link
Contributor

@itsankit-google itsankit-google left a comment

Choose a reason for hiding this comment

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

please add unit tests

Add screenshots & test evidences in PR description.

@itsankit-google
Copy link
Contributor

please create a JIRA and add it to PR title

@Amit-CloudSufi Amit-CloudSufi changed the title Added GrantType and Client Authentication for the HttpOauth2 [PLUGIN-1872] Added GrantType and Client Authentication for the HttpOauth2 Mar 6, 2025
Copy link
Contributor

@itsankit-google itsankit-google left a comment

Choose a reason for hiding this comment

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

May I know the reference documentation used to implement this authentication flow?

AFAIK, in client_credentials flow there is only one request to get access token from oauth server:

Request

curl -X POST "https://auth.example.com/oauth/token" \
     -H "Content-Type: application/x-www-form-urlencoded" \
     -d "grant_type=client_credentials" \
     -d "client_id=your-client-id" \
     -d "client_secret=your-client-secret" \
     -d "scope=read:data"

Response

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600
}

I am unable to understand & find oauth2ClientAuthentication method used in this PR.

@vikasrathee-cs
Copy link
Contributor

May I know the reference documentation used to implement this authentication flow?

AFAIK, in client_credentials flow there is only one request to get access token from oauth server:

Request

curl -X POST "https://auth.example.com/oauth/token" \
     -H "Content-Type: application/x-www-form-urlencoded" \
     -d "grant_type=client_credentials" \
     -d "client_id=your-client-id" \
     -d "client_secret=your-client-secret" \
     -d "scope=read:data"

Response

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600
}

I am unable to understand & find oauth2ClientAuthentication method used in this PR.

Hi Ankit, It was addressed in Design doc also for one of your comment. Also we got this from customer side, that in some cases they are passing details in query params and in some cases as part of the body. Postman interface also has both the options.

Copy link
Contributor

@itsankit-google itsankit-google left a comment

Choose a reason for hiding this comment

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

At some places we are using OAuth2 and in some places we are using OAuth interchangeably. Please ensure we either use OAuth2 or OAuth so that it does not confuse people looking at the code.

Copy link
Contributor

@itsankit-google itsankit-google left a comment

Choose a reason for hiding this comment

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

please fix build failures.

@Amit-CloudSufi
Copy link
Contributor Author

please fix build failures.

Success. It failed sometime, due to connection timeout..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants