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.
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.
// Install MasterBlazor.WPF.Lib.Auth as a Cake Addin
#addin nuget:?package=MasterBlazor.WPF.Lib.Auth&version=1.0.0

// Install MasterBlazor.WPF.Lib.Auth as a Cake Tool
#tool nuget:?package=MasterBlazor.WPF.Lib.Auth&version=1.0.0                

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. 
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 96 7/18/2024