Package nexj.core.util.auth

Examples of nexj.core.util.auth.PasswordAuthenticationProvider


    */
   protected boolean retrievePassword()
   {
      if (m_currentAuthentication.getUser() == null)
      {
         PasswordAuthenticationProvider provider = m_currentAuthentication.getProvider();

         if (provider == null)
         {
            return false;
         }

         if (provider instanceof Prompt)
         {
            ((Prompt)provider).setPrompt((m_currentAuthentication.getUserSaved() == null) ? null : "Invalid password");
         }

         PasswordAuthentication pwa = provider.getPasswordAuthentication();

         m_currentAuthentication.setUser((pwa == null) ? null : pwa.getUserName());
         m_currentAuthentication.setPassword((pwa == null) ? null : pwa.getPassword());

         if (m_currentAuthentication.isCurrentMatchedBySaved())
View Full Code Here


            {
               m_proxyUser = Undefined.VALUE;
            }
            else
            {
               PasswordAuthenticationProvider provider = strategy.getProvider();

               if (provider != null)
               {
                  PasswordAuthentication auth = provider.getPasswordAuthentication();

                  if (auth != null)
                  {
                     m_proxyUser = auth.getUserName();
                     m_achProxyPassword = auth.getPassword();
View Full Code Here

    */
   protected void execute(String sCommand) throws Exception
   {
      HTTPClient client = new HTTPClient();

      client.setPasswordProvider(new PasswordAuthenticationProvider()
      {
         public PasswordAuthentication getPasswordAuthentication()
         {
            return new PasswordAuthentication("nexjsa", "nexj".toCharArray());
         }
View Full Code Here

            {
               String sPassword = (String)tobj.findValue(PASSWORD);
               final PasswordAuthentication credentials = new PasswordAuthentication(sUser,
                  ((sPassword == null) ? "" : sPassword).toCharArray());

               m_client.setPasswordProvider(new PasswordAuthenticationProvider()
               {
                  public PasswordAuthentication getPasswordAuthentication()
                  {
                     return credentials;
                  }

                  public boolean isAuthenticationDeterministic()
                  {
                     return true;
                  }
               });
            }
         }
         else
         {
            m_client.setPasswordProvider(this);
         }

         final String sProxyHost = (String)tobj.findValue(PROXY_HOST);
         Proxy proxy = m_channel.getProxy();

         if (sProxyHost != null)
         {
            final Integer proxyPort = (Integer)tobj.findValue(PROXY_PORT);

            if (proxyPort != null)
            {
               proxy = new Proxy(Proxy.Type.HTTP, (InetSocketAddress)AccessController.doPrivileged(
                  new PrivilegedAction()
                  {
                     public Object run()
                     {
                        return InetSocketAddress.createUnresolved(sProxyHost, proxyPort.intValue());
                     }
                  }
               ));
            }
         }

         m_client.setProxy(proxy);

         switch (m_channel.getProxyAuthMode())
         {
            case HTTPChannel.AUTH_BASIC:
               m_client.setProxySPNEGOMode(HTTPClient.SPNEGO_NONE);
               break;

            case HTTPChannel.AUTH_CRED:
               m_client.setProxySPNEGOMode(HTTPClient.SPNEGO_CRED);
               break;

            case HTTPChannel.AUTH_SERVER:
               m_client.setProxySPNEGOMode(HTTPClient.SPNEGO_SILENT);
               break;
         }

         String sProxyUser = (String)tobj.findValue(PROXY_USER);
         String sProxyPassword;

         if (sProxyUser == null)
         {
            sProxyPassword = m_channel.getProxyPassword();
            sProxyUser = m_channel.getUser();
         }
         else
         {
            sProxyPassword = (String)tobj.findValue(PROXY_PASSWORD);
         }

         if (sProxyUser != null)
         {
            final PasswordAuthentication proxyCredentials = new PasswordAuthentication(sProxyUser,
               ((sProxyPassword == null) ? "" : sProxyPassword).toCharArray());

            m_client.setProxyPasswordProvider(new PasswordAuthenticationProvider()
            {
               public PasswordAuthentication getPasswordAuthentication()
               {
                  return proxyCredentials;
               }
View Full Code Here

TOP

Related Classes of nexj.core.util.auth.PasswordAuthenticationProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.