Examples of ChallengeResponse


Examples of org.restlet.data.ChallengeResponse

    public void HTTPBasicLong() throws Exception {
        final Request request = new Request(Method.GET, this.uri);
        final Client client = new Client(Protocol.HTTP);

        final ChallengeResponse authentication = new ChallengeResponse(
                ChallengeScheme.HTTP_BASIC, LONG_USERNAME, LONG_PASSWORD);
        request.setChallengeResponse(authentication);

        final Response response = client.handle(request);
        assertEquals("Long username did not return 200 OK", Status.SUCCESS_OK,
View Full Code Here

Examples of org.restlet.data.ChallengeResponse

    public void HTTPBasicLongWrong() throws Exception {
        final Request request = new Request(Method.GET, this.uri);
        final Client client = new Client(Protocol.HTTP);

        final ChallengeResponse authentication = new ChallengeResponse(
                ChallengeScheme.HTTP_BASIC, LONG_USERNAME, SHORT_PASSWORD);
        request.setChallengeResponse(authentication);

        final Response response = client.handle(request);
View Full Code Here

Examples of org.restlet.data.ChallengeResponse

    public void HTTPBasicShort() throws Exception {
        final Request request = new Request(Method.GET, this.uri);
        final Client client = new Client(Protocol.HTTP);

        final ChallengeResponse authentication = new ChallengeResponse(
                ChallengeScheme.HTTP_BASIC, SHORT_USERNAME, SHORT_PASSWORD);
        request.setChallengeResponse(authentication);

        final Response response = client.handle(request);
        assertEquals("Short username did not return 200 OK", Status.SUCCESS_OK,
View Full Code Here

Examples of org.restlet.data.ChallengeResponse

    public void HTTPBasicShortWrong() throws Exception {
        final Request request = new Request(Method.GET, this.uri);
        final Client client = new Client(Protocol.HTTP);

        final ChallengeResponse authentication = new ChallengeResponse(
                ChallengeScheme.HTTP_BASIC, SHORT_USERNAME, LONG_PASSWORD);
        request.setChallengeResponse(authentication);

        final Response response = client.handle(request);
View Full Code Here

Examples of org.restlet.data.ChallengeResponse

    public void HTTPBasicWrongUser() throws Exception {
        final Request request = new Request(Method.GET, this.uri);
        final Client client = new Client(Protocol.HTTP);

        final ChallengeResponse authentication = new ChallengeResponse(
                ChallengeScheme.HTTP_BASIC, WRONG_USERNAME, SHORT_PASSWORD);
        request.setChallengeResponse(authentication);

        final Response response = client.handle(request);
View Full Code Here

Examples of org.restlet.data.ChallengeResponse

            }
            resource.release();
            assertEquals(Status.CLIENT_ERROR_UNAUTHORIZED, resource.getStatus());

            // Try with authentication
            resource.setChallengeResponse(new ChallengeResponse(
                    ChallengeScheme.HTTP_BASIC, "stiger", "pwd"));
            try {
                resource.get();
            } catch (ResourceException e) {
            }
            resource.release();
            assertEquals(Status.SUCCESS_OK, resource.getStatus());

            // TEST SERIES 2
            uri = "http://localhost:" + TEST_PORT + "/test2";
            resource = new ClientResource(uri);
            try {
                resource.get();
            } catch (ResourceException e) {
            }
            resource.release();
            assertEquals(Status.SUCCESS_OK, resource.getStatus());

            // TEST SERIES 3
            uri = "http://localhost:" + TEST_PORT + "/test3";
            resource = new ClientResource(uri);
            try {
                resource.get();
            } catch (ResourceException e) {
            }
            resource.release();
            assertEquals(Status.CLIENT_ERROR_FORBIDDEN, resource.getStatus());

            // TEST SERIES 4
            uri = "http://localhost:" + TEST_PORT + "/test4";
            resource = new ClientResource(uri);
            resource.setChallengeResponse(new ChallengeResponse(
                    ChallengeScheme.HTTP_BASIC, "stiger", "pwd"));
            try {
                resource.get();
            } catch (ResourceException e) {
            }
            resource.release();
            assertEquals(Status.CLIENT_ERROR_FORBIDDEN, resource.getStatus());

            // Try again with another user
            resource.setChallengeResponse(new ChallengeResponse(
                    ChallengeScheme.HTTP_BASIC, "larmstrong", "pwd"));
            try {
                resource.get();
            } catch (ResourceException e) {
            }
            resource.release();
            assertEquals(Status.SUCCESS_OK, resource.getStatus());

            // TEST SERIES 5
            uri = "http://localhost:" + TEST_PORT + "/test5";
            resource = new ClientResource(uri);
            resource.setChallengeResponse(new ChallengeResponse(
                    ChallengeScheme.HTTP_BASIC, "stiger", "pwd"));
            try {
                resource.get();
            } catch (ResourceException e) {
            }
            resource.release();
            assertEquals(Status.SUCCESS_OK, resource.getStatus());

            // Try again with another user
            resource.setChallengeResponse(new ChallengeResponse(
                    ChallengeScheme.HTTP_BASIC, "larmstrong", "pwd"));
            try {
                resource.get();
            } catch (ResourceException e) {
            }
View Full Code Here

Examples of org.restlet.data.ChallengeResponse

                    .println("You need to pass your del.icio.us user name and password");
        } else {
            // Create a authenticated request
            ClientResource resource = new ClientResource(
                    "https://api.del.icio.us/v1/posts/recent");
            resource.setChallengeResponse(new ChallengeResponse(
                    ChallengeScheme.HTTP_BASIC, args[0], args[1]));

            // Fetch a resource: an XML document with your recent posts
            Representation entity = resource.get();
            DomRepresentation document = new DomRepresentation(entity);
View Full Code Here

Examples of org.restlet.data.ChallengeResponse

    public void testPop() throws Exception {
        final Client client = new Client(Protocol.POP);
        client.getContext().getParameters().add("debug", DEBUG);

        Request request = new Request(Method.GET, YAHOO_POP);
        final ChallengeResponse challengeResponse = new ChallengeResponse(
                ChallengeScheme.POP_BASIC, YAHOO_ID, YAHOO_PASSWORD);

        request.setChallengeResponse(challengeResponse);

        Response response = client.handle(request);
View Full Code Here

Examples of org.restlet.data.ChallengeResponse

        final Client client = new Client(Protocol.POPS);
        client.getContext().getParameters().add("debug", DEBUG);

        final String baseUri = NOELIOS_POPS;
        final Request request = new Request(Method.GET, baseUri);
        request.setChallengeResponse(new ChallengeResponse(
                ChallengeScheme.POP_BASIC, NOELIOS_LOGIN, NOELIOS_PASSWORD));

        final Response response = client.handle(request);
        assertEquals(Status.SUCCESS_OK, response.getStatus());
        response.getEntity().write(System.out);
View Full Code Here

Examples of org.restlet.data.ChallengeResponse

        client.stop();
    }

    public void testSmtp() throws Exception {
        final Request request = new Request(Method.POST, YAHOO_SMTP);
        request.setChallengeResponse(new ChallengeResponse(
                ChallengeScheme.SMTP_PLAIN, YAHOO_ID, YAHOO_PASSWORD));
        sendMail(Protocol.SMTP, request, false);
    }
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.