Package com.salas.bb.utils.net.auth

Examples of com.salas.bb.utils.net.auth.IPasswordsRepository


    /**
     * 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


    /**
     * Tests forgetting the password from given context.
     */
    public void testForget()
    {
        IPasswordsRepository repository = initModernDatabase();

        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

    /**
     * Tests complete forgeting of all passwords.
     */
    public void testForgetAll()
    {
        IPasswordsRepository repository = initModernDatabase();

        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

        System.setProperty("http.agent.discoverer", description.getProductText() + " Discoverer" +
            " (" + description.getVendorURL() + ") " + System.getProperty("java.version"));

        // Create and initialize caching authenticator
        IPersistenceManager persistenceManager = PersistenceManagerConfig.getManager();
        IPasswordsRepository passwordsRepository = persistenceManager.getPasswordsRepository();
        Authenticator.setDefault(new CachingAuthenticator(passwordsRepository));

        // This is a very kludgy way to propagate default reading and connection timeouts.
        // It's the only way for now (JRE 1.4.x) to let this values be used when running under JWS.
        // NOTE: NetworkClient is not part of public API and can be removed/changed in a future.
View Full Code Here

TOP

Related Classes of com.salas.bb.utils.net.auth.IPasswordsRepository

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.