Search This Blog

Tuesday, November 21, 2017

Security - How to add OAuth2 authentication to a WinForms app

UPDATE:
XAF WinForms UI v23.2+ natively supports OAuth2 providers such as Microsoft Entra ID, Google, etc. - Documentation. The custom solution below is no longer required.

----
This is another example of how flexible the security module and our framework are. My colleague Michael has recently published an example on how to use the Microsoft, Google, Facebook or any compatible authentication provider within an XAF WinForms app:
https://www.devexpress.com/kb=T567978


This implementation is based on public community resources like StackOverFlow, so research the links in code comments for more details.

If you are looking for an ASP.NET example, do not miss the article we published earlier:
How to: Use Google, Facebook and Microsoft accounts in ASP.NET XAF applications (OAuth2 authentication demo)

Your feedback is needed!
Originally, we were not going to make a WinForms counterpart, because there were only a couple of requests for it + the whole scenario looked rare for desktop apps.
What is your own experience with it? Have you ever had such integration requests from your end-users? What providers do they need to cover most? Please let us know.

6 comments:

  1. We use a custom user class with a property IsWindowsUserName, so every customer can decide if he uses name/pwd or AD authentication. The authentication is implemented in a custom Authentication class similar to AuthenticationActiveDirectory and AuthenticationStandard.

    ReplyDelete
    Replies
    1. Thanks for sharing, Olaf. Do you have clients who need Office 365 or G Suite logins?

      Delete
    2. No, none of our customers wants to use any other login than Pwd or AD.

      Delete
  2. "Originally, we were not going to make a WinForms counterpart, because there were only a couple of requests for it + the whole scenario looked rare for desktop apps." ... I appreciate it much that you included this example too!

    ReplyDelete
    Replies
    1. For an example of integrating OAuth2 authentication in a WinForms XAF application, refer to the https://www.devexpress.com/Support/Center/Question/Details/T567978/security-how-to-add-oauth2-authentication-to-a-winforms-app ticket.
      Would you please also clarify which authentication providers you are going to use?

      Delete