
package io.renren.modules.security.controller;

import org.apache.shiro.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import io.renren.modules.security.user.UserDetail;
import io.renren.modules.sys.service.SysUserService;

/**
 * Controller公共组件
 *
 * @author Mark sunlightcs@gmail.com
 */
public abstract class AbstractController {
	@Autowired
	protected SysUserService sysUserService;
	
	protected Logger logger = LoggerFactory.getLogger(getClass());
	
	protected UserDetail getUser() {
		return (UserDetail) SecurityUtils.getSubject().getPrincipal();
	}

	protected Long getUserId() {
		return getUser().getId();
	}

	protected String getUserName() {
		return getUser().getUsername();
	}
}
