Posts

Azure YAML Pipelines for NuGet publish for internal use

YAML file from my Company Tech Formats name: $(majorMinorVersion).$(semanticVersion) trigger: - none resources: repositories: - repository: RepoNameHere type: git name: NameItAsYouWish ref: main trigger: branches: include: - main pool: vmImage: ubuntu-latest variables: majorMinorVersion: 1.0.0 # semanticVersion counter is automatically incremented by one in each pipeline execution # second parameter is a seed value, resets when referenced majorMinorVersion is changed semanticVersion: $[counter(variables['majorMinorVersion'], 0)] jobs: - job: PublishToNuGetfeed displayName: Publish to NuGet feed steps: - template: NugetPublish.yml parameters: LibraryProject: ProjectNameToBuild PublishFeed: FeedToPublishTo Copy to Clipboard parameters: - name: LibraryProject displayName: Full Library Project Name type: string - name: PublishFeed displayName: Feed To Publish To type: string...

RSA and JWT in .NET 8

Code below is a helper class to help sign and use public key to verify, both keys values must have the "BEGIN RSA" and "END RSA" lines public class JwtHelper { private readonly IConfiguration _configuration; public JwtHelper(IConfiguration configuration) { _configuration = configuration; } public RsaSecurityKey GetSigningPublicKey() { string keyText = string.Join(Environment.NewLine, _configuration.GetSection("PublicKey").Get ()); var rsa = RSA.Create(); rsa.ImportFromPem(keyText); RsaSecurityKey publicKey = new RsaSecurityKey(rsa); return publicKey; } public SigningCredentials GetSigningCredentials() { string keyText = string.Join(Environment.NewLine, _configuration.GetSection("PrivateKey").Get ()); var rsa = RSA.Create(); rsa.ImportFromPem(keyText); SigningCredentials signingCreds = new SigningCredentials(new RsaSecurityKey(...

Blazor WASM hosted as Azure Static Web App and how to handle direct links

Long time no post! i have been busy trying to "lunch" my PWA app https://www.homeyummies.net , one of the challenges i faced was when i communicate direct links to the users like https://www.homeyummies.net/register that gave the user an Azure 404 page although it's a valid path on the Blazor WASM app, but as this is an SPA and routing is happening at client-side, when calling this directly the server looks for https://www.homeyummies.net/register/index.html and as it doesn't find it, it return 404. a couple of google searches and i did find some solutions out there for that, and when trying to implement them i got a major issue, handling this issue can only be really tested after deployment as part of the solution do relay on what are you hosting the Blazor app on, i did try a couple of them but nothing really worked without issues! but when i combined a couple of them together it did form a good solution for and i though to share it so the solution have 3 part...

Blazor and Square Payments

Another day of poking around and conquer challenges. For my project "HomeYummies.net" i was trying to figure out a solution to process payments using a payment provider but for others, as i wanted the funds to go directly to cooks accounts. after some research i settled on Square as such functionality was addressed more obviously there. But ... how can i get their magical box display on Blazor WASM app i have as a front end? after some decent effort i managed to do so and also have a way to submit and get a token to be used along with a cook OAuth token to process a payment for them! i though to turn this into an open source library, but not quite committed to that yet, but if you land here search for something slimier here you go :) https://github.com/UpwardInfo/BlazorPay/tree/dev

Microsoft.IdentityModel.Tokens version 6.15.0 no user context in AuthorizationHandlerContext

A lesson learned i would like to share. I had a working JWT using RSA key pairs on a .NET 6 based API, installing Microsoft.IdentityModel.Tokens version 6.15.0 (latest) broke it, my custom policy handler were not getting the user context! I tried everything i know to fix it from my side but only restoring back to version 6.14.1 fixed it for me. I checked the package Github and it seems there are a couple issues mentioning dependencies version!

revenera InstallShield and Web.Config authentication mode="None"

Image
 So, i came upon this uncommon scenario. I had a very working InstallShield to deploy a Web API into IIS, after updating to 2020R3 i think, all of the sudden the deployed site was not functioning in the most bizarre way. The API did have a couple of config./admin pages where it was working just fine, API connection to the database source was working fine as well, the connection test did include testing user credentials as well, but when i tried to use same credentials on an endpoint, i would a message that authentication was denied for this request! to add to the mix, i had the same exact Web API on the same exact IIS and the same exact connection running from Visual Studio just fine! so after many many hours of testing and smashing my head against the wall 😫, i found out the root cause, for some reason InstallShield on deployment was removing below line from my web.config included with the Web API app. <authentication mode="None"/> Copy to Clipboard now that was h...

FINALLY remove unused reference is here

 i normally do not check release notes, but something pushed me to do it this time when i was about to upgrade to Visual Studio version 16.10.4, and I FOUND THIS ! Although the screen shot doesn't till what type of reference this would handle, is it only limited to NuGet packages? dose it extend to directly referenced DLLs (yes some folks still do that!) Framework files? Anyway i am existed to try this out and will update this with any findings i feel worth to share, so stay tuned! UPDATE: i am very disappointed, it's marking needed referenced projects and packages as not needed!, like i have it in a using for a class, and it's in bright white because it's used, and i can see it's being used, still it get in as unused reference, while other projects i get a message that there isn't any unused references! hope Microsoft fix this, it's really a neat feature specially for Blazor WASM , where every mb count