private static byte[] consumeByteSourceOrNull(final ByteSource source) {
        return FunctionUtils.doUnchecked(() -> {
            if (source == null || source.isEmpty()) {
                return null;
            }
            return source.read();
        });
    }
Read the contents of the source into a byte array.

@param source the byte array source
@return the byte[] read from the source or null
support/cas-server-support-spnego/src/main/java/org/apereo/cas/support/spnego/authentication/principal/SpnegoCredential.java