Package org.apache.cxf.systest.jaxrs.security

Examples of org.apache.cxf.systest.jaxrs.security.Book


    public void testPostBookUserRole() throws Exception {
        String address = "https://localhost:" + PORT + "/saml-roles/bookstore/books";
        WebClient wc = createWebClient(address, null);
        wc.type(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_XML);
        try {
            wc.post(new Book("CXF", 125L), Book.class);
            fail("403 is expected");
        } catch (ServerWebApplicationException ex) {
            assertEquals(403, ex.getStatus());
        }
    }
View Full Code Here


        String address = "https://localhost:" + PORT + "/saml-roles/bookstore/books";
        WebClient wc = createWebClient(address,
                                       Collections.<String, Object>singletonMap("saml.roles",
                                       Collections.singletonList("admin")));
        wc.type(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_XML);
        Book book = wc.post(new Book("CXF", 125L), Book.class);               
        assertEquals(125L, book.getId());
    }
View Full Code Here

        WebClient wc = createWebClient(address,
                                       Collections.<String, Object>singletonMap("saml.roles",
                                        Collections.singletonList("admin")));
        wc.type(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_XML);
        try {
            wc.post(new Book("CXF", 125L), Book.class);               
            fail("403 is expected");
        } catch (ServerWebApplicationException ex) {
            assertEquals(403, ex.getStatus());
        }
    }
View Full Code Here

        Map<String, Object> props = new HashMap<String, Object>();
        props.put("saml.roles", Collections.singletonList("admin"));
        props.put("saml.subject.name", "bob@mycompany.com");
        WebClient wc = createWebClient(address, props);
        wc.type(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_XML);
        Book book = wc.post(new Book("CXF", 125L), Book.class);               
        assertEquals(125L, book.getId());
    }
View Full Code Here

        Map<String, Object> props = new HashMap<String, Object>();
        WebClient wc = createWebClient(address, props);
        wc.type(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_XML);
        try {
            wc.post(new Book("CXF", 125L), Book.class);               
            fail("403 is expected");
        } catch (ServerWebApplicationException ex) {
            assertEquals(403, ex.getStatus());
        }
    }
View Full Code Here

        props.put("saml.roles", Collections.singletonList("admin"));
        props.put("saml.auth", Collections.singletonList("password"));
        WebClient wc = createWebClient(address, props);
        wc.type(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_XML);
        try {
            wc.post(new Book("CXF", 125L), Book.class);               
            fail("403 is expected");
        } catch (ServerWebApplicationException ex) {
            assertEquals(403, ex.getStatus());
        }
    }
View Full Code Here

        Map<String, Object> props = new HashMap<String, Object>();
        props.put("saml.roles", Collections.singletonList("admin"));
        props.put("saml.auth", Collections.singletonList("smartcard"));
        WebClient wc = createWebClient(address, props);
        wc.type(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_XML);
        Book book = wc.post(new Book("CXF", 125L), Book.class);               
        assertEquals(125L, book.getId());
    }
View Full Code Here

        bean.getOutInterceptors().add(sigInterceptor);
        bean.setServiceClass(BookStore.class);
       
        BookStore store = bean.create(BookStore.class);
        try {
            Book book = store.addBook(new Book("CXF", 126L));
            assertEquals(126L, book.getId());
        } catch (ServerWebApplicationException ex) {
            fail(ex.getMessage());
        } catch (ClientWebApplicationException ex) {
            if (ex.getCause() != null && ex.getCause().getMessage() != null) {
                fail(ex.getCause().getMessage());
View Full Code Here

        bean.getOutInterceptors().add(sigInterceptor);
        bean.getInInterceptors().add(new XmlSigInInterceptor());
       
        WebClient wc = bean.createWebClient();
        try {
            Book book = wc.post(new Book("CXF", 126L), Book.class);
            assertEquals(126L, book.getId());
        } catch (ServerWebApplicationException ex) {
            fail(ex.getMessage());
        } catch (ClientWebApplicationException ex) {
            if (ex.getCause() != null && ex.getCause().getMessage() != null) {
                fail(ex.getCause().getMessage());
View Full Code Here

       
       
        WebClient wc = bean.createWebClient();
        WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(10000000L);
        try {
            Book book = wc.post(new Book("CXF", 126L), Book.class);
            assertEquals(126L, book.getId());
        } catch (ServerWebApplicationException ex) {
            if (propagateException) {
                throw ex;
            } else {
                fail(ex.getMessage());
View Full Code Here

TOP

Related Classes of org.apache.cxf.systest.jaxrs.security.Book

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.