Skip to content

Revelation Builder constructor #1527

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
wants to merge 2 commits into from
Closed

Conversation

leshalv
Copy link
Contributor

@leshalv leshalv commented Jan 29, 2024

No description provided.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 29, 2024
@leshalv
Copy link
Contributor Author

leshalv commented Jan 30, 2024

Deserialize and assemble OAuth2Authorization in a user-defined mode

@@ -391,7 +391,7 @@ public static class Builder implements Serializable {
private Map<Class<? extends OAuth2Token>, Token<?>> tokens = new HashMap<>();
private final Map<String, Object> attributes = new HashMap<>();

protected Builder(String registeredClientId) {
public Builder(String registeredClientId) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@leshalv

The Builder is not intended to be directly instantiated. The factory methods withRegisteredClient() and from() should be used instead.

Deserialize and assemble OAuth2Authorization in a user-defined mode

I don't quite understand this statement. Please provide more specific details.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When customizing redis storage, deserialization is required. RegisteredClient is required to build an OAuth2Authorization object, which requires encapsulation of RegisteredClient. In fact, when building OAuth2Authorization, only registeredClientId is enough.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@leshalv OAuth2Authorization and RegisteredClient are core domain classes within the framework and are not intended to represent an Entity or DTO, that can more easily be serialized. If you're looking to serialize these objects into a Redis store then you need to create an Entity/DTO representation of those objects so it can be serialized.

There is a discussion and some examples provided in gh-558.

We are also planning on providing a How-to guide in gh-1019 to demonstrate how to implement it. You can also look at the existing How-to: Implement core services with JPA to see how the Entity representations can look like and instead of persisting to a sql db, you can serialize to JSON for Redis storage.

I'm going to close this PR as we don't want to expose the Builder constructor as the factory methods should be used instead.

@jgrandja jgrandja added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 30, 2024
@jgrandja jgrandja self-assigned this Jan 30, 2024
@jgrandja jgrandja added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-feedback We need additional information before we can continue labels Jan 31, 2024
@jgrandja jgrandja closed this Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants