AD Auth with login page

To use windows auth do you need to setup the claims based auth? Do you set the permissions on the webroot directory like you would any other site?

I added this to my code but everyone can still get to the site. I disabled anonymous, and set the web.config. My account and the service account are the only ones assigned to the webroot directory

$Auth = New-UDAuthenticationMethod -Windows
$LoginPage = New-UDLoginPage -AuthenticationMethod @($Auth) -PassThru

$Dashboard = New-UDDashboard -Title “Dashboard” -Pages @($Page1, $Page2, $Page3, $Page4) -LoginPage $LoginPage 

Start-UDDashboard -Wait -Dashboard $Dashboard -AllowHttpForLogin

Hey @gerard I use Active Directory security groups and either allow or deny access depending if the user is in the required security group…if this would be of use to you


So that is it’s own page and I call that from the main dashboard like so:-

I hope this helps :slight_smile:

That is awesome. Thank you. If i wanted to allow more than one group would I just add and elseif to the end of the formslogin page?

Yeah man just put it in

 if ((Test-Credential -Credential $Credentials)) {
        if (Get-ADGroupMembers "YOUR_SECURITY_GROUP_NAME" | Where-Object { $_.SamAccountName -match $Credentials.UserName }) {
            New-UDAuthenticationResult -Success -UserName $Credentials.UserName
        }
    }

You can also set it on the menu so people have access to certain menus can post that method too if interested…?

I may do the menu thing in the future but for now I am good. Thanks so much, you saved me a ton of time.

1 Like

This worked great

Seems after 20 mins or so after the page is refreshed im prompted to login again

Anyway to set the cookie so that id only be prompted after closing browser or clearing cache?

@Srichman0128 glad you found the thread I posted useful. As for changing the whole cookie setting, I believe from memory it is 25 minutes this is set to timeout to. I only know so much about this product, and to be totally honest I wouldn’t know where to change that specific setting off the top of my head…
However I did release this component
https://marketplace.universaldashboard.io/Dashboard/UniversalDashboard.UDTimeOut
Which has documentation on how to use on the project page here
https://github.com/psDevUK/UD-TimeOut
There is another discussion on the forum using this, and I believe it solved their problem they were having, so I hope this helps you out too. :grinning:

Hi,
@adam is New-UDAuthenticationMethod -Windows feature available for V3. This looks like the answer to all of my problems.

Yep. Here’s some info on that: https://docs.ironmansoftware.com/config/security#windows-authentication