<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aldo Ambrosioni on Medium]]></title>
        <description><![CDATA[Stories by Aldo Ambrosioni on Medium]]></description>
        <link>https://medium.com/@aldoontech?source=rss-ff8b52b02af7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rgwnRZZY3vXD40kibRaoxg.jpeg</url>
            <title>Stories by Aldo Ambrosioni on Medium</title>
            <link>https://medium.com/@aldoontech?source=rss-ff8b52b02af7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 10:52:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aldoontech/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The right place for your data]]></title>
            <link>https://aldoontech.medium.com/the-right-place-for-your-data-8af971c299b6?source=rss-ff8b52b02af7------2</link>
            <guid isPermaLink="false">https://medium.com/p/8af971c299b6</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[nosql]]></category>
            <dc:creator><![CDATA[Aldo Ambrosioni]]></dc:creator>
            <pubDate>Mon, 18 Jan 2021 17:26:15 GMT</pubDate>
            <atom:updated>2021-03-04T20:07:07.169Z</atom:updated>
            <content:encoded><![CDATA[<h4>A place for everything, everything in its place</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oQpfHBHOm-KlWFpkthGqDg.jpeg" /></figure><p>When discussing the choice of storage for a new project, I often hear the conversation move around the question “is our data relational?”. Saying your data is <em>relational</em> (or not) is not a helpful statement. All data is relational, in the sense of having at least some logical relation to the rest of your project domain.</p><p>Relational databases, and their structure, are built thinking about how data is stored and accessed. Normalised forms give you a way of rebuilding complex views from scattered pieces of information by defining relations. This can still happen in non-relational databases, but instead of using normalisation, they use denormalised views, flattening data structures, and skipping steps to achieve performance gains at the cost of generalisation.</p><p>In this light, the correct way of looking at the relational/non-relational question is not by searching for some metaphysical property of your data, but by asking more practical questions about how your data is going to be entered, accessed, and stored. What are the requirements in terms of consistency? What’s the cost of inconsistent data? Is this part of the system user facing? What are the expectations around response times?</p><p>You may notice that most of these questions boil down to the <a href="https://en.wikipedia.org/wiki/CAP_theorem">CAP theorem</a>, and that’s exactly the point (and also why this is an important topic for data engineers). The CAP theorem states that we need to strike a balance between Consistency, Availability, and Partition Tolerance, but that it is impossible to achieve all three at the same time. Since Partition Tolerance is out of our control (no system is immune to malfunctions), what we are left with is the trade-off between Consistency (keep our data safe from corruption) and Availability (keep the system responsive). Even though these qualities of our systems exist on a spectrum, often the domain of the problem we are trying to solve will give us strong hints as to which side of the CAP theorem we should prioritise, since this boils down to “is it acceptable to (temporarily) have inconsistent data, to achieve better performances?”.</p><p>Once you answer the CAP question, most of the pieces are already falling into place. If you need strong consistency, you will naturally gravitate towards databases that offer some version of <a href="https://en.wikipedia.org/wiki/ACID">ACID</a> transactions. If you can get away with some inconsistencies, you can move to databases implementing some form of <a href="https://en.wikipedia.org/wiki/Eventual_consistency">eventual consistency</a>.</p><p>Now you can worry about the next question, which is data access. Once again, traditional relational databases offer great flexibility in how data is queried thanks to their data normalisation structure. On the other end, if you know in advance the specific queries your system will run, you can denormalise your data, flatten it in some kind of document-style or tabular representation, and avoid costly join operations across tables. This is the reason document-based databases like MongoDB turn out to be a great fit for web applications: build denormalise data view closely matching the way data is visualised and forget joins ever existed.</p><p>At the other end of the spectrum, an option to store data with low access requirements is to not use a database at all. Data lakes based on file storage can keep enormous volumes of data for little cost, and indexing and querying layers built on top of it can provide access using familiar interfaces. As an example, S3 buckets can be accessed using Athena with SQL queries, like any regular relational DB, even though you have to accept low speeds. This is acceptable for use cases like reporting, or offline analytics, where we don’t care if it takes hours, or even days, to go through our datasets. Also, analytics data pipelines often load big datasets in memory using simple filters at the source, so there is no need to support complex filtering/ordering behaviour on the data source side. All the filtering/grouping/ordering happens as part of the pipeline processing.</p><p>The other half of data access is writing, and here we move into some more specialised solutions. Databases like Cassandra are heavily optimised for write-intensive workloads, and the columnar style ensures vertical queries (fetching the whole dataset but projecting only some columns) are efficient. Even more extreme, systems like Kafka are built to manage huge inflowing datasets, offering a nice buffer for incoming data before dispatching it to the relevant section of your system.</p><p>When choosing a storage solution, always think about what are going to be the real-world actions happening around the data you are storing. Like that, you will have a place for all your data, and everything will find its place.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8af971c299b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Authentication and Authorisation: a primer]]></title>
            <link>https://aldoontech.medium.com/authentication-and-authorisation-a-primer-c42835604d96?source=rss-ff8b52b02af7------2</link>
            <guid isPermaLink="false">https://medium.com/p/c42835604d96</guid>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[oauth]]></category>
            <category><![CDATA[oidc]]></category>
            <category><![CDATA[oauth2]]></category>
            <dc:creator><![CDATA[Aldo Ambrosioni]]></dc:creator>
            <pubDate>Fri, 25 Sep 2020 14:48:02 GMT</pubDate>
            <atom:updated>2020-09-25T14:48:02.960Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qb22mYvTuP3YvxZH32ZACQ.jpeg" /><figcaption><a href="https://www.flickr.com/photos/76523360@N03/14365358930">“Phone security”</a> by <a href="https://www.flickr.com/photos/76523360@N03">Ervins Strauhmanis</a> is licensed under <a href="https://creativecommons.org/licenses/by/2.0/?ref=ccsearch&amp;atype=rich">CC BY 2.0</a></figcaption></figure><p>When building an application, a common problem is thinking about what kind of user identity management is needed. For simple projects, a basic signup/signin flow with username and password can be enough, but more complex systems may require one or more of the following:</p><ol><li>Alternative ways for users to authenticate, and multi-factor authentication</li><li>User roles and permissions</li><li>APIs to integrate other services (and consequently, a way to secure these APIs)</li><li>Shared identity with other services (3rd party authentication, single sign on)</li></ol><p>To get started, let’s dig into some definitions, starting from the basics of authentication and authorisation.</p><h3>Authentication vs Authorisation</h3><p><em>Authentication</em> is the process of identifying a user, and validating their identity. The obvious example is a user entering their credentials on a website (generally username and password).</p><p>Password authentication is by far the most common option, but authentication schemes can be based on one or multiple factors, including:</p><ol><li><strong>Something you know</strong>: this means some knowledge specific to the user, and it includes passwords, PINs, secret questions.</li><li><strong>Something you have</strong>: this means using something in possession of the user, like their phone (SMS authentication, or push notifications) or their email, physical token, bank cards, and so on.</li><li><strong>Something you are</strong>: this generally includes biometrics, like fingerprints, face recognition, iris scan.</li></ol><blockquote>Authentication is who you are, Authorisation is what you can do</blockquote><p><em>Authorisation</em> is about giving users permissions to execute specific action on the system. Authorisation can only happen after a user is successfully authenticated, as permissions are generally based on user identity.</p><p>When building applications with third party integrations (both incoming and outgoing), it’s important to think of authorisation from two different perspective:</p><ol><li><em>User authorisation</em> defines the actions allowed by a user on the system, so if I log into my Twitter account I have full control of my tweets, but I can only read other people’s tweets (and not, for example, delete them, or publish in their names)</li><li><em>Application permissions</em> are actions that 3rd party systems can execute on the original application. As an example, imagine a user signing up for an online forum that offers a ‘Sign in with Google’ option. In order for this to work as intended, Google needs to share information to the forum, but clearly the forum does not need unlimited access to the user’s Google account. For this reason, generally the required permissions will include access to the user basic information (like name and username, to be displayed on the forum), but will not include things like access to their Gmail emails, which is clearly out of scope for this specific usage of the account.</li></ol><h3>The right tool for the job</h3><p>When building a simple application, or for toy projects, a traditional approach based on username and password can be enough. But modern applications should aim to have a much more comprehensive set of functionalities when talking about users identity.</p><p>It’s common practice for any service to provide security functionalities like two factor authentication, and depending on the type of product, complex developer tools like secure APIs to access the application functionalities.</p><blockquote>Do not reinvent the wheel (and don’t roll your own security)</blockquote><p>Luckily, this does not directly translate into a lot of extra work. There exists numerous options to easily integrate modern security features in a project, using existing libraries, cloud services, and frameworks. Also, especially when talking about security, it’s always important to remember the core teaching of software engineering: do not reinvent the wheel (and don’t roll your own security!).</p><h3>OAuth and OpenID Connect</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*IrCst4OOPqfeGEZyhoLR7w.png" /><figcaption>OAuth logo by <a href="https://chrismessina.me/">Chris Messina</a> licensed under the <a href="https://en.wikipedia.org/wiki/en:Creative_Commons">Creative Commons</a> <a href="https://creativecommons.org/licenses/by-sa/3.0/deed.en">Attribution-Share Alike 3.0 Unported</a> license.</figcaption></figure><p>Let’s dive a bit deeper by taking a look at two of the main standards around authentication and authorisation: OAuth and OpenID Connect</p><blockquote>OAuth allows an <strong><em>Application</em></strong> to request access to some specific <strong><em>Resources</em></strong> on behalf of a <strong><em>User</em></strong><em>.</em></blockquote><p><a href="https://oauth.net/">OAuth</a> is the de facto standard for <em>authorisation</em>. It describes a protocol used to grant application access to resources on behalf of the resource owner. The main <a href="https://www.digitalocean.com/community/tutorials/an-introduction-to-oauth-2">flow</a> described by the protocol allows an <em>Application</em> to request access to some specific <em>Resources</em> on behalf of a <em>User</em>. An <em>Authorisation Server</em> is responsible for verifying if the request can be granted or not.</p><blockquote>OIDC is used as an <strong><em>authentication</em></strong> layer to validate user identities across services</blockquote><p><a href="https://openid.net/connect/">Openid Connect</a> (OIDC) is an identity layer built on top of OAuth 2.0. It is used as an <em>authentication</em> layer to validate user identities across services, and to obtain basic user profile information. By using OIDC, it is possible to delegate the authentication of users to third-party applications, simplifying user management and improving user experience.</p><p>OAuth and OIDC are fundamental protocols, implemented and supported across virtually any major service, application, and vendor. By using them as the foundation of an application’s user management, it’s possible to leverage existing solutions to quickly build robust, secure, and scalable user experiences.</p><h3>Existing libraries and services</h3><p>This is by no means a complete list, but just an example of existing tools that can be used to quickly integrate identity management into an application, with minimum effort and by leveraging global standards, that ensure security and compatibility with other existing services.</p><h4>passport.js</h4><p><a href="http://www.passportjs.org/">Passport.js</a> is the most popular authentication library for Node.js applications. The library provides a standard way to integrate different authentication strategies as Node.js middlewares. It keeps an agnostic approach to implementation details, so it is a developer responsibility to choose and implement the low level details of certain authentication strategies (e.g. how to store passwords, or tokens from third parties).</p><h4>oidc-provider</h4><p>oidc-provider is an OAuth 2.0 server with OIDC already implemented. It can be used to quickly spin up an OAuth/OIDC server, both as a stand-alone service or by integrating into an existing Node.js project. This is a good fit for a project to roll their own identity manager, without using 3rd party cloud services, while still being fully compliant with standards.</p><h4>Auth0</h4><p><a href="https://auth0.com/">Auth0</a> is a SaaS company providing tools to integrate authentication and authorisation into products. They offer a variety of services, including integration with social logins, multi-factor authentication, machine to machine solutions, and more.</p><h4>AWS Cognito</h4><p><a href="https://aws.amazon.com/cognito/">AWS Cognito</a> is the identity management offering from AWS. Similar to Auth0, it offers a number of ready to use functionalities, including creating and managing user pools, integration with 3rd party services, multi-factor authentication, and so on. The main strength of AWS Cognito lies in the integration with other AWS services. For example, it’s extremely easy to set up Cognito to secure APIs defined in AWS API Gateway.</p><h3>Conclusions</h3><p>When building a product, it’s impossible to anticipate every requirement, and to predict how the product will change in the future. But some components, like user management, have well defined standard and tools that can be leveraged to quickly build a reasonably future-proof solution with minimal effort. When possible, it is always a good idea to follow open standards, and reuse existing resources: do not reinvent the wheel!</p><p><em>For more stories like this, check out my </em><a href="https://twitter.com/haldoh"><em>Twitter account</em></a><em>.</em></p><p><em>To keep in touch, check out my </em><a href="https://about.me/aldoa"><em>personal page</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c42835604d96" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>