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

Feature/dynamic credential #274

Closed

Conversation

calebcodesgud
Copy link

Added this pull request implementing @Michael-A-McMahon 's suggested changes for #273 .

Only difference vs original suggestions on #273 is using a class for UserPasswordCredentialImpl rather than a record, so as not to tie the project to java 14.

Still need to add tests for this, was having trouble getting r2dbc-spi-test module running in my local env...

lukaseder and others added 2 commits September 7, 2022 11:45
There seems to be a copy paste artifact that seems unnecessary

Signed-off-by: calebcodesgud <calwoy1@gmail.com>
Signed-off-by: Caleb Woy calwoy1@gmail.com

[resolves r2dbc#273]

Signed-off-by: calebcodesgud <calwoy1@gmail.com>
@calebcodesgud calebcodesgud force-pushed the feature/dynamicCredential branch from df1bc15 to de9c40a Compare September 7, 2022 15:48

/** Factory for creating {@link Credential} objects */
public class CredentialFactory {

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest adding a private constructor that does nothing:

private CredentialFactory() { }

Typically, we don't want to instantiate factories, as their methods are all static.

You may want to declare the class itself as final. This indicates that the class is not designed for inheritance.

Copy link
Author

Choose a reason for hiding this comment

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

agreed, resolved with commit 9ce228d

* UserPasswordCredentials used to authenticate with a database.
*/
public interface UserPasswordCredential extends Credential {
String user();
Copy link
Contributor

Choose a reason for hiding this comment

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

Even though it's kind of obvious what the method does, every public API should have a JavaDoc IMHO. The JavaDoc offers a concrete specification of the method's behavior, and specifications are super important for SPIs.

Copy link
Author

Choose a reason for hiding this comment

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

Agreed, resolved with commit 2b09f64

@@ -0,0 +1,23 @@
package io.r2dbc.spi;

public class UserPasswordCredentialImpl implements UserPasswordCredential {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this class can be a package-private (ie: no "public" modifier). Code that is external to the package should use the factory method.

Copy link
Author

Choose a reason for hiding this comment

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

Agreed, resolved with commit 2b09f64

…s final.

[resolves r2dbc#273]

Signed-off-by: calebcodesgud <calwoy1@gmail.com>
…alImpl package-private.

[resolves r2dbc#273]

Signed-off-by: calebcodesgud <calwoy1@gmail.com>
@calebcodesgud
Copy link
Author

@Michael-A-McMahon @mp911de Do we need anything else on this to consider merging?

@Michael-A-McMahon
Copy link
Contributor

@calebcodesgud Thanks for addressing my review comments. I think it all looks good now. Sorry for not responding sooner.

@mp911de
Copy link
Member

mp911de commented Jan 26, 2023

I have this one on my radar for a merge. We currently have no immediate plans for a future release. We're collecting issues and a release could happen in 2-3 years.

@calebcodesgud
Copy link
Author

Closing this, as it was solve by @Michael-A-McMahon in 137.
Thank you!!

@calebcodesgud calebcodesgud deleted the feature/dynamicCredential branch November 3, 2023 21:36
@Michael-A-McMahon
Copy link
Contributor

Michael-A-McMahon commented Nov 7, 2023

Just to be sure: My fix is only for the Oracle driver.

But I'll note that my fix hardly does anything which is specific to Oracle Database, although it does reference things which only exist in the Oracle R2DBC code base.

Other drivers could maybe add code which is similar to this:
https://github.com/oracle/oracle-r2dbc/blob/main/src/main/java/oracle/r2dbc/impl/SuppliedOptionConnectionFactory.java

(Edit: Clarifying that there are Oracle R2DBC specific things in this implementation)

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