I am trying to run a timer job in SharePoint 2010 that ultimately will call into the BCS to retrieve info from an Oracle database. My timer service is running as a domain user, so I expected this (when running through the timer job)
var timer_identity = System.Threading.Thread.CurrentPrincipal.Identity;
to represent the WindowsIdentity of that domain user. Instead, it's a GenericIdentity with no name, and as a result my attempts to access the database through BCS and the secure store service end up failing.
Why is my identity not what I think it should be? And what's the best way to get this code to run as a specific domain-based service account?