{"id":33630,"date":"2014-11-28T16:00:57","date_gmt":"2014-11-28T14:00:57","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=33630"},"modified":"2014-11-28T07:14:14","modified_gmt":"2014-11-28T05:14:14","slug":"testing-secured-ejbs-with-arquillian","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html","title":{"rendered":"Testing secured EJBs with Arquillian"},"content":{"rendered":"<p>Testing secured EJBs has been historically hard to get right. Up until now, I have been using proprietary techniques like <a href=\"https:\/\/github.com\/sfcoy\/demos\/blob\/master\/arquillian-security-demo\/src\/test\/java\/org\/jboss\/arquillian\/secureejb\/JBossLoginContextFactory.java\" target=\"_blank\">JBossLoginContextFactory<\/a> described in the article <a href=\"https:\/\/developer.jboss.org\/wiki\/TestingSecuredEJBsOnWildFly81xWithArquillian\" target=\"_blank\">Testing secured EJBs on WildFly 8.1.x with Arquillian<\/a> to test secured EJBs.<\/p>\n<p>During this year <a href=\"http:\/\/www.devoxx.be\/\" target=\"_blank\">Devoxx<\/a>, <a href=\"https:\/\/twitter.com\/dblevins\" target=\"_blank\">David Blevins<\/a>, founder of the <a href=\"http:\/\/tomee.apache.org\/\" target=\"_blank\">Apache TomEE<\/a> project \u2013 a lightweight Java EE Application Server, brought to my knowledge a little trick we can use to deal with Java EE security in a standard way that works across all Java EE compliant servers.<\/p>\n<p>The example used in this post is available at <a href=\"https:\/\/github.com\/javaee-testing\/security\" target=\"_blank\">javaee-testing\/security<\/a> on GitHub.<br \/>\n&nbsp;<\/p>\n<h2>The code<\/h2>\n<p>The code to test includes an entity and an EJB service as follows.<\/p>\n<h4>Book Entity<\/h4>\n<pre class=\" brush:java\">@Entity\r\npublic class Book {\r\n\r\n    @Id\r\n    @GeneratedValue(strategy = GenerationType.IDENTITY)\r\n    private Integer id;\r\n    private String isbn;\r\n    private String title;\r\n\r\n    public Book() {\r\n    }\r\n\r\n    public Book(String isbn, String title) {\r\n        this.isbn = isbn;\r\n        this.title = title;\r\n    }\r\n\r\n    \/\/ getters and setters omitted for brevity\r\n}<\/pre>\n<h4>Bookshelf EJB Service<\/h4>\n<pre class=\" brush:java\">@Stateless\r\npublic class BookshelfService {\r\n\r\n    @PersistenceContext(unitName = \"bookshelfManager\")\r\n    private EntityManager entityManager;\r\n\r\n    @RolesAllowed({ \"User\", \"Manager\" })\r\n    public void addBook(Book book) {\r\n        entityManager.persist(book);\r\n    }\r\n\r\n    @RolesAllowed({ \"Manager\" })\r\n    public void deleteBook(Book book) {\r\n        entityManager.remove(book);\r\n    }\r\n\r\n    @PermitAll\r\n    @TransactionAttribute(TransactionAttributeType.SUPPORTS)\r\n    public List&lt;Book&gt; getBooks() {\r\n        TypedQuery&lt;Book&gt; query = entityManager.createQuery(\"SELECT b from Book as b\", Book.class);\r\n        return query.getResultList();\r\n    }\r\n}<\/pre>\n<p>The test class uses <a href=\"http:\/\/arquillian.org\/\" target=\"_blank\">Arquillian<\/a> for the integration tests and asserts that the security roles defined on our EJB are respected.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h4>Bookshelf Service Tests<\/h4>\n<pre class=\" brush:java;wrap-lines:false\">@RunWith(Arquillian.class)\r\npublic class BookshelfServiceIT {\r\n\r\n    @Inject\r\n    private BookshelfService bookshelfService;\r\n    @Inject\r\n    private BookshelfManager manager;\r\n    @Inject\r\n    private BookshelfUser user;\r\n\r\n    @Deployment\r\n    public static JavaArchive createDeployment() throws IOException {\r\n        return ShrinkWrap.create(JavaArchive.class, \"javaee-testing-security.jar\")\r\n                .addClasses(Book.class, BookshelfService.class, BookshelfManager.class, BookshelfUser.class)\r\n                .addAsManifestResource(\"META-INF\/persistence.xml\", \"persistence.xml\")\r\n                .addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create(\"beans.xml\"));\r\n    }\r\n\r\n    @Test\r\n    public void testAsManager() throws Exception {\r\n        manager.call(new Callable&lt;Book&gt;() {\r\n            @Override\r\n            public Book call() throws Exception {\r\n                bookshelfService.addBook(new Book(\"978-1-4302-4626-8\", \"Beginning Java EE 7\"));\r\n                bookshelfService.addBook(new Book(\"978-1-4493-2829-0\", \"Continuous Enterprise Development in Java\"));\r\n\r\n                List&lt;Book&gt; books = bookshelfService.getBooks();\r\n                Assert.assertEquals(\"List.size()\", 2, books.size());\r\n\r\n                for (Book book : books) {\r\n                    bookshelfService.deleteBook(book);\r\n                }\r\n\r\n                Assert.assertEquals(\"BookshelfService.getBooks()\", 0, bookshelfService.getBooks().size());\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n\r\n    @Test\r\n    public void testAsUser() throws Exception {\r\n        user.call(new Callable&lt;Book&gt;() {\r\n            @Override\r\n            public Book call() throws Exception {\r\n                bookshelfService.addBook(new Book(\"978-1-4302-4626-8\", \"Beginning Java EE 7\"));\r\n                bookshelfService.addBook(new Book(\"978-1-4493-2829-0\", \"Continuous Enterprise Development in Java\"));\r\n\r\n                List&lt;Book&gt; books = bookshelfService.getBooks();\r\n                Assert.assertEquals(\"List.size()\", 2, books.size());\r\n\r\n                for (Book book : books) {\r\n                    try {\r\n                        bookshelfService.deleteBook(book);\r\n                        Assert.fail(\"Users should not be allowed to delete\");\r\n                    } catch (EJBAccessException e) {\r\n                        \/\/ Good, users cannot delete things\r\n                    }\r\n                }\r\n\r\n                \/\/ The list should not be empty\r\n                Assert.assertEquals(\"BookshelfService.getBooks()\", 2, bookshelfService.getBooks().size());\r\n                return null;\r\n            }\r\n        });\r\n    }\r\n\r\n    @Test\r\n    public void testUnauthenticated() throws Exception {\r\n        try {\r\n            bookshelfService.addBook(new Book(\"978-1-4302-4626-8\", \"Beginning Java EE 7\"));\r\n            Assert.fail(\"Unauthenticated users should not be able to add books\");\r\n        } catch (EJBAccessException e) {\r\n            \/\/ Good, unauthenticated users cannot add things\r\n        }\r\n\r\n        try {\r\n            bookshelfService.deleteBook(null);\r\n            Assert.fail(\"Unauthenticated users should not be allowed to delete\");\r\n        } catch (EJBAccessException e) {\r\n            \/\/ Good, unauthenticated users cannot delete things\r\n        }\r\n\r\n        try {\r\n            \/\/ Read access should be allowed\r\n            List&lt;Book&gt; books = bookshelfService.getBooks();\r\n            Assert.assertEquals(\"BookshelfService.getBooks()\", 0, books.size());\r\n        } catch (EJBAccessException e) {\r\n            Assert.fail(\"Read access should be allowed\");\r\n        }\r\n    }\r\n}<\/pre>\n<p>The trick is on two helper EJBs which allow our test code to execute in the desired security scope by using the <code>@RunAs<\/code> standard annotation.<\/p>\n<h4>Bookshelf Manager role<\/h4>\n<pre class=\" brush:java\">@Stateless\r\n@RunAs(\"Manager\")\r\n@PermitAll\r\npublic class BookshelfManager {\r\n    public &lt;V&gt; V call(Callable&lt;V&gt; callable) throws Exception {\r\n        return callable.call();\r\n    }\r\n}<\/pre>\n<h4>Bookshelf User role<\/h4>\n<pre class=\" brush:java\">@Stateless\r\n@RunAs(\"User\")\r\n@PermitAll\r\npublic class BookshelfUser {\r\n    public &lt;V&gt; V call(Callable&lt;V&gt; callable) throws Exception {\r\n        return callable.call();\r\n    }\r\n}<\/pre>\n<h2>Running<\/h2>\n<pre class=\" brush:bash;wrap-lines:false\">-------------------------------------------------------\r\n T E S T S\r\n-------------------------------------------------------\r\nRunning com.samaxes.javaeetesting.security.BookshelfServiceIT\r\nnov 23, 2014 2:44:48 AM org.xnio.Xnio &lt;clinit&gt;\r\nINFO: XNIO version 3.2.0.Beta4\r\nnov 23, 2014 2:44:48 AM org.xnio.nio.NioXnio &lt;clinit&gt;\r\nINFO: XNIO NIO Implementation Version 3.2.0.Beta4\r\nnov 23, 2014 2:44:49 AM org.jboss.remoting3.EndpointImpl &lt;clinit&gt;\r\nINFO: JBoss Remoting version (unknown)\r\nTests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 36.69 sec - in com.samaxes.javaeetesting.security.BookshelfServiceIT\r\n\r\nResults :\r\n\r\nTests run: 3, Failures: 0, Errors: 0, Skipped: 0<\/pre>\n<p>Happy tests!<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/www.samaxes.com\/2014\/11\/test-javaee-security-with-arquillian\/\">Testing secured EJBs with Arquillian<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/jcg\/\">JCG partner<\/a> Samuel Santos at the <a href=\"http:\/\/www.samaxes.com\/\">Samaxes<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Testing secured EJBs has been historically hard to get right. Up until now, I have been using proprietary techniques like JBossLoginContextFactory described in the article Testing secured EJBs on WildFly 8.1.x with Arquillian to test secured EJBs. During this year Devoxx, David Blevins, founder of the Apache TomEE project \u2013 a lightweight Java EE Application &hellip;<\/p>\n","protected":false},"author":228,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[1040],"class_list":["post-33630","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-jboss-arquillian"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Testing secured EJBs with Arquillian<\/title>\n<meta name=\"description\" content=\"Testing secured EJBs has been historically hard to get right. Up until now, I have been using proprietary techniques like JBossLoginContextFactory\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Testing secured EJBs with Arquillian\" \/>\n<meta property=\"og:description\" content=\"Testing secured EJBs has been historically hard to get right. Up until now, I have been using proprietary techniques like JBossLoginContextFactory\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2014-11-28T14:00:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Samuel Santos\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/samaxes\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Samuel Santos\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/11\\\/testing-secured-ejbs-with-arquillian.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/11\\\/testing-secured-ejbs-with-arquillian.html\"},\"author\":{\"name\":\"Samuel Santos\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cd56a59549f8c033272e083db1e9c216\"},\"headline\":\"Testing secured EJBs with Arquillian\",\"datePublished\":\"2014-11-28T14:00:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/11\\\/testing-secured-ejbs-with-arquillian.html\"},\"wordCount\":195,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/11\\\/testing-secured-ejbs-with-arquillian.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"JBoss Arquillian\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/11\\\/testing-secured-ejbs-with-arquillian.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/11\\\/testing-secured-ejbs-with-arquillian.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/11\\\/testing-secured-ejbs-with-arquillian.html\",\"name\":\"Testing secured EJBs with Arquillian\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/11\\\/testing-secured-ejbs-with-arquillian.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/11\\\/testing-secured-ejbs-with-arquillian.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2014-11-28T14:00:57+00:00\",\"description\":\"Testing secured EJBs has been historically hard to get right. Up until now, I have been using proprietary techniques like JBossLoginContextFactory\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/11\\\/testing-secured-ejbs-with-arquillian.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/11\\\/testing-secured-ejbs-with-arquillian.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/11\\\/testing-secured-ejbs-with-arquillian.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/11\\\/testing-secured-ejbs-with-arquillian.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Testing secured EJBs with Arquillian\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cd56a59549f8c033272e083db1e9c216\",\"name\":\"Samuel Santos\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b6c5678bb5209583d05b239c02310b8d782188cbae9cff83b0e78e3f1f0e69fc?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b6c5678bb5209583d05b239c02310b8d782188cbae9cff83b0e78e3f1f0e69fc?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b6c5678bb5209583d05b239c02310b8d782188cbae9cff83b0e78e3f1f0e69fc?s=96&d=mm&r=g\",\"caption\":\"Samuel Santos\"},\"description\":\"Java and Open Source evangelist, JUG leader and Web advocate for web standards and semantic technologies.\",\"sameAs\":[\"http:\\\/\\\/www.samaxes.com\\\/\",\"http:\\\/\\\/www.linkedin.com\\\/in\\\/samaxes\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/samaxes\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Samuel-Santos\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Testing secured EJBs with Arquillian","description":"Testing secured EJBs has been historically hard to get right. Up until now, I have been using proprietary techniques like JBossLoginContextFactory","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html","og_locale":"en_US","og_type":"article","og_title":"Testing secured EJBs with Arquillian","og_description":"Testing secured EJBs has been historically hard to get right. Up until now, I have been using proprietary techniques like JBossLoginContextFactory","og_url":"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2014-11-28T14:00:57+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Samuel Santos","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/samaxes","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Samuel Santos","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html"},"author":{"name":"Samuel Santos","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cd56a59549f8c033272e083db1e9c216"},"headline":"Testing secured EJBs with Arquillian","datePublished":"2014-11-28T14:00:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html"},"wordCount":195,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["JBoss Arquillian"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html","url":"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html","name":"Testing secured EJBs with Arquillian","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2014-11-28T14:00:57+00:00","description":"Testing secured EJBs has been historically hard to get right. Up until now, I have been using proprietary techniques like JBossLoginContextFactory","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2014\/11\/testing-secured-ejbs-with-arquillian.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Testing secured EJBs with Arquillian"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cd56a59549f8c033272e083db1e9c216","name":"Samuel Santos","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b6c5678bb5209583d05b239c02310b8d782188cbae9cff83b0e78e3f1f0e69fc?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b6c5678bb5209583d05b239c02310b8d782188cbae9cff83b0e78e3f1f0e69fc?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b6c5678bb5209583d05b239c02310b8d782188cbae9cff83b0e78e3f1f0e69fc?s=96&d=mm&r=g","caption":"Samuel Santos"},"description":"Java and Open Source evangelist, JUG leader and Web advocate for web standards and semantic technologies.","sameAs":["http:\/\/www.samaxes.com\/","http:\/\/www.linkedin.com\/in\/samaxes","https:\/\/x.com\/https:\/\/twitter.com\/samaxes"],"url":"https:\/\/www.javacodegeeks.com\/author\/Samuel-Santos"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/33630","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/228"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=33630"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/33630\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=33630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=33630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=33630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}