{"id":5757,"date":"2015-08-11T14:05:43","date_gmt":"2015-08-11T14:05:43","guid":{"rendered":"https:\/\/9series-blog.staging9.com\/?p=5757"},"modified":"2026-03-03T10:42:55","modified_gmt":"2026-03-03T10:42:55","slug":"securing-web-services","status":"publish","type":"post","link":"https:\/\/www.9series.com\/blog\/securing-web-services\/","title":{"rendered":"Securing Web Services"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-681\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2015\/08\/Security2.jpg\" alt=\"Security\" width=\"900\" height=\"900\" \/><\/p>\n<p style=\"margin: 15px 0\">Nowadays almost all subsystem require to expose or consume data to\/from other subsystems &amp; yes, this is outside firewall or VPN. It can be other servers, mobile apps, wearable apps, IOT app or anything else. Exposing the data outside the network or cloud firewall is a very important decision. This became big responsibility for an organisation to make sure all data remain secure as well as rightly accessible. There are three aspects of security from WS point of view &#8211; message security, authentication and authorisation. In this article we will talk about first two. Let&#8217;s check some thoughts on these aspects.<\/p>\n<ul>\n<li><strong>1. Confidentiality<\/strong>-An approach to make sure all the communication remain confidential. Only client &amp; server should be aware with message content.\u00a0 There are multiple approaches at different level to maintain confidentiality.\n<ul>\n<li><strong>SSL<\/strong>&#8211; It will add first message level encryption by implementing the same. Implementing client key on WS client will ensure that only authorised client can make successful call to server. Client i.e. mobile client can load the security certificate in the payload. Server can be configured with the approach to not to accept any one who is not signed with right certificates. Only challenge in this approach is to securing client key. There are multiple ways to do that; but it is not focus area of this discussion.<\/li>\n<li><strong>Message Encryption<\/strong>&#8211; Apart from de-fecto SSL approach. There are multiple approaches to encrypt the message content. That depend on use case and type of data transported to or received from server. But most of the cases putting client side SSL will address the need.<\/li>\n<\/ul>\n<\/li>\n<li><strong>2. Authentication<\/strong>&#8211; It will very important to authenticate &amp; authorise the users for request coming from different machines. It can be normal day to day request or it would be simple brute force attack. It become quite interesting to make sure rightful authenticated request. Here are some abstract approach to start with.\n<ul>\n<li><strong>Basic Authentication<\/strong>&#8211; This is easiest and fundamental aspect to securing web services. A simple user name and password is put in HTTP header with Base64 encoding. SSL will make sure that; credentials wont be decoded.<\/li>\n<li><strong>Auth 1.0 or Auth 1.0a<\/strong>&#8211; This is signature based protocol. Token signed from client and shared to server will be decrypted and verified. Basically it is cryptographic signature. It may use SHA-256 etc.. This approach is well tested and widely used across the glob. By following this approach user can eliminate the need of SSL in first approach. However it comes with extra processing overhead of generate &amp; signing a key, along with complexity.<\/li>\n<li><strong>Auth 2.0<\/strong>&#8211; Auth 2.0 spec has kept many decision on implementor. This makes this approach diversified, flexible and of-course secure. Lots of tech pioneers i.e. Google, Facebook, Github adopted this approach. Many standard programming frameworks provides inbuilt Auth2.0 supports. In Auth2.0 control of authentication will completely reside on server, nothing is exposed to client except couple of parameters. That does not play significant role in authentication, compare to earlier approaches. Here are the steps for Auth2.0 authentication\n<ul>\n<li>Naming Convention- User &#8211; Resource Owner, API &#8211; Resource Server, Third Party App &#8211; Client. So process is , resource owner will try to access from resource server through client.<\/li>\n<li>Step 1 &#8211; Creating App &#8211; User need to register an app, as one time process, only basic information require to share i.e. Name, website, logo etc.. For custom restful development this step can be eliminated by hardcoded values.<\/li>\n<li>Step 2 &#8211; Requesting &#8211; when user make a request, it redirect to Auth2.0 server (or process), it do the redirection to different URL. It is advisable do to under SSL to prevent accessing direct authentication URL. This become very crucial for various DDOS attack for authentication to prevent accessing Auth URL.<\/li>\n<li>Step 3 &#8211; Authenticating &#8211; Auth2.0 server will verify few simple things i.e. Authorisation code, implicit (source i.e. Web, WS, Mobile etc.. ), user credentials, client credentials (application client key, if provided). These parameters are used and some of them can be optional.<\/li>\n<li>Step 4 &#8211; Response &#8211; Based on above parameters, a response can be generated. It return access status true\/ false and key for subsequent request for particular session.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Custom Authentication<\/strong>&#8211; There are multiple permutation and combination for authentication based on approaches or Auth 1.0a and Auth 2.0. We at 9series has observed and created many different such authentication mechanism.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Concluding above approach we think that SSL is fundamental need for any WS communication in confidentiality section. While Auth2.0 is widely used but many cases custom authentication is required.<\/p>\n<p>We at <a href=\"http:\/\/www.9series.com\/\">9series<\/a> believes that, every different use case have different need for security. As it require to match with organisation belief, thought process, policy &amp; compliance with legacy system. Security should not be strict to slow down the process or restrict required access, at the same time security should never be compromised. It is a combination of multiple thought process it start with common sense approach, comply with best practices and empowered from most secured algorithm.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nowadays almost all subsystem require to expose or consume data to\/from other subsystems &amp; yes, this is outside firewall or VPN. It can be other servers, mobile apps, wearable apps,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":5758,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"dsgo_overlay_header":false,"dsgo_overlay_header_text_color":"","dsgo_overlay_skip_top_bar":false,"_designsetgo_exclude_llms":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-5757","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/posts\/5757","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/comments?post=5757"}],"version-history":[{"count":1,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/posts\/5757\/revisions"}],"predecessor-version":[{"id":5759,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/posts\/5757\/revisions\/5759"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/media\/5758"}],"wp:attachment":[{"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/media?parent=5757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/categories?post=5757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/tags?post=5757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}