protected Date getAttributeAsDate(final String name) {
        val value = getAttribute(name);
        // it should be a Date, but in case it's a Long (Vertx issue with profiles serialized to JSON and restored)
        if (value instanceof Long l) {
            return new Date(l);
        }
        else if (value instanceof Double d) {
            return new Date(d.longValue());
        }
        else {
            return (Date) getAttribute(name);
        }
    }
<p>getAttributeAsDate.</p>

@param name a {@link String} object
@return a {@link Date} object
pac4j-core/src/main/java/org/pac4j/core/profile/CommonProfile.java