001    /**
002     * Implements the CFML Function getauthuser
003     */
004    package railo.runtime.functions.other;
005    
006    import railo.runtime.PageContext;
007    import railo.runtime.exp.PageException;
008    import railo.runtime.ext.function.Function;
009    import railo.runtime.security.Credential;
010    
011    public final class GetAuthUser implements Function {
012            public static String call(PageContext pc ) throws PageException {
013                Credential remoteUser = pc.getRemoteUser();
014                if(remoteUser==null) {
015                String user=pc. getHttpServletRequest().getRemoteUser();
016                if(user!=null) {
017                    return user;
018                }
019                return "";
020            }
021            return remoteUser.getUsername();
022            
023            }
024    }