public static Optional<String> getJwsFromHeader(final HttpServletRequest request,
                                                    final String headerName) {
        return Optional.ofNullable(request.getHeader(headerName))
                .filter(str -> !str.isBlank())
                .map(str -> {
                    final String jws;
                    if (str.startsWith(BEARER_PREFIX)) {
                        // This chops out 'Bearer' so we get just the token.
                        jws = str.substring(BEARER_PREFIX.length());
                    } else {
                        jws = str;
                    }
                    LOGGER.debug(() ->
                            "Found auth header in request:\n" + headerName + ": " + jws);
                    return jws;
                });
    }
Get the JSON Web Signature from the specified request header
stroom-security/stroom-security-common-impl/src/main/java/stroom/security/common/impl/JwtUtil.java