Skip to content

Commit

Permalink
Create login-page.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdriscoll authored Nov 14, 2017
1 parent 264115f commit 020da41
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples/universal-dashboard/login-page.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Import-Module UniversalDashboard

$FormLogin = New-UDAuthenticationMethod -Endpoint {
param([PSCredential]$Credentials)

if ($Credentials.UserName -eq "Adam" -and $Credentials.GetNetworkCredential().Password -eq "SuperSecretPassword") {
New-UDAuthenticationResult -Success -UserName "Adam"
}

New-UDAuthenticationResult -ErrorMessage $Credentials.GetNetworkCredential().Password
}

$MicrosoftLogin = New-UDAuthenticationMethod -AppId "xyz" -AppSecret "123" -Provider Microsoft

$LoginPage = New-UDLoginPage -AuthenticationMethod @($FormLogin, $MicrosoftLogin)

$MyDashboardPage = New-UDPage -Url "/myDashboard" -Endpoint {
New-UDCard -Title "Welcome, $User" -Text "This is your custom dashboard."
}

$Dashboard = New-UDDashboard -LoginPage $LoginPage -Page @(
$MyDashboardPage
)

Start-UDDashboard -Dashboard $Dashboard -Port 10000

0 comments on commit 020da41

Please sign in to comment.