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

JdbcOAuth2AuthorizationService should support clob and text datatype for token columns #480

Closed
ghost opened this issue Nov 4, 2021 · 8 comments
Labels
type: enhancement A general enhancement
Milestone

Comments

@ghost
Copy link

ghost commented Nov 4, 2021

Few issues were logged for JdbcOAuth2AuthorizationService as it does not work out of the box with PostgreSQL. Although customization is possible, we should change the schema from blob to varchar OR another standard SQL datatype that will work by default with PostgreSQL and most other databases

@ghost ghost added the type: enhancement A general enhancement label Nov 4, 2021
@jgrandja jgrandja assigned ghost Nov 4, 2021
@jgrandja jgrandja added this to the 0.2.1 milestone Nov 4, 2021
@muthu3107
Copy link

👍🏻

Kindly address this issue, have tries customizing it, but not able to get the result as expected, tried with all suggested solutions.

Changing from blob to VARCHAR would make up for most standard sql databases.

@ghost
Copy link
Author

ghost commented Nov 12, 2021

hi @jgrandja. Would you prefer to not use the LobHandler at all? I think we should still use it and write the values using setClobAsString and getClobAsString to read the data. If wrapasLob is false (which is by default) it will delegate to getString and setString methods (from PreparedStatement). If it's set to true, it will try to set a clob.

In this way, the schema can be changed to use something else than varchar if needed.

Draft PR: 491

ghost pushed a commit to ovidiupopa07/spring-authorization-server that referenced this issue Nov 12, 2021
…e database

Use CLOB instead of BLOB. With CLOB type the underlying schema can store varchars and clobs as well (if this is supported by the database)

Closes spring-projectsgh-480
@jgrandja
Copy link
Collaborator

@ovidiupopa91 It doesn't look like Postgres supports CLOB? If wrapasLob is false, will it work for Postgres?

I don't mind keeping LobHandler, I just want to ensure the solution works for Postgres by default.

@ghost
Copy link
Author

ghost commented Nov 15, 2021

@jgrandja I did check and it works by default with Postgress when token values are defined as varchar(1000) in the oauth2-authorization-schema.
The reason why I think it's a good idea to keep the LobHandler is that it will make life easier in extending the JdbcOauth2AuthozarionService if a DB that supports clob is used.
The only thing that needs to be done is to set wrapAsLob to true and it will try to insert a clob

@ghost
Copy link
Author

ghost commented Nov 15, 2021

By the way, I also noticed that the registration_access_token cannot be deserialized when calling the client configuration endpoint, because the client.read scope is stored in a SingletonSet. And there's no mixin for that.

Should I open a new issue for this or should I do it within this issue / PR?

ghost pushed a commit to ovidiupopa07/spring-authorization-server that referenced this issue Nov 15, 2021
…e database

Use CLOB instead of BLOB. With CLOB type the underlying schema can store varchars and clobs as well (if this is supported by the database)

Closes spring-projectsgh-480
@jgrandja
Copy link
Collaborator

@ovidiupopa91

the registration_access_token cannot be deserialized when calling the client configuration endpoint

Please open a new issue for this fix. Thanks for catching that!

Just a heads up that I'm on PTO Nov 19-24 (inclusive) and have a couple of priority issues to resolve this week. I'll try to review this week but it may be when I return from PTO.

@ghost
Copy link
Author

ghost commented Nov 16, 2021

495 raised to track the issue @jgrandja.
I will open a PR to fix it.

ghost pushed a commit to ovidiupopa07/spring-authorization-server that referenced this issue Nov 16, 2021
…e database

Use CLOB instead of BLOB. With CLOB type the underlying schema can store varchars and clobs as well (if this is supported by the database)

Closes spring-projectsgh-480
@jgrandja jgrandja modified the milestones: 0.2.1, 0.2.2 Nov 26, 2021
@Blackmail92
Copy link

Blackmail92 commented Dec 9, 2021

A small question.. You say that it should work out of the box, but when I use the jdbc client repo and authorization service, I get an exception telling that a table is not present, and I need to create that first manually.. Should I define some missing property to force the app to create the tables automatically?

@jgrandja jgrandja changed the title Change blob datatype to varchar when saving Oauth2Authorization to the database Change blob datatype to clob when saving Oauth2Authorization to the database Jan 6, 2022
ghost pushed a commit to ovidiupopa07/spring-authorization-server that referenced this issue Jan 18, 2022
ghost pushed a commit to ovidiupopa07/spring-authorization-server that referenced this issue Jan 24, 2022
ghost pushed a commit to ovidiupopa07/spring-authorization-server that referenced this issue Jan 24, 2022
@jgrandja jgrandja changed the title Change blob datatype to clob when saving Oauth2Authorization to the database JdbcOAuth2AuthorizationService should support clob and text datatype for token columns Jan 25, 2022
doba16 pushed a commit to doba16/spring-authorization-server that referenced this issue Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
3 participants