That Saar 💎
banner
codewithsaar.com
That Saar 💎
@codewithsaar.com
Build .NET Apps, share coding experiences, and memes. I work for Azure Tools team @ Microsoft. Check out my portfolio ➡ https://codewithsaar.com 😎 and my GitHub: https://github.com/xiaomi7732
#TIL wildcard could be used in nuspec file 🙂 #nuget #dotnet
March 20, 2025 at 9:53 PM
Just released a new version of PrettyLogging:
www.nuget.org/packages/Pre...

Supports line breaks in one line mode. Better or worse? :-)
March 14, 2025 at 11:40 PM
And then it registers AuthenthicationServiceImpl as IAuthenticationService:
March 11, 2025 at 5:01 PM
Follow the lead, the AddAuthentication calls AddAuthenticationCore():
March 11, 2025 at 5:01 PM
In ASP.NET Core Identity, the `AddDefaultIdentity<TUser>` looks ... suspecious because it calls `AddAuthentication()` for us.
March 11, 2025 at 5:01 PM
Well, it gets the service of IAuthenticationService from the IoC container. That means, some code is registering IAuthenticationService, and what is that? 🤔
March 11, 2025 at 5:01 PM
Time to dig out the .net source: source.dot.net/Microsoft.As...
It calls GetAuthenticationService and then calls SignInAsync on that. Right, what does GetAuthenticationService mean?
March 11, 2025 at 5:01 PM
Digging a bit, there's actually an extension method described here: learn.microsoft.com/en-us/dotnet.... Good, what does that actually do?
March 11, 2025 at 5:01 PM
#30MinsLearning Day 12, in the code implementation, this Context.SignInAsync() method got me confused for quite a while. Firstly, there's no SignInAsync() method on HttpContext class: learn.microsoft.com/en-us/dotnet... ...
March 11, 2025 at 5:01 PM
#30MinsLearning Day 11, today, I read the code and created a top level sequential for `/login` of #aspnetcore #identity. The code is pretty straightforward. It supports 2 types of scheme - cookie or token. It starts with user name, password sign in, and check to see if 2FA is needed. For 2FA... 🧵
February 21, 2025 at 6:00 AM
5 static results: Success, Failed, LockedOut, NotAllowed, TwoFactorRequired. And for each result, here's the status break down. Each row shows, for a given result, what's the status of the properties. For example, when the result is Success, only Succeeded property is true.
February 20, 2025 at 6:01 PM
#30MinsLearning Day 10, move on to read '/login' in #aspnetcore #identity, keys about handling the SignInResult. And here's a break down of it. The class is pretty straight forward 🧵👇 #dotnet #csharp There are 4 boolean properties: Succeeded, IsLockedOut, IsNotAllowed, RequestTwoFactor. And 5 ...
February 20, 2025 at 6:01 PM
#30MinsLearning Day 9, Ok, this 1 took 30+ mins. Well, to understand the code for `/register` of #aspnetcore #identity, I created a sequential chart to visualize it:
It takes 7 parties to finish the registration. It is #SOLID, but is it #overengineered? What about KISS? Worth it? 🤔 #dotnet #csharp
February 19, 2025 at 5:54 AM
Look, what our robovac found 😱
February 16, 2025 at 5:57 PM
What is this UesrLockoutStore do? What does user lockout mean? Is that used to lock out new users immediately upon registration?
February 15, 2025 at 5:38 AM
#30MinsLearning Day 8: Today, I read the code of UserManager.CreateAsync(), it relies on the PasswordStore to set the password hash, then calls the UserStore to create the user in real - like in db. The responsibilities are quite clear. >>>🧵 #dotnet #csharp #aspnetcore #identity #auth #authZ
February 15, 2025 at 5:38 AM
Interestingly, it actually doesn't do too much but put the username onto the user object in UserStoreBase.cs. Looks like totally an overkill except its a virtual method. Hmm, needs more time to understand the reason. Probably needs to see the code in the user manager as well.
February 14, 2025 at 5:53 AM
#30MinsLearning Day 7: Today, I sit down and read the `/register` endpoint code. Most of them is easy, validate the email, and create the user. This part, though, I don't understand why: 🧵 #dotnet #csharp #aspnetcore #identity #auth #authZ
February 14, 2025 at 5:53 AM
Say #ubuntu, where do you learn this? 💢 #linux
February 12, 2025 at 5:54 AM
#30MinsLearning Day 6: Try to understand the relations of asp.net core identity tables. Some are simple, a user could have multiple roles, a role has multiple users, forming a m:n by 3 tables. 🧵 #dotnet #csharp #auth #identity #sql #relational #aspnetcore
February 12, 2025 at 5:46 AM
#30MinsLearning Day 5: I got the identityDB context into a #sql server. It is a journey. To reach here, I ran a sql express in #container on #Ubuntu, get basics of #EntityFramework migrations, figured out the nugets to reference, and derived IdentityDbContext. 💪 #dotnet
February 11, 2025 at 5:38 AM
#30MinsLearning Day 4: migrated the first database using entity framework core 9.0 into the SQL database. It turned out the most difficult part was actually write the correct connection string.
February 9, 2025 at 11:20 PM
#30MinsLearning Day 3: Tried to connect to the sql server locally. I used the SSMS years ago. On Linux, I'll need some crossplat, #vscode mssql ext looks good. Turned out, most of the 30 mins today figuring the port 1434 (not the default 1433) I mapped by mistake 🫠 #dotnet #mssql #container.
February 9, 2025 at 6:19 AM
#30MinsLearning Day 2: I put up a MS SQL Server container on the #linux box, there was a bit permission issues for the db file at the beginning, addressed the issue in 30 minutes with some online search. #dotnet #mssql #container.
February 8, 2025 at 6:00 AM
This is my desktop. What's yours look like? #desktop #ubuntu
February 1, 2025 at 6:38 PM