New-PSUAuthenticationResult
SYNOPSIS
Returns an authentication result for forms authentication.
SYNTAX
New-PSUAuthenticationResult [-Claims <ScriptBlock>] [-Success] [-UserName <String>] [-ErrorMessage <String>]
[<CommonParameters>]DESCRIPTION
Returns an authentication result for forms authentication. This allows you to return the user name, whether the authentication was successful, custom claims and an error message when the user attempts to login.
EXAMPLES
Example 1
param($Credential)
if ($Credential.UserName -eq 'Adam')
{
New-PSUAuthenticationResult -UserName 'Adam' -Success
}
else
{
New-PSUAuthenticationResult -ErrorMessage "Hey! You aren't Adam"
}Returns a successful authentication result if the user name is 'Adam'. Returns a custom error message if that user is not.
PARAMETERS
-Claims
The claims to return from this authentication result. Claims typically are features of the current user account like the Active Directory group membership. Use the new-PSUAuthorizationClaim cmdlet to define these claims.
-ErrorMessage
The custom error message to return upon unsuccessful logins.
-Success
A switch parameter that signals that this authentication attempt was successful.
-UserName
The user name to set on the identity of the user logging in.
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -Verbose, -WarningAction, -WarningVariable, and -ProgressAction. For more information, see about_CommonParameters.
INPUTS
None
OUTPUTS
System.Object
NOTES
RELATED LINKS
Last updated
Was this helpful?