Skip to content

Provide JDBC implementation of RegisteredClientRepository #265

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
rlewczuk opened this issue Mar 23, 2021 · 7 comments
Closed

Provide JDBC implementation of RegisteredClientRepository #265

rlewczuk opened this issue Mar 23, 2021 · 7 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@rlewczuk
Copy link
Contributor

rlewczuk commented Mar 23, 2021

This would be useful in real-world workloads where clients are registered and maintained at runtime, without restarting server.

In fact, I've implemented it as I'm evaluating new spring authorization server in my (not-yet-production) projects. It follows userdetails.jdbc.JdbcDaoImpl implementation and only uses Spring JdbcTemplate.

If there are no objections, I would be happy to submit pull request when right time comes.

Current implementation: https://github.com/rlewczuk/spring-authorization-server/tree/gh-265-jdbc-client-repository

Related gh-57 gh-245

@rlewczuk rlewczuk added the type: enhancement A general enhancement label Mar 23, 2021
@jgrandja jgrandja added the status: on-hold We can't start working on this issue yet label Mar 26, 2021
@jgrandja jgrandja added this to the 0.1.2 milestone Mar 26, 2021
@jgrandja
Copy link
Collaborator

Thanks @rlewczuk. I've scheduled this for 0.1.2 so we can implement alongside gh-245.

Please see the comment in gh-245 related to JdbcOAuth2AuthorizedClientService.

Feel free to submit the PR after we get 0.1.1 out.
Thanks!

@metacubed
Copy link

@rlewczuk, what are your thoughts on.using the ARRAY database type for the scopes and authorities columns? It makes it easier to query/filter scopes during token generation.

@rlewczuk
Copy link
Contributor Author

@metacubed ARRAY database type is not portable, for example MySQL does not support it.

But representation of collection attributes of RegisteredClient (scopes, grant types, authentication methods) is valid question. I also considered normalized representation (additional tables) and JSON-formatted fields. Ultimately I decided to keep design (queries, JSON parsing) as simple as possible and provide extension point for users to customize if necessary. You can use setRegisteredClientRowMapper() to provide your own mapper that will fit your solution (alongside with setClientsByIdQuery() method).

@StevenRogers302
Copy link

@rlewczuk
Why did you add two more AuthorizationGrantType and ClientAuthenticationMethod types ? Where can i get more information?

About:

public static final AuthorizationGrantType JWT_BEARER = new AuthorizationGrantType("urn:ietf:params:oauth:grant-type:jwt-bearer");

public static final AuthorizationGrantType SAML2_BEARER = new AuthorizationGrantType("urn:ietf:params:oauth:grant-type:saml2-bearer");

@xzxiaoshan
Copy link

Current implementation: https://github.com/rlewczuk/spring-authorization-server/tree/gh-265-jdbc-client-repository


@rlewczuk

Refer to the previous official table definition rule:
spring-security-oauth2-client-5.4.5.jar/org.springframework.security.oauth2.client/oauth2-client-schema.sql

It is indicated that the best choice is oauth2_ For prefixes, intuitive semantics are recommended for field names, so the following suggestions are made:

It is recommended to modify the name and field of the table as follows:

  1. Change the table name clients to oauth2_ registered_ client
  2. Modify column atoken_ttl is access_token_ttl
  3. Modify column rtoken_ttl is refresh_token_ttl
  4. Modify column rtoken_reuse is refresh_token_reuse

@rlewczuk
Copy link
Contributor Author

@xzxiaoshan Database object names have been fixed. Thank you for review.

@rlewczuk
Copy link
Contributor Author

@zhangzp-handsome those new constants refer to Assertion Framework for OAuth 2.0 Client Authentication and Authorization Grants as described in RFC 7521, 7522, 7523. I've added constants in separate commit rlewczuk@356d206. Adding this commit to jdbc-client-repository branch allowed to support those constants in JdbcRegisteredClientRepository, so I don't need to return to this issue later on. However, including it into this particular change is topic for discussion. As those constants are used across few branches (changes) I'm working on, it probably makes sense to submit them as separate PR.

rlewczuk added a commit to rlewczuk/spring-authorization-server that referenced this issue May 9, 2021
rlewczuk added a commit to rlewczuk/spring-authorization-server that referenced this issue May 10, 2021
rlewczuk added a commit to rlewczuk/spring-authorization-server that referenced this issue May 12, 2021
rlewczuk added a commit to rlewczuk/spring-authorization-server that referenced this issue May 12, 2021
rlewczuk added a commit to rlewczuk/spring-authorization-server that referenced this issue May 12, 2021
@jgrandja jgrandja removed the status: on-hold We can't start working on this issue yet label May 20, 2021
@sjohnr sjohnr closed this as completed in 769cf8f Jun 22, 2021
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
Development

Successfully merging a pull request may close this issue.

5 participants