我给一个Project添加了CAS. 但是Project中的一个Controller A出现了问题。在A中我使用了类似
URL url = new URL( "..." );
InputStream in = new BufferedInputStream(url.openStream());
这意味着一个新的Session被创建。这个Session同时应当被Controller B响应.
但是它被CAS截住了,自然也就不能倍B处理.我试了很多方法, 对新的Session注入authentication 都不行.望高人指点,谢谢.
URL url = new URL( "..." );
InputStream in = new BufferedInputStream(url.openStream());
这意味着一个新的Session被创建。这个Session同时应当被Controller B响应.
但是它被CAS截住了,自然也就不能倍B处理.我试了很多方法, 对新的Session注入authentication 都不行.望高人指点,谢谢.
解决方案 »
- 如何用反射得到方法参数的名字(其他方法也可)
- 求助有关SNMP4J的问题
- 关于hibernate连接sqlserver2008 找不到的问题
- jsp 导出excel异常
- SOFTBANK 910SH 发邮件问题
- Hibernate3.1不支持注释映射吗...
- 连了一天,没连成功,看了n篇文章,tomcat重启了n次,郁闷,100分解决!!!
- ejb的安全属性设置了安全角色,有什么作用。
- 远程接口的权限控制
- ubuntu12下安装maven成功,但退出当前端口再检测就会报错,新人求教
- struts2 的标签<s:property value=''/> escape 属性
- 有谁知道极酷Flvplayer网页播放器怎么用啊????
如果您确实理解HTTP,MVC,CAS和Spring Framework,不妨给小弟明示.ps:
问题补充: 不可以在CAS中把Controller B添加例外。 Controller B 本身实现一个独立功能,同样需要Security。
HttpURLConnection connection = ( HttpURLConnection ) url.openConnection();
connection.setRequestProperty("Proxy-Authorization",(new StringBuilder("Basic ")) .append((new BASE64Encoder()).encode((new StringBuilder(String.valueOf(proxyUser)))
.append(":").append(proxyPassword).toString().getBytes())).toString());
or
connection.setRequestProperty("Authorization", ...)
or
HttpClient ->..->HttpEntity
or
HttpClient -> GetMethod -> setAuthenticationPreemptive -> executeMethod
or
configuation of cookie
or
Authentication authentication = authenticationManager.authenticate(authRequest);
SecurityContext securityContext = SecurityContextHolder.getContext();
securityContext.setAuthentication(authentication);
or
HttpSession session = request.getSession(true);
session.setAttribute("SPRING_SECURITY_CONTEXT", securityContext);all of these dont work for me. but i hope they are useful for other friends. has someone more ideas ? waiting for help ...