Afghan failed asylum-seeker in Germany believed to have put Islamist posts on social media suspected of attack