IdentityModel.OidcClient.Samples | samples use a demo instance | OAuth library
kandi X-RAY | IdentityModel.OidcClient.Samples Summary
kandi X-RAY | IdentityModel.OidcClient.Samples Summary
All samples use a demo instance of identityserver (- you can see the source code here. You can login with alice/alice or bob/bob.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of IdentityModel.OidcClient.Samples
IdentityModel.OidcClient.Samples Key Features
IdentityModel.OidcClient.Samples Examples and Code Snippets
Community Discussions
Trending Discussions on IdentityModel.OidcClient.Samples
QUESTION
I have used IdentityModel.OidcClient
with a UWP app and connected to Azure AD. Login webview opens and automatically closes but the logout popup does not automatically close.
My implementation is based on this. When logout happens the final function call goes here but until the popup closes manually, execution hangs inside this AuthenticateAsync
function call.
ANSWER
Answered 2021-Dec-07 at 13:33found the answer.
You need to setup the LogoutRequest
object and set the IdentityToken
from the LoginResult
object (Comes from the response of LoginAsync
function) and send it with the LogoutAsync
function.
QUESTION
In our application we have a WPF client and an ASP.NET Core server, both of which uses .NET 5.
We store all our DLLs on server and the client downloads all the necessary DLLs from server when user logs in. Originally, the client has been independent of any third-party libraries, our other projects, etc. which allowed us, in certain situations, to download the client as DLL (using another application – which I will be calling a loader – specifically designed for this purpose), load the client using Assembly.Load(binaryData)
and execute the login method.
Side note: What has been so far referred to as client is actually just a simple application which authenticates the user and downloads the DLLs for the actual client which consists of multiple assemblies and allows us to work with the data on server. For the sake of simplicity, however, I won't distinguish between them as they both stand on the client side.
Recently, I've implemented single sign-on using OpenID Connect based on NetCoreConsoleClient sample from IdentityModel and, as a result, a few references to other assemblies have been added to the client. Now, in order for the SSO to work, the loader has to download these assemblies together with the client.
The problemCurrently, the client uses some of the assemblies from Microsoft.AspNetCore.App shared framework. According to this SO question & answer it should be working on my machine since the runtime is installed – the framework is present on my machine in: C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\5.0.0
. However, when I try logging in using the client downloaded via loader I'm getting System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.AspNetCore.Hosting, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.'
Also, if I take the DLL from the path mentioned above and try to load the Microsoft.AspNetCore.Hosting assembly manually, using Assembly.Load(binaryData)
, I'm getting System.BadImageFormatException: 'Could not load file or assembly 'Microsoft.AspNetCore.Hosting, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (0x80131058)'
I tried searching online and discovered that it might be caused by 32-bit/64-bit architecture conflict. I tried creating a simple demo application where I tried changing between the architectures but had no success.
I also have found a few mentions of the exception I'm getting when loading the assembly manually but none of them seems to be relevant for my specific case.
The questionsAm I using the Microsoft.AspNetCore.App shared framework wrong? How to use it properly?
Is there a way how to actually use Microsoft.AspNetCore.Hosting and other assemblies from Microsoft.AspNetCore.App as a regular DLL so that I can load them using Assembly.Load(binaryData)
?
ANSWER
Answered 2021-Aug-30 at 14:29Eventually, we have been able to figure it out.
The client references Microsoft.AspNetCore.App and Microsoft.WindowsDesktop.App and the loader has to reference them as well since the client DLL is loaded using Assembly.Load(binaryData)
inside it.
This is something I have completely missed but was as easy to fix as adding the following piece of markup to the loader project file:
QUESTION
I've been trying to figure out why my console application fails the instant I introduce a new package. Using IdentityModel.OidcClient
and Microsoft.AspNetCore.Server.Kestrel
only works, but when adding Microsoft.Extensions.Configuration.Json
it throws exception. I don't reference the new package in code either, I just add it to the project.
Steps to reproduce:
Clone https://github.com/IdentityModel/IdentityModel.OidcClient.Samples.git
Upgrade NetCoreConsoleClient to .NET 5 (update packages).
Remove Serilog.Sinks.Literate obsolete package.
Remove call to
.WriteTo.LiterateConsole
for SeriLog in Program.cs and addusing IdentityModel.Client
.Add
CancellationToken cancellationToken = new CancellationToken()
parameter forInvokeAsync
method inSystemBrowser
class. The signature for theIBrowser
interface has changed, the new method should look like this:public async Task InvokeAsync(BrowserOptions options, CancellationToken cancellationToken = new CancellationToken())
Run application and login with alice/alice. Acquiring token is successful.
Add package
Microsoft.Extensions.Configuration.Json
.Run application. It now throws exception
Object reference not set to an instance of an object
when writing to the http response.
The exception occurs in LoopbackHttpListener.SetResult
when writing to the response: ctx.Response.WriteAsync("
You can now return to the application.
");
Why does adding a package only, have such an impact to the runtime?
Project file:
...ANSWER
Answered 2021-Mar-27 at 10:49The exception is thrown in
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install IdentityModel.OidcClient.Samples
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page