<?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 Christophe Courquet on Medium]]></title>
        <description><![CDATA[Stories by Christophe Courquet on Medium]]></description>
        <link>https://medium.com/@christophe.courquet?source=rss-a82648ae532c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*RSN_tRRqIwFccFBW.jpg</url>
            <title>Stories by Christophe Courquet on Medium</title>
            <link>https://medium.com/@christophe.courquet?source=rss-a82648ae532c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 11:24:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@christophe.courquet/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[Setup a VPN on Synology Nas to Access your Applications in Security]]></title>
            <link>https://medium.com/@christophe.courquet/setup-a-vpn-on-synology-nas-to-access-your-applications-in-security-d93f1f795a00?source=rss-a82648ae532c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d93f1f795a00</guid>
            <category><![CDATA[vpn]]></category>
            <category><![CDATA[nas]]></category>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[synology]]></category>
            <category><![CDATA[reverse-proxy]]></category>
            <dc:creator><![CDATA[Christophe Courquet]]></dc:creator>
            <pubDate>Thu, 31 Oct 2024 20:28:50 GMT</pubDate>
            <atom:updated>2024-10-31T20:28:50.779Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*z61iXwV4uPTtYZCb" /><figcaption>Photo by <a href="https://unsplash.com/@nasa?utm_source=medium&amp;utm_medium=referral">NASA</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fv8Hl9wGdj_Mn3u3O33lAA.png" /></figure><h3>Step 1 : DDNS</h3><p>DDNS, Dynamic Domain Name Server, simplifies connection to your Synology NAS over the Internet by mapping a hostname to its IP address. It’s useful as probably your Internet Service Provider changes regularly the IP of your home router.</p><p>In my case, i choose the Synology service that provide the domain name <a href="http://synology.me/"><em>synology.me</em></a><em>.</em> You have just to define a sub domain (e.g. <em>home</em>) to obtain the full hostname <a href="http://www.home.synology.me/"><em>www.home.synology.me</em></a><em>.</em></p><p>You can use this one to access your Synology NAS without needing to remember an IP address (e.g. <em>176.131.33.89</em>).</p><h3>Step 2 : VPN</h3><p>In our case, the main advantage with a VPN (Virtual Private Network) is that you can access your home local network with <strong>security</strong> (connection is encrypted) as you were directly connected to it.</p><p>To use a VPN you need :</p><ul><li>a <em>Client</em> on an external device</li><li>a <em>Server</em> on your Synology NAS.</li></ul><p>For both, I use OpenVPN solution.</p><p>Note that the VPN Server use UDP protocol, a port (e.g. 1194) and also will have a local IP (e.g. 10.8.0.1).</p><h3>Step 3 : Configure Internet Router</h3><p>Now, we need to authorize the VPN external connection to access your VPN Server installed on your NAS.</p><p>For this part refer to the specificity of your ISP box.</p><h3>Step 4 : DNS Server</h3><p>In IT networks, machines communicate between them thanks to IP address .</p><p>DNS servers resolve URL (understanding characters) to convert it to an IP address (sequence of numbers).</p><p>e.g., <a href="https://test.home/">https://test.home</a> → 192.168.64</p><p><strong>Primary zone</strong></p><p>First thing to do is to define a primary zone (also known as master zone). It will contains informations about :</p><ul><li>the domain we want to create. Let’s assume it’s <em>home</em></li><li>the main DNS Server address. In your case 192.168.1.64</li></ul><p><strong>NS resource</strong></p><p>To specify the DNS server that handle the domain <em>home</em></p><p><strong>Type A resource</strong></p><p>To bind a specific domain to an IP address.</p><p>In the current example, i have created the following A resources :</p><ul><li>app1.home ⇒ 192.168.1.64</li><li>app2.home ⇒ 192.168.1.64</li><li>appn.home ⇒ 192.168.1.64</li><li>admin.home ⇒ 192.168.1.64</li></ul><h3>Step 4 : Reverse Proxy</h3><p>It’s where we bind a source URL/IP to a destination URL/IP</p><p>e.g., <a href="http://app1.home/">http://app1.home:80</a> ⇒ <a href="http://192.168.1.64/">http://192.168.1.64</a>:[port_app1]</p><p><a href="https://admin.home/">https://admin.home:443</a> ⇒ <a href="https://192.168.1.64:5001/">https://192.168.1.64:5001</a></p><h3>That’s It !</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d93f1f795a00" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manage OAuth2 Flows With Angular]]></title>
            <link>https://medium.com/@christophe.courquet/manage-oauth2-flows-with-angular-c368750a542?source=rss-a82648ae532c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c368750a542</guid>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[flow]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[oauth]]></category>
            <category><![CDATA[authorization]]></category>
            <dc:creator><![CDATA[Christophe Courquet]]></dc:creator>
            <pubDate>Wed, 11 May 2022 15:09:08 GMT</pubDate>
            <atom:updated>2022-05-11T15:09:08.347Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*grBPlCiH9dF_T_BL" /><figcaption>Photo by <a href="https://unsplash.com/@mr_williams_photography?utm_source=medium&amp;utm_medium=referral">Micah Williams</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Recently, in my Angular projects, I had to implement authorization using OAuth2 protocol to access API. It’s something quite common nowadays. So, let’s have a look.</p><h4>What is exactly OAuth2 ?</h4><blockquote>« OAuth » : Open Authorization</blockquote><blockquote>2 : version 2 :-)</blockquote><p>OAuth2 is a standard protocol to manage authorization granted to an application to access API.</p><p>This protocol involves 4 entities :</p><ul><li><em>Resource Owner (RO)</em> : it’s usually the user.</li><li><em>Resource Server (RS) </em>: server where are hosted the data</li><li><em>Client</em> : application that wants to access the data on <em>RS</em></li><li><em>Authorization Server (AS)</em> : server dedicaded to authenticate the <em>RO</em>. If authentication is validated, a token to access API is generated and provided to the <em>Client</em>.</li></ul><h4>SPA OAuth2 Flows</h4><p>Following the use cases, several flows have been defined to get a token. I explained here those who may be useful for Single Page Application :</p><ul><li><em>Implicit Authorization </em>: Initially, used by browser based clients to reduce the number of calls to retrieve a token. In this flow, <em>Client</em> send some informations (Client ID, redirect Uri, scopes…) directly to <em>AS</em>. It’s highly recommended to send these data via a POST form on HTTPS to don’t make them visible. If these informations are validated, Client receives the token throw the redirect Uri. Because of lack of security, this flow must be replaced by Authorization Code with PKCE when possible.</li><li><em>Authorization Code with PKCE (Proof Key for Code Exchange)</em> : this flow introduces a secret (called<em> Code Verifier</em>) created by the <em>Client</em> and sended to the <em>AS</em>. Additionally, the <em>Client</em> creates a transform value of the <em>Code Verifier</em> called the <em>Code Challenge</em> and sends this value over HTTPS to retrieve an <em>Authorization Code</em>. The latter will be used to obtain a token. This must be the preferred flow.</li></ul><h4>Implementation</h4><p>To simplify the implementation of these flows, i’ve created the Angular library below :</p><p><a href="https://github.com/xtof974/ng-OAuth2#readme">GitHub - xtof974/ng-OAuth2</a></p><p>The usage is pretty easy because you only have to update one file and the magic happens :-)</p><pre>import { APP_INITIALIZER } from  &#39;@angular/core&#39;;<br>import {AuthInterceptor,<br>	AuthService,<br>	FlowType,<br>	NgOauth2Module,<br>	NgOauth2Service,<br>	RedirectComponent,<br>} from  &#39;@xtof974/ng-oauth2&#39;;<br>// etc.<br><br>@NgModule({<br>  imports: [<br>    // etc.<br>    NgOauth2Module.forRoot({<br>		flowType:  &#39;IMPLICIT_GRANT&#39;, //IMPLICIT_GRANT, PKCE<br>		rsURL:  environment.rsURL, //e.g. Resource Server URL<br>		asURL:  environment.asURL, //e.g. Authorization Server URL<br>		clientID:  environment.clientID,<br>		redirectInfos:  {<br>			redirectURI: environment.redirectURI,<br>			home:  &#39;/home&#39;, //where to go after redirect<br>		},<br>		extras: {<br>			saveNavigation:  false, //available only if No refresh Token<br>			delayBeforeRefreshToken: 5 //number in seconds &gt; 0<br>		},<br>		scopes: {			//optionnal<br>			scopes: [&#39;READ&#39;, &#39;WRITE&#39;], //list of scopes<br>		}<br>}),<br>  ],<br>  declarations: [<br>    AppComponent,<br>    HomeComponent,<br>    // etc.<br>  ],<br>  providers: [<br>	NgOauth2Service,<br>	{<br>	   provide:  APP_INITIALIZER,<br>	   useFactory:  initOauth2Service,<br>	   deps: [NgOauth2Service],<br>	   multi:  true,<br>	},<br>	{<br>	   provide:  HTTP_INTERCEPTORS,<br>       useClass:  AuthInterceptor,<br>	   multi:  true,<br>	},<br>	// etc. others interceptors<br>  ]<br>  bootstrap: [<br>    AppComponent<br>  ]<br>})<br>export class AppModule {<br>}<br>export  function  initOauth2Service(config: NgOauth2Service) {<br>	return (): Promise&lt;any&gt; =&gt; {<br>	return  config.init();<br>	};<br>}</pre><p>Have fun, feel free to comment and of course contribuate !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c368750a542" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>