In the previous post, I wrote about accessing a protected API controller being authenticated with id tokens obtained from Google. I created my application on Windows in Visual Studio because I needed the helping hand of dotPeek to see what was going on inside code that is not mine. In this post, I’ll write what happened when I ran this application on Ubuntu.
After I pulled my project from
I restored all packages using
dnu restore and I ran the application. The project compiled and ran without any trouble. I obtained a token from Google and I clicked the Protected button and I saw this on the screen:
I looked at the console where my app was running I saw the same error.
I thought that the tip on how to solve this problem was included in this line:
Could not load type 'System.IdentityModel.Tokens.AsymmetricSignatureProvider'. I googled this error and I found this
RSACryptoServiceProviderProxy crashes on.
A quick look at this page gave me a clue that there are differences in the cryptography between Mono and .Net on Windows. I am not going into details here, but what’s important is that at the time of writing this post, this issue was still ongoing. I tried a different version of package Microsoft.AspNet.Authentication.JwtBearer, which was 1.0.0-beta8 but in this package extension method UseJwtBearerAuthentication didn’t exist.
Okay, this was on Mono but what happened on coreclr? I switched my execution environment to coreclr using the command
dnvm upgrade -r coreclr. This command upgraded my coreclr version and set it as the default runtime version.
dnvm list gave me an output like this:
Then I ran the application and obtained a token from Google by clicking Get Token and finally I clicked the Protected button and I saw this:
This line: * ‘System.DllNotFoundException: Unable to load DLL ‘ncrypt.dll’* seemed to be the key part of this error for me, so I googled it. The first search result brought up this issue on github. This issue seemed to be resolved but it is added to milestone:RC2 so probably the next version will have this error fixed.
In conclusion, what does the portability of ASP .NET Core applications really look like? In the case of Windows, everything works perfectly. On Linux (Ubuntu) it didn’t work. You can read above about what exactly didn’t work. Yes, I could hack it and work around these errors, for example, by implementing my own SignatureProviderFactory, but I am quite sure that the .Net Team will do this better than me in the near future. It’s only a matter of time for ASP .NET Core to work the same on all platforms. You can find out more about it here, but for now it is still bleeding edge and bleeding edges hurt.
- Enrolling in "Daj się poznać"
- "Daj się poznać" - Project details"
- I'm holding a Project Rider EAP
- Installing ASP .NET Core 1 on Ubuntu 14.04
- My first ASP NET Core 1.0 web application
- Project setup - server-side
- Project setup - client-side
- Adding styling to my application
- Angular 2 Confirm Dialog Component
- Before going into production
- Publishing to Azure
- Setting up the Web client for Google Identity Platform
- oidc-token-manager library with Google Identity Platform - Part 1
- oidc-token-manager library with Google Identity Platform - Part 2
- Accessing API with token from Google Identity Provider
- How portable is ASP .NET Core 1.0?
- When dotPeek can save your live
- Reading code as if it were a book
- ASP .NET Core Configuration
- Getting started with IdentityServer4
- IdentityServer4 - accessing API
- Dealing with secrets in ASP .NET Core
- Google Identity Provider with IdentityServer4
- Upgrading to Angular2 RC1
- Experimenting with Angular2 CLI
- Migrating to ASP .NET Core RC2
- Epilogue: Daj się poznać series