Package org.apache.qpid.server.security

Examples of org.apache.qpid.server.security.FileKeyStore


        TaskExecutor executor = new CurrentThreadTaskExecutor();
        when(broker.getObjectFactory()).thenReturn(_factory);
        when(broker.getModel()).thenReturn(_factory.getModel());
        when(broker.getTaskExecutor()).thenReturn(executor);

        final FileKeyStore keyStore =
                createKeyStore(attributes, broker);


        assertNotNull("Key store configured object is not created", keyStore);
        assertEquals(attributes.get(ConfiguredObject.ID), keyStore.getId());

        //verify we can retrieve the actual password using the method
        Subject.doAs(SecurityManager.getSubjectWithAddedSystemRights(), new PrivilegedAction<Object>()
        {
            @Override
            public Object run()
            {
                assertNotNull(keyStore.getPassword());
                assertEquals(TestSSLConstants.BROKER_TRUSTSTORE_PASSWORD, keyStore.getPassword());
                //verify that we haven't configured the key store with the actual dummy password value
                assertFalse(AbstractConfiguredObject.SECURED_STRING_VALUE.equals(keyStore.getPassword()));
                return null;
            }
        });


        // Verify the remaining attributes, including that the password value returned
        // via getAttribute is actually the dummy value and not the real password
        attributesCopy.put(FileKeyStore.PASSWORD, AbstractConfiguredObject.SECURED_STRING_VALUE);
        for (Map.Entry<String, Object> attribute : attributesCopy.entrySet())
        {
            Object attributeValue = keyStore.getAttribute(attribute.getKey());
            assertEquals("Unexpected value of attribute '" + attribute.getKey() + "'", attribute.getValue(), attributeValue);
        }
    }
View Full Code Here


        TaskExecutor executor = CurrentThreadTaskExecutor.newStartedInstance();
        when(broker.getObjectFactory()).thenReturn(_factory);
        when(broker.getModel()).thenReturn(_factory.getModel());
        when(broker.getTaskExecutor()).thenReturn(executor);

        final FileKeyStore keyStore =
                createKeyStore(attributes, broker);


        assertNotNull("Key store configured object is not created", keyStore);
        assertEquals(attributes.get(ConfiguredObject.ID), keyStore.getId());

        //verify we can retrieve the actual password using the method
        Subject.doAs(SecurityManager.getSubjectWithAddedSystemRights(), new PrivilegedAction<Object>()
        {
            @Override
            public Object run()
            {
                assertNotNull(keyStore.getPassword());
                assertEquals(TestSSLConstants.BROKER_TRUSTSTORE_PASSWORD, keyStore.getPassword());
                //verify that we haven't configured the key store with the actual dummy password value
                assertFalse(AbstractConfiguredObject.SECURED_STRING_VALUE.equals(keyStore.getPassword()));
                return null;
            }
        });


        // Verify the remaining attributes, including that the password value returned
        // via getAttribute is actually the dummy value and not the real password
        attributesCopy.put(FileKeyStore.PASSWORD, AbstractConfiguredObject.SECURED_STRING_VALUE);
        for (Map.Entry<String, Object> attribute : attributesCopy.entrySet())
        {
            Object attributeValue = keyStore.getAttribute(attribute.getKey());
            assertEquals("Unexpected value of attribute '" + attribute.getKey() + "'", attribute.getValue(), attributeValue);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.security.FileKeyStore

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.