Skip to content

JdbcOAuth2AuthorizedClientService is dependend on non-standard driver behaviour #9023

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

Closed
queueseven opened this issue Sep 16, 2020 · 1 comment
Assignees
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: duplicate A duplicate of another issue

Comments

@queueseven
Copy link

Describe the bug
I'm using the JdbcOAuth2AuthorizedClientService with the MariaDB java connector. Authorization fails with a SQLSyntaxErrorException:

Can only convert a byte[] to BINARY, VARBINARY or LONGVARBINARY

To Reproduce
Use the JdbcOAuth2AuthorizedClientService with the MariaDB java connector.

Expected behavior
No exception should be thrown.

The problem is these two lines:

parameters.add(new SqlParameterValue(Types.BLOB, accessToken.getTokenValue().getBytes(StandardCharsets.UTF_8)));

parameters.add(new SqlParameterValue(Types.BLOB, refreshTokenValue));

According to the JDBC specification, a driver has to implement conversions between byte[] <=> BINARY, VARBINARY, LONGVARBINARY and java.sql.Blob <=> BLOB. While some drivers implement a conversion between byte[] and BLOB, it's a non-standard behaviour and you can't rely on it.

So, in this case, the byte[]s should be wrapped in an appropriate java.sql.Blob type.

@queueseven queueseven added status: waiting-for-triage An issue we've not yet triaged type: bug A general bug labels Sep 16, 2020
@jgrandja
Copy link
Contributor

@queueseven Please see this comment and this one. You need to provide a custom configuration of JdbcOAuth2AuthorizedClientService.

I'm going to close this as a duplicate.

@jgrandja jgrandja self-assigned this Sep 21, 2020
@jgrandja jgrandja added in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged type: bug A general bug labels Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants