Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,16 @@ public class StandardOauth2AccessTokenProvider extends AbstractControllerService
public static final PropertyDescriptor CLIENT_ID = new PropertyDescriptor.Builder()
.name("client-id")
.displayName("Client ID")
.required(false)
.dependsOn(GRANT_TYPE, CLIENT_CREDENTIALS_GRANT_TYPE)
Copy link
Contributor

@tpalfy tpalfy Feb 2, 2022

Choose a reason for hiding this comment

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

This is incorrect. Resource Owner Password Credentials Grant also may require these parameters.

.required(true)
.addValidator(StandardValidators.NON_BLANK_VALIDATOR)
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
.build();

public static final PropertyDescriptor CLIENT_SECRET = new PropertyDescriptor.Builder()
.name("client-secret")
.displayName("Client secret")
.dependsOn(CLIENT_ID)
.dependsOn(GRANT_TYPE, CLIENT_CREDENTIALS_GRANT_TYPE)
Copy link
Contributor

@tpalfy tpalfy Feb 2, 2022

Choose a reason for hiding this comment

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

This is incorrect. Resource Owner Password Credentials Grant also may require these parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think what I was seeing was a UX issue with dependsOn in this case. The client secret was not showing, and that was kinda confusing to me. So I'm going to play around with this and add some custom validation where appropriate to make it cleaner.

.required(true)
.sensitive(true)
.addValidator(StandardValidators.NON_BLANK_VALIDATOR)
Expand Down