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
<PackageReference Include="MasterBlazor.WPF.Lib.Auth" Version="1.0.0" />
paket add MasterBlazor.WPF.Lib.Auth --version 1.0.0
#r "nuget: MasterBlazor.WPF.Lib.Auth, 1.0.0"
// 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();
Get Specific Cookie Value
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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-windows7.0 is compatible. |
-
net8.0-windows7.0
- Microsoft.Web.WebView2 (>= 1.0.2646-prerelease)
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 |