我给一个Project添加了CAS. 但是Project中的一个Controller A出现了问题。在A中我使用了类似
URL url = new URL( "..." );
InputStream in = new BufferedInputStream(url.openStream());
这意味着一个新的Session被创建。这个Session同时应当被Controller B响应.
但是它被CAS截住了,自然也就不能倍B处理.我试了很多方法, 对新的Session注入authentication 都不行.望高人指点,谢谢.

解决方案 »

  1.   

    to yuppy: 您不是打算把这贴变成水帖吧?
    如果您确实理解HTTP,MVC,CAS和Spring Framework,不妨给小弟明示.ps:
    问题补充: 不可以在CAS中把Controller B添加例外。 Controller B 本身实现一个独立功能,同样需要Security。
      

  2.   

    i have tried 
    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 ...