Could you be more specific? Why exactly do you want to do this? If a user is logged in, they're already authenticated. Is this perhaps a cgi type of situation, or some wierd network service? I think you'll find that your question is a bit too generic.
Update: I'm a goober :) ignore me!
Comment on Re: how to use /etc/passwd with perl programs