Hi everyone !
I am working on an IIS Dashboard with Windows Authentication.
I am trying to Grant a JsonWebToken by the SID group number to the current user then he would access a REST API that create AD account.
I can’t get it working so im wondering if it’s possible ? If it is, can you please tell me if my code is wrong?
Because i have tried the SID group number mecanism with authorization policies and it worked, but this is not working with authentication for me.
Do i need to assign a role with it or …?
This is my Dashboard code :
Enable-UDLogging
$SIDAuthentication = New-UDAuthenticationMethod -Endpoint {
param ($user)
if ($user.Identity.Groups -contains "S-1-5-21-3863940255-3118300250-830854111-512"){
$Session:Token = Grant-UDJsonWebToken -Identity "$user"
}
}
$DashAuthentication = New-UDAuthenticationMethod -Windows
$LoginPage = New-UDLoginPage -AuthenticationMethod @($DashAuthentication, $SIDAuthentication) -PassThru
$dashboard = New-UDDashboard -Title "Hello, IIS" -Content {
New-UDRow -Columns {
New-UDColumn -Size 12 -Endpoint {
New-UDHeading -Text "Logged in as $user"
New-UDInput -Title Account -Content{
New-UDInputField -Type textbox -Name "nom" -Placeholder "Nom"
New-UDInputField -Type textbox -Name "prenom" -Placeholder "Prenom"
} -Endpoint {
param(
$nom,
$prenom
)
Invoke-RestMethod -Uri "http://localhost:8081/api/login/account/$nom/$prenom" -Method Post -Headers @{Authorization = "Bearer $($Session:Token)"}
}
}
}
} -LoginPage $LoginPage
Start-UDDashboard -Wait -Dashboard $dashboard -AllowHttpForLogin -AdminMode
Thanks by advance !
Lucas R