protected byte[] serialize(PrincipalCollection principals) {
        ClassUtils.setAdditionalClassLoader(AbstractRememberMeManager.class.getClassLoader());
        try {
            return getSerializer().serialize(principals);
        } finally {
            ClassUtils.removeAdditionalClassLoader();
        }
    }
Serializes the given {@code principals} by serializing them to a byte array by using the
{@link #getSerializer() serializer}'s {@link Serializer#serialize(Object) serialize} method.

@param principals the principal collection to serialize to a byte array
@return the serialized principal collection in the form of a byte array
core/src/main/java/org/apache/shiro/mgt/AbstractRememberMeManager.java