Most of the time we need to get current logged in user in ADF application.

Below is code snippet to get current user:

public static String getCurrentUser(){
        String userName = ADFContext.getCurrent().getSecurityContext().getUserName();       
        return userName;
    }