MasterBlazor.WPF.Lib.Auth 1.0.0

dotnet add package MasterBlazor.WPF.Lib.Auth --version 1.0.0
                    
NuGet\Install-Package MasterBlazor.WPF.Lib.Auth -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MasterBlazor.WPF.Lib.Auth" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MasterBlazor.WPF.Lib.Auth" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="MasterBlazor.WPF.Lib.Auth" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MasterBlazor.WPF.Lib.Auth --version 1.0.0
                    
#r "nuget: MasterBlazor.WPF.Lib.Auth, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MasterBlazor.WPF.Lib.Auth@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MasterBlazor.WPF.Lib.Auth&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=MasterBlazor.WPF.Lib.Auth&version=1.0.0
                    
Install as a Cake Tool

MasterBlazor.WPF.Lib.Auth

A library to manage ADFS and SAML authentication and Accessing site's REST API for WPF applications using WebView2. It used by MasterBlazor.WPF.UC.LogingPage to give a full experience to access ADFS sites.

Installation

NuGet Package

You can install the library via NuGet Package Manager:

Install-Package MasterBlazor.WPF.Lib.Auth

Or you can download to your project directly.

GitHub

Clone the repository:

git clone https://github.com/yourusername/MasterBlazor.WPF.Lib.git

Usage

AuthManager

AuthManager is used to manage authentication cookies for a specified site.

Initialize AuthManager

using MasterBlazor.WPF.Lib.Auth;

// Initialize with the site URL
var authManager = new AuthManager("https://example.com");
Save Cookies to File

authManager.Save();
Load Cookies from File

var cookieContainer = authManager.Load();
Reset Cookies

authManager.Reset();

string cookieValue = authManager.GetCookie("FedAuth");
Initialize Cookies from WebView2

using Microsoft.Web.WebView2.Wpf;
using System.Collections.Generic;

// Assume webView is your WebView2 control
WebView2 webView = new WebView2();
List<CoreWebView2Cookie> cookies = await authManager.Initialize(webView);

RestManager

RestManager is used to make REST API calls using the cookies managed by AuthManager.

Initialize RestManager

using MasterBlazor.WPF.Lib.Auth;
using System.Net;

// Using AuthManager
var restManager = new RestManager(authManager);

// Using CookieContainer directly
var cookieContainer = new CookieContainer();
var restManagerWithCookies = new RestManager(cookieContainer, "https://example.com");
Make GET Request

string apiEndpoint = "/api/endpoint";
string response = await restManager.Get(apiEndpoint);
Dispose RestManager
restManager.Dispose();
Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MasterBlazor.WPF.Lib.Auth:

Package Downloads
MasterBlazor.WPF.UC.LoginPage

ADFS WS-Federation SSO Login page

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 255 7/18/2024