Package com.springsource.insight.collection

Examples of com.springsource.insight.collection.ObscuredValueSetMarker


        runExternalResourceAnalyzer(op, ExternalResourceType.WEB_SERVER, TEST_HOST, TEST_PORT);
    }

    @Test
    public void testDefaultObscuredHeaders() throws IOException {
        ObscuredValueSetMarker marker =
                setupObscuredTest(HttpObfuscator.OBFUSCATED_HEADERS_SETTING, HttpObfuscator.DEFAULT_OBFUSCATED_HEADERS_VALUES);
        HttpURLConnection conn = createConnection("POST", "testDefaultObscuredHeaders");
        Map<String, List<String>> propsMap;
        try {
            propsMap = conn.getRequestProperties();
View Full Code Here


    }

    @Test
    public void testObscuredHeaders() throws IOException {
        final String hdrName = "TestObscuredHeaders", hdrValue = String.valueOf(System.nanoTime());
        ObscuredValueSetMarker marker = setupObscuredTest(HttpObfuscator.OBFUSCATED_HEADERS_SETTING, hdrName);
        HttpURLConnection conn = createConnection("POST", hdrName);
        Map<String, List<String>> propsMap;
        try {
            conn.setRequestProperty(hdrName, hdrValue);
            propsMap = conn.getRequestProperties();
View Full Code Here

                        reqHdrs,
                        createMockClientHttpResponse(HttpStatus.OK, rspHdrs));
        ClientHttpResponse response = request.execute();
        assertNotNull("No response", response);

        ObscuredValueSetMarker obsMarker = (ObscuredValueSetMarker) obfuscator.getSensitiveValueMarker();
        for (String name : hdrs) {
            assertTrue("Value not obscured for " + name, obsMarker.remove(name));
        }

        // if obscured headers are not the defaults, make sure defaults are not obscured
        if (!defaultHeaders) {
            for (String name : HttpObfuscator.DEFAULT_OBFUSCATED_HEADERS_LIST) {
                assertFalse("Value un-necessarily obscured for " + name, obsMarker.contains(name));
            }
        }
    }
View Full Code Here

    public void testNonMatchingObscuredAddressesPattern() {
        runObscuredTest("^10\\..*", "192.168.3.1", false);
    }

    private void runObscuredTest(String pattern, String testAddress, boolean shouldObscure) {
        ObscuredValueSetMarker marker =
                setupObscuredTest(SocketCollectOperationContext.OBSCURED_ADDRESSES_PATTERN_SETTING, pattern);
        SocketAddress connectAddress = new InetSocketAddress(testAddress, TEST_PORT);
        Socket socket = new Socket();
        try {
            socket.connect(connectAddress, 125);
View Full Code Here

        super.restore();
    }

    protected void assertObfuscatedValuesState(Map<String, ?> attrs, boolean obfuscated) {
        AbstractJMSCollectionAspect aspectInstance = getJmsCollectionAspect();
        ObscuredValueSetMarker markedObjects = (ObscuredValueSetMarker) aspectInstance.getSensitiveValueMarker();
        if (!obfuscated) {
            assertEquals("Unexpected obfuscated values: " + markedObjects, 0, ListUtil.size(markedObjects));
            return;
        }

        for (Map.Entry<String, ?> ae : attrs.entrySet()) {
            String key = ae.getKey();
            Object value = ae.getValue();
            assertTrue("Value for key=" + key + " not marked as obfuscated", markedObjects.remove(value));
        }

        assertTrue("Orphan obfuscated values: " + markedObjects, markedObjects.isEmpty());
    }
View Full Code Here

        OperationMap params = op.get("params", OperationMap.class);
        if (params == null)
            return;

        JdbcDriverConnectOperationCollectionAspect aspectInstance = getAspect();
        ObscuredValueSetMarker obscuredValue = (ObscuredValueSetMarker) aspectInstance.getSensitiveValueMarker();
        for (String key : obscuredKeys) {
            Object value = params.get(key);
            if (value == null) {
                continue;
            }

            assertEquals("Key=" + key + " obscured state mismatch",
                    Boolean.valueOf(expectedState),
                    Boolean.valueOf(obscuredValue.contains(value)));
        }
    }
View Full Code Here

    }

    @Test
    public void testLogin() {
        DatabaseSessionOperationCollectionAspect aspectInstance = getAspect();
        ObscuredValueSetMarker marker = (ObscuredValueSetMarker) aspectInstance.getSensitiveValueMarker();
        for (LoginAction action : LoginAction.values()) {
            Login mockLogin = Mockito.mock(Login.class);
            Mockito.when(mockLogin.getUserName()).thenReturn("username:" + action.name());
            Mockito.when(mockLogin.getPassword()).thenReturn("password:" + action.name());
            mockSession.setLogin(mockLogin);
            action.executeAction(mockSession, mockLogin);

            Operation op = assertDatabaseSessionOperation(action.name(), "login");
            action.assertExecutionResult(op, mockLogin, marker);

            // prepare for next iteration
            Mockito.reset(spiedOperationCollector);
            marker.clear();
        }
    }
View Full Code Here

        assertOperationResult(result, Arrays.asList(grants));
    }

    @Test
    public void testObscuredCredentials() {
        ObscuredValueSetMarker marker = new ObscuredValueSetMarker();
        getAspect().setSensitiveValueMarker(marker);

        String[] grants = {"tester", "insight"};
        Authentication token = new TestingAuthenticationToken("testObscuredCredentials", "omer", grants);
        AuthenticationManager testManager = new AuthenticationTestManager(true);
View Full Code Here

        assertOperationResult(result, Arrays.asList(grants));
    }

    @Test
    public void testObscuredCredentials() {
        ObscuredValueSetMarker marker = new ObscuredValueSetMarker();
        getAspect().setSensitiveValueMarker(marker);

        String[] grants = {"tester", "insight"};
        Authentication token = new TestingAuthenticationToken("testObscuredCredentials", "omer", grants);
        AuthenticationProvider testProvider = new AuthenticationProviderCollectionAspectTestProvider(true);
View Full Code Here

TOP

Related Classes of com.springsource.insight.collection.ObscuredValueSetMarker

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.