Windows Authentication Restricts a Specific Domain

In my asp.net mpc application, I use windows authentication. The company has a user in several domains, such as "DOMAIN-A \ james, DOMAIN-B \ james". My application should only authenticate users in "DOMAIN-A". How to fail authentication for users of a domain other than users in "DOMAIN-A"

+4
source share
1 answer

Typically, this simply causes domain-b users to crash automatically (prohibiting special AD configurations, such as forests and trusted domains. Even then, luck is to get it working.)

It will only authenticate in the domain in which the authenticating web server is located.

In case both ARE domains are authorized, just check the username, which will include the domain.

public class Global : System.Web.HttpApplication { void WindowsAuthentication_OnAuthenticate(object sender, WindowsAuthenticationEventArgs e) { // ensure we have a name and made it through authentication if (e.Identity != null && e.Identity.IsAuthenticated) { } 

}

0
source

Source: https://habr.com/ru/post/1432997/


All Articles