package com.aperture_software.glados_wiki.spring.shiro; import org.apache.shiro.SecurityUtils; import org.apache.shiro.session.Session; import org.springframework.core.MethodParameter; import org.springframework.web.bind.support.WebDataBinderFactory; import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.ModelAndViewContainer; /** * Created by jhyun on 13. 12. 23. */ public class ShiroSessionHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver { @Override public boolean supportsParameter(MethodParameter parameter) { return parameter.getParameterType().isInstance(Session.class) || parameter.getParameterType().equals(Session.class); } @Override public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { return SecurityUtils.getSubject().getSession(true); } }