-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Why is the Spring Authorization Server Release version used as serialVersionUID #1203
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
Comments
@Chr3is Questions are better suited to Stack Overflow. We prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it). FYI, Spring Authorization Server follows how Spring Security assigns |
@jgrandja this is rather a discussion than a question. An enhancement could be to provide a "better" versioning for domain classes or at least to increment the serialVersionUID only if a real incompatibility was introduced. And this should not happen with a patch-release if you follow correct versioning. Spring Security Core (Release 5.8.2) has a serialVersionUID of One suggested enhancement is also to make |
Thanks for catching that! That was a mistake on our end. It has now been fixed and pushed to all 3 branches.
That is one approach but we went with the approach where users should extend from |
@jgrandja Thanks for fixing that! I have no clue how an extended OAuth2Authorization.Builder could work and how the private fields, coming from the OAuth2Authorization, should be set in my extended OAuth2Authorization. Could you provide an example? That would be great. (sidenote: we use lombok for builder generation to avoid to much boilerplate code, but this won't work here at all)
|
@Chr3is Apologies but Can you provide more details on the type of attributes you need in your extended model? Could you not use |
@jgrandja No worries! |
@Chr3is Can you please log a new issue for "Allow OAuth2Authorization to be extensible". Would you be interested in submitting a PR for this? |
@jgrandja I'm going to create a new issue for that and yeah I can try to provide a PR for this! |
N.B. Spring Security finally stopped doing this: https://spring.io/blog/2024/01/19/spring-security-6-3-adds-passive-jdk-serialization-deserialization-for |
The |
I meant minor release. Breaking changes should only happen on major releases, and only if necessary. |
In
org.springframework.security.oauth2.server.authorization.util.SpringAuthorizationServerVersion
the serialVersionUID is defined which is used across all spring authorization server classes which implement the Serializable interface. However I do not unterstand the intention for that.Lets assume these classes are used within a session store. For example the OAuth2Authorization. With every new release we would invalide these sessions due to a changed serialVersionUID and the resulting InvalidClassException when trying to deserialize the objects stored in the current session.
Wouldn't it be a better practice to provide an own serialVersionUID for every class which implements Serializable and only change it when real incompatibilities like removed fields where introduced? And provide a changelog for these changes?
Another question would be how am I supposed to extend the OAuth2Authorization which should be possible due to the fact that the class is not declared as final? There's no all args ctor, the fields are private and not protected. With an extended OAuth2Authorization it would be possible to overcome the serialVersionUID issue and provide an easier access to information stored within the attributes through own getters.
The text was updated successfully, but these errors were encountered: