@Test public void セッションスコープに保存したトークンのhidden用パラメータが取得できる() throws Exception { TokenManager manager = new TokenManager(); manager.afterPropertiesSet(); manager.saveToken(request, Controllers.SCOPE_SESSION); TokenRequestDataValueProcessing t = new TokenRequestDataValueProcessing(); Field managerField = t.getClass().getDeclaredField("manager"); managerField.setAccessible(true); managerField.set(t, manager); Map<String, String> hiddenParameterMap = t.getExtraHiddenFields(request); assertThat(hiddenParameterMap.keySet(), hasItem(TokenManager.SESSION_TOKEN_PARAMETER_NAME)); assertThat(hiddenParameterMap.get(TokenManager.SESSION_TOKEN_PARAMETER_NAME), is(manager.getToken(request, Controllers.SCOPE_SESSION))); }
@Override public Map<String, String> getExtraHiddenFields(HttpServletRequest request) { return manager.getTokenMap(request); }
TokenRequestDataValueProcessing implements RequestDataValueProcessor { @Override public Map<String, String> getExtraHiddenFields(HttpServletRequest request) { return manager.getTokenMap(request); } }
TokenRequestDataValueProcessing implements RequestDataValueProcessor { @Override public Map<String, String> getExtraHiddenFields(HttpServletRequest request) { return manager.getTokenMap(request); } TokenRequestDataValueProcessing(); }
TokenRequestDataValueProcessing implements RequestDataValueProcessor { @Override public Map<String, String> getExtraHiddenFields(HttpServletRequest request) { return manager.getTokenMap(request); } TokenRequestDataValueProcessing(); String processAction(HttpServletRequest request, String action); @Override String processAction(HttpServletRequest request, String action, String httpMethod); @Override String processFormFieldValue(HttpServletRequest request, String name, String value, String type); @Override Map<String, String> getExtraHiddenFields(HttpServletRequest request); @Override String processUrl(HttpServletRequest request, String url); }
TokenRequestDataValueProcessing implements RequestDataValueProcessor { @Override public Map<String, String> getExtraHiddenFields(HttpServletRequest request) { return manager.getTokenMap(request); } TokenRequestDataValueProcessing(); String processAction(HttpServletRequest request, String action); @Override String processAction(HttpServletRequest request, String action, String httpMethod); @Override String processFormFieldValue(HttpServletRequest request, String name, String value, String type); @Override Map<String, String> getExtraHiddenFields(HttpServletRequest request); @Override String processUrl(HttpServletRequest request, String url);  }