Package net.datacrow.core.web

Source Code of net.datacrow.core.web.DcSecured

package net.datacrow.core.web;


import javax.faces.context.FacesContext;
import javax.faces.el.VariableResolver;

import net.datacrow.core.security.SecuredUser;
import net.datacrow.core.web.beans.Security;

public class DcSecured {
   
    protected boolean isLoggedIn() {
        FacesContext fc = FacesContext.getCurrentInstance();
        VariableResolver vr = fc.getApplication().getVariableResolver();
        Security security = (Security) vr.resolveVariable(fc, "security");
        return security.isLoggedIn();
    }
   
    public SecuredUser getUser() {
        FacesContext fc = FacesContext.getCurrentInstance();
        VariableResolver vr = fc.getApplication().getVariableResolver();
        Security security = (Security) vr.resolveVariable(fc, "security");
        return security.getUser();
    }
   
    protected String redirect() {
        return "login";
    }
}
TOP

Related Classes of net.datacrow.core.web.DcSecured

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.