@Override
    public Optional<UserIdentity> authenticate(final HttpServletRequest request,
                                               final AttributeMap attributeMap) {
        try {
            final ReceiveDataConfig receiveDataConfig = receiveDataConfigProvider.get();
            final Optional<UserIdentity> optUserIdentity = getDataFeedKey(request, attributeMap, receiveDataConfig)
                    .map(dataFeedKey -> {
                        final CIKey keyOwnerMetaKey = getOwnerMetaKey(receiveDataConfig);
                        final String keyOwner = dataFeedKey.getStreamMetaValue(keyOwnerMetaKey);
                        // Ensure the stream attributes from the data feed key are set in the attributeMap so
                        // that the AttributeMapFilters have access to them and any attributes that are static
                        // to this key are applied to all streams that use it, e.g. aws account number.
                        // Entries from the data feed key trump what is in the headers
                        attributeMap.putAll(dataFeedKey.getAttributeMap());
                        return new DataFeedKeyUserIdentity(keyOwner);
                    });
            LOGGER.debug("Returning {}, attributeMap: {}", optUserIdentity, attributeMap);
            return optUserIdentity;
        } catch (StroomStreamException e) {
            throw e;
        } catch (Exception e) {
            throw new StroomStreamException(
                    StroomStatusCode.DATA_FEED_KEY_NOT_AUTHENTICATED, attributeMap, e.getMessage());
        }
    }
@return An optional containing a non-blank attribute value, else empty.
stroom-receive/stroom-receive-common/src/main/java/stroom/receive/common/DataFeedKeyServiceImpl.java