Question/Chore: unused code in `DefaultClientBuilder#build` method (`ClientCredentialsResolver`)
:information_source: If you have a question, please post it on the Okta Developer Forum instead. Issues in this repository are reserved for bug reports and feature requests only.
I did originally post this on the dev forum, but they directed me here. See this post.
I'm submitting a
Question/comment about what I believe is a piece of unused code in the SDK
Background info
I believe I have found a unused/unnecessary bit of code in the okta-java-sdk and would like to bring it your attention.
In the DefaultClientBuilder#build method, if you are configuring the client for OAuth2 with privateKey, the following logic gets hit (see here in Github -> okta/okta-sdk-java -> impl/src/main/java/com/okta/sdk/impl/client/DefaultClientBuilder.java#L378):
this.clientConfig.setClientCredentialsResolver(new DefaultClientCredentialsResolver(oAuth2ClientCredentials));
but it doesn't actually do anything from what I can tell. The getCredentialsResolver method seems to never be called subsequently...meaning this is unused and unnecessary.
From what I can tell, this is just a leftover artifact from a previous version of the code where an underlying base class required the ClientCredentialsResolver to be not null.
See here where this code was first added, and this line was discussed: https://github.com/okta/okta-sdk-java/pull/354#discussion_r413996240. You can see that the BaseClient being discussed requires a DefaultDataStore, and then DefaultDataStore requires the passed in clientCredentialsResolver to be non-null.
The mentioned classes making this required were then removed/refactored in #776 ; I believe this PR should have also removed the line I'm questioning.
Expected behavior
The SDK interface (particularly the ClientBuilder) wouldn't have this red herring which can lead to lost time tracing code that ultimately leads nowhere.
What went wrong?
N/A
Steps to reproduce
N/A
SDK Version
com.okta.sdk:okta-sdk-api:19.0.1
com.okta.sdk:okta-sdk-impl:19.0.1
com.okta.spring:okta-spring-sdk:3.0.7
Thanks for posting!
I'll take a look. We welcome pull requests, if you'd like to contribute.