Skip to content

some of the types that are serialized in the session should also be registered as serializable in graalvm aot hints #19804

Description

@joshlong

i mention this because spring session serialzizes the contents of the session to a backing database store and spring security routinely puts objects in the sesion

here are some aot hints i had to register on a spring cloud gateway + oauth client app

	static class Hints implements RuntimeHintsRegistrar {

		@Override
		public void registerHints(@NonNull RuntimeHints hints, @Nullable ClassLoader classLoader) {

			for (var c : new String[] { "java.time.Ser", "java.util.Collections$UnmodifiableMap" }) {
				hints.reflection().registerType(TypeReference.of(c), th -> th.withJavaSerialization(true));
			}

			for (var c : new Class[] { URL.class, URI.class, AuthorizationGrantType.class,
					OAuth2AuthorizationResponseType.class, OidcIdToken.class, Instant.class, AddressStandardClaim.class,
					OidcUserInfo.class, OidcUserAuthority.class, OAuth2UserAuthority.class, LinkedHashSet.class,
					HashSet.class, LinkedHashMap.class, OAuth2AuthorizationRequest.class, AbstractOAuth2Token.class,
					DefaultOAuth2User.class, Jwt.class, OAuth2AccessToken.class, OAuth2DeviceCode.class,
					OAuth2RefreshToken.class, OAuth2UserCode.class, OidcIdToken.class, OidcLogoutToken.class,
					DefaultOidcUser.class })
				hints.reflection().registerType(c, th -> th.withJavaSerialization(true));

		}

	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions