Use ADFS-based authentication inside ASP.NET Core to access a SQL Server using Windows authentication?

Crono

I have a SQL Server that's configured to use Windows authentication. The database administrator uses AD users and groups to grant / deny permissions on certain tables and procedures.

I also have web apps that communicate with ASP.NET Core Web APIs. These apps uses ADFS for authentication, so basically all users are registered into AD.

In a few of those APIs, I want to access data from SQL Server on behalf of the authenticated AD user, which means I can't use SQL Server authentication. I also can't use the integrated security mode, as it will then assume the identity of the account that runs the ASP.NET Core service.

My next thought was that I should try punctually impersonating the user, but I couldn't find a single working example of transforming an ADFS token into a WindowsIdentity object.

So how should I go with this? Can anyone point me in the right direction?

Matti Price

Part of the idea of ADFS is that it provides a token that ISN'T your Windows credentials on purpose. Imagine if you federated your domain with another service's so your users could login, but whatever service you allow it to connect to can now impersonate your windows credentials? They could use that to gain access back to your network.

Now, if your Web API runs under an account with sufficient permissions, you could simply have it impersonate the user based on username.

With that said, I can't say that it is the recommended way of securing database access, and you should really just have a SQL account for the Web API to access that database and provide information to the end user.

You can set up what's called Identity Delegation where your web app would request another impersonation token from ADFS on behalf of your end user.

https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/design/when-to-use-identity-delegation

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Windows Authentication with asp.net core

分類Dev

Connect to SQL Server Windows Authentication using DBeaver

分類Dev

Path based authentication in ASP.NET Core MVC 2.0

分類Dev

Custom Authentication using legacy user table in Asp.Net Core

分類Dev

ASP.Net Core SAML authentication

分類Dev

ASP.Net Core SAML authentication

分類Dev

ASP.Net Core SAML authentication

分類Dev

ASP.NET Core 2.0 authentication middleware

分類Dev

Windows Authentication in .net Core 2.1 application

分類Dev

Change authentication from no authentication to individual authentication in existing project of Asp.Net Core (MVC)

分類Dev

How to use Windows authentication to connect to Sql express?

分類Dev

Using Azure Active Directory authentication in ASP.NET Core 2.0 from Web App to Web API

分類Dev

ASP.Net Core SignalR authentication always responding with 403 - Forbidden

分類Dev

Show views based on authentication status in asp.net mvc

分類Dev

IIS PHP using Windows Authentication unable to connect to SQL Server 2008R2

分類Dev

Turn off / Disable windows authentication for asp.net-mvc

分類Dev

JWT Authentication for .net core 2.2 application not using Identity

分類Dev

ASP.NET Core内でADFSベースの認証を使用して、Windows認証を使用してSQL Serverにアクセスしますか?

分類Dev

WCF authentication using ASP.NET Membership Provider

分類Dev

identity server 4 windows authentication

分類Dev

How to implement Permission Based Access Control with Asp.Net Core

分類Dev

How to implement Permission Based Access Control with Asp.Net Core

分類Dev

How to redirect after Azure AD authentication to different controller action in ASP Net Core MVC

分類Dev

How to migrate asp.net core authentication to new Google SignIn service?

分類Dev

ASP.NET core 2.2: what is the expected behaviour of ChallengeResult when there are multiple authentication schemes configured?

分類Dev

How best to implement Google social sign-in authentication in ASP.NET Core?

分類Dev

ASP.NET web.config Forms Authentication, deny anonymous users, allow anonymous access for single files

分類Dev

Authentication Required - Python CGI on Windows Server

分類Dev

ASP.NET Web API with Windows Authentication lacks header WWW-Authenticate in response

Related 関連記事

  1. 1

    Windows Authentication with asp.net core

  2. 2

    Connect to SQL Server Windows Authentication using DBeaver

  3. 3

    Path based authentication in ASP.NET Core MVC 2.0

  4. 4

    Custom Authentication using legacy user table in Asp.Net Core

  5. 5

    ASP.Net Core SAML authentication

  6. 6

    ASP.Net Core SAML authentication

  7. 7

    ASP.Net Core SAML authentication

  8. 8

    ASP.NET Core 2.0 authentication middleware

  9. 9

    Windows Authentication in .net Core 2.1 application

  10. 10

    Change authentication from no authentication to individual authentication in existing project of Asp.Net Core (MVC)

  11. 11

    How to use Windows authentication to connect to Sql express?

  12. 12

    Using Azure Active Directory authentication in ASP.NET Core 2.0 from Web App to Web API

  13. 13

    ASP.Net Core SignalR authentication always responding with 403 - Forbidden

  14. 14

    Show views based on authentication status in asp.net mvc

  15. 15

    IIS PHP using Windows Authentication unable to connect to SQL Server 2008R2

  16. 16

    Turn off / Disable windows authentication for asp.net-mvc

  17. 17

    JWT Authentication for .net core 2.2 application not using Identity

  18. 18

    ASP.NET Core内でADFSベースの認証を使用して、Windows認証を使用してSQL Serverにアクセスしますか?

  19. 19

    WCF authentication using ASP.NET Membership Provider

  20. 20

    identity server 4 windows authentication

  21. 21

    How to implement Permission Based Access Control with Asp.Net Core

  22. 22

    How to implement Permission Based Access Control with Asp.Net Core

  23. 23

    How to redirect after Azure AD authentication to different controller action in ASP Net Core MVC

  24. 24

    How to migrate asp.net core authentication to new Google SignIn service?

  25. 25

    ASP.NET core 2.2: what is the expected behaviour of ChallengeResult when there are multiple authentication schemes configured?

  26. 26

    How best to implement Google social sign-in authentication in ASP.NET Core?

  27. 27

    ASP.NET web.config Forms Authentication, deny anonymous users, allow anonymous access for single files

  28. 28

    Authentication Required - Python CGI on Windows Server

  29. 29

    ASP.NET Web API with Windows Authentication lacks header WWW-Authenticate in response

ホットタグ

アーカイブ