Hello,
I'm getting an error
java.lang.ClassCastException: class java.util.LinkedHashMap cannot be cast to class org.springframework.security.core.Authentication (java.util.LinkedHashMap is in module java.base of loader 'bootstrap'; org.springframework.security.core.Authentication is in unnamed module of loader 'app') on OAuth2RefreshTokenAuthenticationProvider
when I used JdbcOAuth2AuthorizationService (for MySQL)
DefaultOAuth2TokenContext.Builder tokenContextBuilder = DefaultOAuth2TokenContext.builder()
.registeredClient(registeredClient)
.principal(authorization.getAttribute(Principal.class.getName())) --> error occurred in this line
.authorizationServerContext(AuthorizationServerContextHolder.getContext())
.authorization(authorization)
.authorizedScopes(scopes)
.authorizationGrantType(AuthorizationGrantType.REFRESH_TOKEN)
.authorizationGrant(refreshTokenAuthentication);
Comment From: marcusdacoregio
Hi, @burakbalim. If I am seeing correctly, this seems to be an issue related to Spring Authorization Server. Would you please open an issue in their issue tracker?
Comment From: burakbalim
Sorry for late response, yes I can open new issue, I spent a lot of time using object mapper for different ways and I can’t solve it, and lastly I found making new desarilazer for convert to Authenticationtoken model but I need to spend a lot of time of it, really bad experience for me, I will open new issue about this problem, main problem is object mapper parsing data from coming MySQL data
Comment From: karthikkudukuntla3959
@burakbalim can you please provide the deserializer code .
Comment From: burakbalim
I have started to write but have not finished yet (I have urgent other codes) I think, spring should provide this(I don't understand why they did this)