In the situation where the argument being put forward relies on the explicitly or implicitly stated expertise of the orator - such as an article which says "Take heed of my opinion of the important medical factors here, for I am a doctor" - contending that said orator doesn't have that expertise is entirely valid, and not ad hominem. Ad hominem is such when the attack on the orator is orthogonal to their argument.