Package java.net

Examples of java.net.PasswordAuthentication


        Resource resource = ResourceFactory.newUrlResource(url);
        KnowledgeAgentConfiguration conf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
        Authenticator.setDefault(new Authenticator() {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication("admin", "admin".toCharArray());
            }
        });
        InputStream in = null;
        Collection<KnowledgePackage> kpkgs = null;
        try {
View Full Code Here


    public static Authenticator getAuthenticator() {
        return new Authenticator() {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(USERNAME, PASSWORD.toCharArray());
            }
        };
    }
View Full Code Here

   /**
    * Does authentication with the uddi registry
    */
   protected void jaxrLogin() throws JAXRException
   {
      PasswordAuthentication passwdAuth = new PasswordAuthentication(userid, passwd.toCharArray());
      Set creds = new HashSet();
      creds.add(passwdAuth);

      connection.setCredentials(creds);
   }
View Full Code Here

        {
            Authenticator.setDefault( new Authenticator()
            {
                protected PasswordAuthentication getPasswordAuthentication()
                {
                    PasswordAuthentication passwordAuthentication = new PasswordAuthentication( username, password.toCharArray() );

                    return passwordAuthentication;
                }
            } );
        }
View Full Code Here

        if (name[0] == null && pass[0] == null) {
            return null;
        }
        if( storePassword )
            store(name[0], pass[0]);
        return new PasswordAuthentication(name[0], pass[0].toCharArray());
    }
View Full Code Here

         if( password.getClass().isInstance(credential) )
            password = (char[]) credential;
         else
            password = credential.toString().toCharArray();
      }
      PasswordAuthentication auth = new PasswordAuthentication(name, password);
      return auth;
   }
View Full Code Here

     * Tests password recording.
     */
    public void testRecord()
    {
        IPasswordsRepository repository = initModernDatabase();
        PasswordAuthentication auth;

        auth = repository.getAuthInformation(SAMPLE_CONTEXT_A);
        assertNull("Database has no record about this context.", auth);

        repository.record(SAMPLE_CONTEXT_A, SAMPLE_AUTH_INFO);
        auth = repository.getAuthInformation(SAMPLE_CONTEXT_A);
        assertTrue("Database has record about this context.",
            Arrays.equals(SAMPLE_PASSWORD, auth.getPassword()));
        assertEquals("Database has record about this context.",
            SAMPLE_USERNAME, auth.getUserName());
    }
View Full Code Here

        repository.record(SAMPLE_CONTEXT_A, SAMPLE_AUTH_INFO);
        repository.record(SAMPLE_CONTEXT_B, SAMPLE_AUTH_INFO);
        repository.forget(SAMPLE_CONTEXT_A);

        PasswordAuthentication auth = repository.getAuthInformation(SAMPLE_CONTEXT_A);
        assertNull("Database should forget about the context.", auth);

        auth = repository.getAuthInformation(SAMPLE_CONTEXT_B);
        assertTrue("Database has record about this context.",
            Arrays.equals(SAMPLE_PASSWORD, auth.getPassword()));
        assertEquals("Database has record about this context.",
            SAMPLE_USERNAME, auth.getUserName());
    }
View Full Code Here

        repository.record(SAMPLE_CONTEXT_A, SAMPLE_AUTH_INFO);
        repository.record(SAMPLE_CONTEXT_B, SAMPLE_AUTH_INFO);
        repository.forgetAll();

        PasswordAuthentication auth = repository.getAuthInformation(SAMPLE_CONTEXT_A);
        assertNull("Database should forget the context password.", auth);
        auth = repository.getAuthInformation(SAMPLE_CONTEXT_B);
        assertNull("Database should forget the context password.", auth);
    }
View Full Code Here

                    Authenticator.setDefault( new Authenticator()
                    {
                        /** {@inheritDoc} */
                        protected PasswordAuthentication getPasswordAuthentication()
                        {
                            return new PasswordAuthentication( userName, pwd.toCharArray() );
                        }
                    } );
                }
            }
        }
View Full Code Here

TOP

Related Classes of java.net.PasswordAuthentication

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.