Instrumental | beb6442 | 2019-01-03 11:27:13 -0600 | [diff] [blame] | 1 | .. This work is licensed under a Creative Commons Attribution 4.0 International License. |
| 2 | .. http://creativecommons.org/licenses/by/4.0 |
| 3 | .. Copyright © 2017 AT&T Intellectual Property. All rights reserved. |
| 4 | |
| 5 | CADI Architecture |
| 6 | ================= |
| 7 | |
| 8 | Authentication |
| 9 | -------------- |
| 10 | Realize that the main purpose of CADI in the authentication sphere is to identify first which Authentication scheme is being used. Therefore, when you’re debugging, you’ll find the terms “TAF” and “EpiTaf”. The first, just think of it as a pluggable Authentication Module, only one of which is Basic Auth. The others, in AT&T typically include “CSP Global Logon” and “X509 Certificates”. |
| 11 | |
| 12 | TAF - "Transmutative Authentication Framework", these are essentially plugable Authentication elements. Each is able |
| 13 | The “EpiTaf” is a pun, of course, but it’s software purpose is to run each Module against the incoming transaction. Each of which is a different scheme, and looks for different things. |
| 14 | |
| 15 | Reading the Security Info |
| 16 | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 17 | X509 – This checks the core HTTP stream to get a Client Certificate IF it is provided. If so, it validates that it is signed by a trusted source, and if so, extracts the entity encoded, and creates a Principal to add to HTTPServletRequest. |
| 18 | |
| 19 | Cookie (Pending Dublin)– This checks for a Cookie, and if present, decodes. If so, it creates a Principal to add to HTTPServletRequest… |
| 20 | |
| 21 | BasicAuth – This checks, as you see, the HTTP Servlet Header, but there are various permutations of exactly how it gets there, so there are, unfortunately, several paths that must be accommodated. One of which is the Caching… we don’t want to hit the DB or remote User/Password API (provided by the organization) for the same password over and over, so we need to cache the response, and if it matches exactly, then create the Principal, etc. |
| 22 | |
| 23 | Success for Authentication |
| 24 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 25 | |
| 26 | In "raw" Java, the responses can simply be read from the "TAF" (or "EpiTaf") being used. |
| 27 | |
| 28 | In J2EE, the "CADI Filter" will take positive Authentication and |
| 29 | # Associate the created Principal to the HTTPServletRequest (available as "getUserPrincipal()" |
| 30 | # Add the ability to do Cached Authorizations to HTTPServletRequest (available as "isUserInRole(String s)" (see Authorization Section) |
| 31 | # Send to next element in the Filter Chain |
| 32 | |
| 33 | Responding to Failed Authentication |
| 34 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 35 | Finding different kinds of Authentication Schemes and Protocols on an incoming transaction are the relatively easy parts. Responses are a bit harder. |
| 36 | |
| 37 | X509 – Just because the TLS doesn’t include a valid and TRUSTED X509 certificate, doesn’t mean it is actually an invalid client certificate and should be rejected. If you did, you would never actually try to find a BasicAuth “Authorization” header. The cert might be from 1 way TLS or 2-way TLS with a valid Client cert, just not one where we can derive the Organizational Identity. In this case, we let the other TAFs handle the return response. |
| 38 | |
| 39 | Cookies – Cookies are only designed to work with Browsers. The appropriate response is to redirect the browser to the Organization's SSO Logon Page, and type in your password on a form, this, of course, cannot be done by a App-to-Apps… Therefore, this is only sent back for Browsers. |
| 40 | |
| 41 | BasicAuth – the fallback for App-to-App or when nothing else applies. If all else fails, and there is either a bad password, or there is nothing else to try, we send back a 401. Again, the Cookie Logon “Browser Redirect” takes precedence for Browser traffic, but if Cookie TAF not included or it’s APP to APP, then 401 is returned. |
| 42 | |
| 43 | AAF is designed to cover Fine-Grained Authorization, meaning that the Authorizations provided are able to used an Application’s detailed authorizations, such as whether a user may be on a particular page, or has access to a particular Pub-SUB topic controlled within the App. |
| 44 | |
| 45 | This is a critical function for Cloud environments, as Services need to be able to be installed and running in a very short time, and should not be encumbered with local configurations of Users, Permissions and Passwords. |
| 46 | |
| 47 | To be effective during a computer transaction, Security must not only be secure, but very fast. Given that each transaction must be checked and validated for Authorization and Authentication, it is critical that all elements on this path perform optimally. |
| 48 | |
| 49 | Authorization |
| 50 | -------------- |
| 51 | |
| 52 | The parallel interface for Authorization Modules is the "LUR" (Localized User Repository). |
| 53 | |
| 54 | There are not typically use cases for defining more than one LUR source at a time, though it is possible. Caching, however, is still critical for overal System Performance. |
| 55 | |
| 56 | For J2EE, the typical access method is on the HttpServletRequest "boolean isUserInRole(String s)", however, when the LUR is AAF (standard usage), then the use of the call should be taken to mean "boolean doesUserHavePermission(String)". J2EE was created a long time ago before more Fine Grained Permission concepts. With AAF, you still make the call but pass in a single String Representation of the 3 part Permission concatenated with '|' sign. Example: |
| 57 | if(httpServletRequest.isUserInRole("org.onap.aai.access|*|read")) { |
| 58 | // Do something that requires this permission to function |
| 59 | |
| 60 | Used in this way, with the AAF LUR integrated in, you can easily perform cached Authorization checks on a variety of Permissions your Application has defined. |
| 61 | |
| 62 | Special Enforcement Point Case |
| 63 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 64 | |
| 65 | Typically, the CADI Filter's job is done when Authenticating and passing on to the next Filter. However, CADI also provides an API Enforcement Point, if configured. |
| 66 | |
| 67 | This Enforcement Point, if configured by the "cadi_api_enforcement" property, is also a Filter. It will use standard AAF Permissions to allow/disallow access up the filter chain based on the HTTP Path. This eliminates the need for engaging additional Authorization libraries, plugins, etc, and stick with highly efficient AAF model already in place. |
| 68 | |
| 69 | Example: |
| 70 | |
| 71 | HTTP Call GET /readX |
| 72 | |
| 73 | Given property "cadi_enforcement_point=org.onap.aai.api", and a permission "org.onap.aai.api|/readX|GET" defined in AAF, CADI will enforce that the incoming call must have been granted this permission before proceding to the remainder of the Servlet Code. |