-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client side identity manager #31
Comments
Have you seen https://github.com/AzureAD/microsoft-authentication-library-for-dotnet ? What additional layers would you want on the client side? |
For what kind of .Net client apps are you looking for a solution? Blazor? Mobile? Desktop/UWP? For UWP there is the combination of
For Microsoft (personal/work/school) accounts and for certain websites you do not need to implement a custom Unfortunately, there is no good documentation nor is there a sample maintained by Microsoft how to create a custom There is only an unofficial sample, which is helpful but also has some improvement points and the sso cookies functionality seems not to work anymore. |
If your website offers OAuth, then you might be able to use https://docs.microsoft.com/en-us/windows/uwp/security/web-authentication-broker as well. However I believe that one does not integrate with the accounts registered in Windows, and it won't offer a "reusable experience". It won't set SSO cookies for you, it won't register your account with Windows, it won't give other apps the possibility of using the same token logic. |
WOW. |
Glad that it gave you a pointer! @weitzhandler @jonwis could you please keep this issue open?
Not sure if this functionality is in scope? |
@jonwis Yes checked it about a year ago, it doesn't support custom authentication, i.e. JWT tokens etc. |
Sure! One goal of Project Reunion is bringing some of the Windows Platform functionality initially developed for UWPs over to Win32 applications. @weitzhandler - So is the feature request then "make the web authentication broker available to Win32 apps" ? |
@jonwis I won't speak for the needs of @weitzhandler, but can you please also see what is possible for
|
🦙 Cross-linking to the WebAuthenticationBroker question in the WebView2 repo here |
We should separate the discussion between UWP and other platforms. For authentication purposes, MSAL.NET (the official Identity SDK) will be integrating with WAM (Windows Auth Manager) directly - tracking work here |
@jonwis can you please also see what is possible to improve WebAccountProvider and WebAccountManager and their respective documentation? I believe the topic of this GitHub issue swerved a few times and was closed/reopened as well - if we need to open separate issues please indicate what issues we need to open and what can be clustered. |
I haven't tried If the above is correct, it means that even public interface IIdentityManager // to be used from VM
{
IPrincipal CurrentUser { get; }
IToken CurrentToken { get; }
Task EnsureLoggedInAsync(); // triggers OnRequestToken
// awaiting credentials from UI, which can be set into `TokenRequestEventArgs` or whatever it might be
// and can be using `WebAccountProvider`, or directly against endpoint with username-password
event EventHandler<object, TokenRequestEventArgs> OnRequestToken;
event EventHandler OnAuthenticationChanged; // i.e. on logged in/out
// alternatively ITokenProvider which talks to endpoints
// on either UI (integrated with `WebAccountManager` or VM, or both.
ITokenProvider { get; } // which can be injected by concrete class' constructor from DI
}
public class TokenRequestEventArgs
{
public IToken { get; set; }
} |
@weitzhandler can't you write multiple implementations of your interface for different platforms, where the implementation using WebAccountManager is the implementation for Windows? I understand it would be convenient if that work was done for you (and others of course) though. Also: WebAccountManager does not show a UI - it is the WebAccountProvider that shows the UI for logging in etc. The WebAccountProvider logic (can be in the same app or separate app) is activated by calls from WebAccountManager or by calls from windows itself (when users do things on the accounts page in the Windows 10 Settings app) |
Probably possible.
Yes of course I'd appreciate that, but even if you don't, at least please make an external conventional contract that can be used in the service layer (i.e. VM), that everyone should follow (whether it's UWP, WinUI, WPF or whatever). |
That's great. Still, both |
@weitzhandler WebAccountProvider can sit in an app where you implement the interface you want. WebAccountManager does not directly implement your interface but you could wrap it in a service where your interface has multiple implementations. Frankly speaking I don't expect Microsoft to implement your requested changes soon (I'm not saying it is a bad idea, but I don't see them change these existing APIs), I would recommend the above as a workaround to unblock yourself. |
Yup. Sounds good enouh. |
I'm still asking for better documentation and improvements of these pieces (WebAccountManager & WebAccountProvider). If you're closing the issue, I'll open another one to ask specifically about that. |
I've opened this one, which targets my specific scenario. |
Proposal: Client side authentication manager
Summary
ASP.NET Identity is a magnificent tool to manage identity and authentication in the server side, including integration with EF Core, and is mature enough.
It would be complete, if there would be a client side framework, that knows how to interact with an Identity-enabled server that offers features like:
Thread.CurrentPrincipal
.IHttpClientFactory
, to allow generating authentication-clients.[Authorize(Roles = RoleNames.Admin)]
attribute on a ViewModel to only enable it for admins, etc.Rationale
Based on my understanding, Reunion is the largest .NET client-side project, and as such, although not directly a WinUI feature request, is a client-specific feature request in the .NET.
Cross posted from here.
The text was updated successfully, but these errors were encountered: