There was a security breach after an imposter was allowed into barracks just yards from Windsor Castle.