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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.

this.registeredClientId = registeredClientId;
}

Expand Down