Refined login process with Foundation classes