Announcement Announcement Module
Collapse
No announcement yet.
Authentication Required Dialog popup unexpectedly Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Authentication Required Dialog popup unexpectedly

    I have a Java Web Start program that communicate with server via http invoker. The server is protected by spring security as following:

    Code:
        <sec:http realm="My App">
            <sec:http-basic />
            <sec:intercept-url pattern="/remoting/**" access="ROLE_USER" />
        </sec:http>
    
        <bean id="myUserDetailsService" class="securityutil.MyUserDetailsService" />
    
        <sec:authentication-manager>
            <sec:authentication-provider user-service-ref="myUserDetailsService" />
        </sec:authentication-manager>
    My RemotingBean.xml is as following:

    Code:
        <bean id="MyUserBean" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
            <property name="serviceUrl" value="http://localhost:8081/BondWMS4-war/remoting/MyUserBean"/>
            <property name="serviceInterface" value="exportBeans.MyUserBean" />
            <property name="httpInvokerRequestExecutor" value="org.springframework.security.context.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />
        </bean>
    My login code is as following:

    Code:
    public tryLogin(String userName, String password) {
      Authentication auth = new UsernamePasswordAuthenticationToken(userName, password);
      SecurityContextHolder.getContext().setAuthentication(auth);
      XmlBeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("myappclient/RemotingBean.xml"));
      MyUserBean myBean = (MyUserBean) beanFactory.getBean("MyUserBean");
      try {
        UserInfo userInfo = myBean.getUserInfo(userName, password);
        if (userInfo != null) {
          JOptionPane.showMessageDialog(this, "Login Successful.");
        } else {
          JOptionPane.showMessageDialog(this, "Login failed!");
        }
      } catch (Exception e) {
        JOptionPane.showMessageDialog(this, "Login failed!");
      }
    }
    If user key in wrong password, a "Authentication Required" dialog by java will popup, and if the user key in correct password this time. My program will show Login failed dialog. This will confuse user.

    Please tell me how to suppress "Authentication Required" dialog or get authentication info from "Authentication Required" dialog.

    If you have better authentication solution, please tell advice.

    Thanks in Advance.

  • #2
    Did you get solution to suppress the authentication popup in this case. I am also facing the same issue and if you have the solution please suggest.

    Thanks in Advance !

    Comment


    • #3
      I am also facing this problem. I am using JaxWsPortProxyFactoryBean to access secure web-service. If I set a wrong username/password then I get this ugly window.

      It only happens when the application is deployed with Java Web Start

      Comment

      Working...
      X