Package com.consol.citrus.ssh.server

Examples of com.consol.citrus.ssh.server.SinglePublicKeyAuthenticator.authenticate()


    @Test
    public void withClassPath() throws IOException {
        SinglePublicKeyAuthenticator auth = new SinglePublicKeyAuthenticator("roland","classpath:com/consol/citrus/ssh/allowed_test_key.pem");
        PublicKey pKey = getPublicKey("/com/consol/citrus/ssh/allowed_test_key.pem");
        assertTrue(auth.authenticate("roland", pKey, null));
        assertFalse(auth.authenticate("guenther",pKey,null));
        pKey = getPublicKey("/com/consol/citrus/ssh/forbidden_test_key.pem");
        assertFalse(auth.authenticate("roland",pKey,null));
    }
View Full Code Here


    @Test
    public void withClassPath() throws IOException {
        SinglePublicKeyAuthenticator auth = new SinglePublicKeyAuthenticator("roland","classpath:com/consol/citrus/ssh/allowed_test_key.pem");
        PublicKey pKey = getPublicKey("/com/consol/citrus/ssh/allowed_test_key.pem");
        assertTrue(auth.authenticate("roland", pKey, null));
        assertFalse(auth.authenticate("guenther",pKey,null));
        pKey = getPublicKey("/com/consol/citrus/ssh/forbidden_test_key.pem");
        assertFalse(auth.authenticate("roland",pKey,null));
    }

    @Test
View Full Code Here

        SinglePublicKeyAuthenticator auth = new SinglePublicKeyAuthenticator("roland","classpath:com/consol/citrus/ssh/allowed_test_key.pem");
        PublicKey pKey = getPublicKey("/com/consol/citrus/ssh/allowed_test_key.pem");
        assertTrue(auth.authenticate("roland", pKey, null));
        assertFalse(auth.authenticate("guenther",pKey,null));
        pKey = getPublicKey("/com/consol/citrus/ssh/forbidden_test_key.pem");
        assertFalse(auth.authenticate("roland",pKey,null));
    }

    @Test
    public void withFile() throws IOException {
        File temp = copyToTempFile("/com/consol/citrus/ssh/allowed_test_key.pem");
View Full Code Here

    @Test
    public void withFile() throws IOException {
        File temp = copyToTempFile("/com/consol/citrus/ssh/allowed_test_key.pem");
        SinglePublicKeyAuthenticator auth = new SinglePublicKeyAuthenticator("roland",temp.getAbsolutePath());
        PublicKey pKey = getPublicKeyFromStream(new FileInputStream(temp));
        assertTrue(auth.authenticate("roland", pKey, null));
        assertFalse(auth.authenticate("guenther",pKey,null));

        temp = copyToTempFile("/com/consol/citrus/ssh/forbidden_test_key.pem");
        pKey = getPublicKeyFromStream(new FileInputStream(temp));
        assertFalse(auth.authenticate("roland",pKey,null));
View Full Code Here

    public void withFile() throws IOException {
        File temp = copyToTempFile("/com/consol/citrus/ssh/allowed_test_key.pem");
        SinglePublicKeyAuthenticator auth = new SinglePublicKeyAuthenticator("roland",temp.getAbsolutePath());
        PublicKey pKey = getPublicKeyFromStream(new FileInputStream(temp));
        assertTrue(auth.authenticate("roland", pKey, null));
        assertFalse(auth.authenticate("guenther",pKey,null));

        temp = copyToTempFile("/com/consol/citrus/ssh/forbidden_test_key.pem");
        pKey = getPublicKeyFromStream(new FileInputStream(temp));
        assertFalse(auth.authenticate("roland",pKey,null));
    }
View Full Code Here

        assertTrue(auth.authenticate("roland", pKey, null));
        assertFalse(auth.authenticate("guenther",pKey,null));

        temp = copyToTempFile("/com/consol/citrus/ssh/forbidden_test_key.pem");
        pKey = getPublicKeyFromStream(new FileInputStream(temp));
        assertFalse(auth.authenticate("roland",pKey,null));
    }

    @Test(expectedExceptions = CitrusRuntimeException.class,expectedExceptionsMessageRegExp = ".*com/consol/citrus/ssh/citrus.pem.*")
    public void invalidKeyFormat() {
        new SinglePublicKeyAuthenticator("roland","classpath:com/consol/citrus/ssh/citrus.pem");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.