开发者

Help with Spring authentication from a Flex app

Some background: I have a Flex app embedded in an HTML page and am using Flex to send a soap request to my Java backend that does some authentication depending on the username and password entered in the Flex form. If I enter the correct login everything works fine and the Flex app can continue making further requests. But with an incorrect username/password, an "Authentication Required" dialog box pops up in my Browser and my Flex app won't开发者_运维知识库 respond with its proper handler until I click cancel. I'd like to get rid of the dialog box somehow, but I'm new to spring security.


If you are rolling your own authentication (i.e. not HTTP authentication but a SOAP call with the username and password), you can implement a HandlerExceptionResolver in the spring context to resolve the AccessDeniedException thrown by Spring Security and return a SoapFault properly (a ModelAndView that renders a SOAP envelope with the fault). Depending on the browser, you probably can only send the response with a result code of 200 (this can be done by the View) or else Flex won't get it (most browsers eat the HTTP body and don't pass it along to the flash plugin).

Reference:

  • http://static.springsource.org/spring/docs/2.0.x/reference/mvc.html#mvc-exceptionhandlers


well, you should handle your authentication response from sever by Javascript. It is possible to make some methods of your flex application available to be called by Page's Javascript. So in your 'handler' method you just pass your auth response to that method, that's it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜