{"id":1351,"date":"2012-06-22T22:00:00","date_gmt":"2012-06-22T22:00:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/2012\/10\/servlet-basic-auth-in-an-osgi-environment.html"},"modified":"2013-04-23T10:15:03","modified_gmt":"2013-04-23T07:15:03","slug":"servlet-basic-auth-in-osgi-environment","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.html","title":{"rendered":"Servlet Basic Auth in an OSGi environment"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left\">You will first need to get a reference to the <a href=\"http:\/\/www.osgi.org\/javadoc\/r4v42\/org\/osgi\/service\/http\/HttpService.html\">OSGI HTTP Service<\/a>. You can do this through a <a href=\"http:\/\/eclipsesource.com\/blogs\/2009\/05\/12\/osgi-declarative-services\/\">declarative service<\/a>. This post will concentrate on steps after getting a reference to the HTTP Service. Note: The complete class for this post is located <a href=\"https:\/\/gist.github.com\/2876361\">here<\/a><br \/>\nWhen registering a servlet through the OSGI HTTP Service, it provides you with an option to provide an implementation of HTTPContext.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<pre class=\"brush:java\">httpService.registerServlet(alias, new MyServlet(), initParams, null);\r\n<\/pre>\n<p>When we implement the HTTPContext interface we can implement three methods. Out of these three (3) handleSecurity will be called before serving a request to ermmm\u2026 check for security.         <\/p>\n<pre class=\"brush:java\">public class BasicAuthSecuredContext implements HttpContext{\r\n    @Override\r\n    public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {\r\n        return false;\r\n    }\r\n\r\n    @Override\r\n    public URL getResource(String s) {\r\n        return null;  \r\n    }\r\n\r\n    @Override\r\n    public String getMimeType(String s) {\r\n        return null;\r\n    }\r\n}\r\n<\/pre>\n<p>So, when implementing this, I\u2019m borrowing a lot of content from the <a href=\"http:\/\/www.osgi.org\/javadoc\/r4v42\/org\/osgi\/service\/http\/HttpContext.html\">OSGI HTTPContext documentation<\/a> and the <a href=\"http:\/\/www.ietf.org\/rfc\/rfc2617.txt\">HTTP Authentication spec<\/a>. They are a must read, if you are interested in learning a lot, diving into details, etc. or you can just read the rest of this post.         <div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>First, it is a big no-no to do basic auth unless https is used. If it\u2019s not there we let the user know it\u2019s forbidden territory. Let\u2019s go ahead and do that.          <\/p>\n<pre class=\"brush:java\">if (!request.getScheme().equals(\"https\")) {\r\n    response.sendError(HttpServletResponse.SC_FORBIDDEN);\r\n    return false;\r\n}\r\n<\/pre>\n<p>Next, let\u2019s check for the Authorization header. If that\u2019s not there we let them know, they need that shit to be there. Or we just say they\u2019re unauthorized. Let\u2019s do that now.         <\/p>\n<pre class=\"brush:java\">if (request.getHeader(\"Authorization\") == null) {\r\n            response.sendError(HttpServletResponse.SC_UNAUTHORIZED);\r\n            return false;\r\n}\r\n<\/pre>\n<p>Ok, two tests passed. Now, we do some real work. Let\u2019s extract the header decode it, and do \u201cnot so proper\u201d authentication.         <\/p>\n<pre class=\"brush:java\">    protected boolean authenticated(HttpServletRequest request) {\r\n        String authzHeader = request.getHeader(\"Authorization\");\r\n        String usernameAndPassword = new String(Base64.decodeBase64(authzHeader.substring(6).getBytes()));\r\n\r\n        int userNameIndex = usernameAndPassword.indexOf(\":\");\r\n        String username = usernameAndPassword.substring(0, userNameIndex);\r\n        String password = usernameAndPassword.substring(userNameIndex + 1);\r\n        \/\/ Now, do the authentication against in the way you want, ex: ldap, db stored uname\/pw\r\n        \/\/ Here I will do lame hard coded credential check. HIGHLY NOT RECOMMENDED! \r\n        return ((username.equals(\"username\") &amp;&amp; password.equals(\"password\"));\r\n    }\r\n<\/pre>\n<p>Let\u2019s integrate this method, into the <code>handleSecurity<\/code> method. Notice how a meaningful error message is set to the response (line 14) when the security fails. This prevents the user from guessing, and they knows what exactly went wrong. Ermm, at least, if they know HTTP error codes they would know exactly what went wrong.         <\/p>\n<pre class=\"brush:java\">    @Override\r\n    public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {\r\n        if (!request.getScheme().equals(\"https\")) {\r\n            response.sendError(HttpServletResponse.SC_FORBIDDEN);\r\n            return false;\r\n        }\r\n        if (request.getHeader(\"Authorization\") == null) {\r\n            response.sendError(HttpServletResponse.SC_UNAUTHORIZED);\r\n            return false;\r\n        }\r\n        if (authenticated(request)) {\r\n            return true;\r\n        } else {\r\n            response.sendError(HttpServletResponse.SC_UNAUTHORIZED);\r\n            return false;\r\n        }\r\n    }\r\n<\/pre>\n<p>That\u2019s it. Now, pass this object when registering the servlet,          <\/p>\n<pre class=\"brush:java\">httpService.registerServlet(alias, new MyServlet(), initParams, new BasicAuthSecuredContext());\r\n<\/pre>\n<p>\u2026and behold the power of basic auth in OSGI servlets!  <\/p>\n<p><strong><i>Reference: <\/i><\/strong><a href=\"http:\/\/mackiemathew.com\/2012\/06\/05\/implementing-basic-auth-for-a-servlet-in-an-osgi-environment\/\">Implementing Basic Auth for a servlet in an OSGI environment <\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Mackie Mathew at the <a href=\"http:\/\/mackiemathew.com\/\">dev_religion<\/a> blog.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>You will first need to get a reference to the OSGI HTTP Service. You can do this through a declarative service. This post will concentrate on steps after getting a reference to the HTTP Service. Note: The complete class for this post is located here When registering a servlet through the OSGI HTTP Service, it &hellip;<\/p>\n","protected":false},"author":163,"featured_media":211,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[190,297],"class_list":["post-1351","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-osgi","tag-security"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Servlet Basic Auth in an OSGi environment - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"You will first need to get a reference to the OSGI HTTP Service. You can do this through a declarative service. This post will concentrate on steps after\" \/>\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\/2012\/06\/servlet-basic-auth-in-osgi-environment.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Servlet Basic Auth in an OSGi environment - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"You will first need to get a reference to the OSGI HTTP Service. You can do this through a declarative service. This post will concentrate on steps after\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.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=\"2012-06-22T22:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-04-23T07:15:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/osgi-alliance-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=\"Mackie Mathew\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mackie Mathew\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/servlet-basic-auth-in-osgi-environment.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/servlet-basic-auth-in-osgi-environment.html\"},\"author\":{\"name\":\"Mackie Mathew\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/40f71066ffb475bd0c9a2edd124f8a78\"},\"headline\":\"Servlet Basic Auth in an OSGi environment\",\"datePublished\":\"2012-06-22T22:00:00+00:00\",\"dateModified\":\"2013-04-23T07:15:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/servlet-basic-auth-in-osgi-environment.html\"},\"wordCount\":345,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/servlet-basic-auth-in-osgi-environment.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/osgi-alliance-logo.jpg\",\"keywords\":[\"OSGi\",\"Security\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/servlet-basic-auth-in-osgi-environment.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/servlet-basic-auth-in-osgi-environment.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/servlet-basic-auth-in-osgi-environment.html\",\"name\":\"Servlet Basic Auth in an OSGi environment - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/servlet-basic-auth-in-osgi-environment.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/servlet-basic-auth-in-osgi-environment.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/osgi-alliance-logo.jpg\",\"datePublished\":\"2012-06-22T22:00:00+00:00\",\"dateModified\":\"2013-04-23T07:15:03+00:00\",\"description\":\"You will first need to get a reference to the OSGI HTTP Service. You can do this through a declarative service. This post will concentrate on steps after\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/servlet-basic-auth-in-osgi-environment.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/servlet-basic-auth-in-osgi-environment.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/servlet-basic-auth-in-osgi-environment.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/osgi-alliance-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/osgi-alliance-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/servlet-basic-auth-in-osgi-environment.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\":\"Servlet Basic Auth in an OSGi environment\"}]},{\"@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\\\/40f71066ffb475bd0c9a2edd124f8a78\",\"name\":\"Mackie Mathew\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8900122b4492a9508d48401d70fbfea977271511e26a45f017002668b04c0078?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8900122b4492a9508d48401d70fbfea977271511e26a45f017002668b04c0078?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8900122b4492a9508d48401d70fbfea977271511e26a45f017002668b04c0078?s=96&d=mm&r=g\",\"caption\":\"Mackie Mathew\"},\"sameAs\":[\"http:\\\/\\\/mackiemathew.com\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Mackie-Mathew\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Servlet Basic Auth in an OSGi environment - Java Code Geeks","description":"You will first need to get a reference to the OSGI HTTP Service. You can do this through a declarative service. This post will concentrate on steps after","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\/2012\/06\/servlet-basic-auth-in-osgi-environment.html","og_locale":"en_US","og_type":"article","og_title":"Servlet Basic Auth in an OSGi environment - Java Code Geeks","og_description":"You will first need to get a reference to the OSGI HTTP Service. You can do this through a declarative service. This post will concentrate on steps after","og_url":"https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2012-06-22T22:00:00+00:00","article_modified_time":"2013-04-23T07:15:03+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/osgi-alliance-logo.jpg","type":"image\/jpeg"}],"author":"Mackie Mathew","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Mackie Mathew","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.html"},"author":{"name":"Mackie Mathew","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/40f71066ffb475bd0c9a2edd124f8a78"},"headline":"Servlet Basic Auth in an OSGi environment","datePublished":"2012-06-22T22:00:00+00:00","dateModified":"2013-04-23T07:15:03+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.html"},"wordCount":345,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/osgi-alliance-logo.jpg","keywords":["OSGi","Security"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.html","url":"https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.html","name":"Servlet Basic Auth in an OSGi environment - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/osgi-alliance-logo.jpg","datePublished":"2012-06-22T22:00:00+00:00","dateModified":"2013-04-23T07:15:03+00:00","description":"You will first need to get a reference to the OSGI HTTP Service. You can do this through a declarative service. This post will concentrate on steps after","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/osgi-alliance-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/osgi-alliance-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/servlet-basic-auth-in-osgi-environment.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":"Servlet Basic Auth in an OSGi environment"}]},{"@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\/40f71066ffb475bd0c9a2edd124f8a78","name":"Mackie Mathew","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8900122b4492a9508d48401d70fbfea977271511e26a45f017002668b04c0078?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8900122b4492a9508d48401d70fbfea977271511e26a45f017002668b04c0078?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8900122b4492a9508d48401d70fbfea977271511e26a45f017002668b04c0078?s=96&d=mm&r=g","caption":"Mackie Mathew"},"sameAs":["http:\/\/mackiemathew.com\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/Mackie-Mathew"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1351","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\/163"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=1351"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1351\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/211"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=1351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=1351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=1351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}