< Back

New-PodeAuthType

Sat Jan 18, 2020 7:16 pm

NAME New-PodeAuthType



SYNOPSIS

Create a new type of Authentication.





SYNTAX

New-PodeAuthType [-Basic] [-Encoding <String>] [-HeaderTag <String>] [<CommonParameters>]



New-PodeAuthType [-Form] [-UsernameField <String>] [-PasswordField <String>] [<CommonParameters>]



New-PodeAuthType [-Custom] -ScriptBlock <ScriptBlock> [-ArgumentList <Hashtable>] [<CommonParameters>]





DESCRIPTION

Create a new type of Authentication, which is used to parse the Request for user credentials for validating.





PARAMETERS

-Basic [<SwitchParameter>]

If supplied, will use the inbuilt Basic Authentication credentials retriever.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Encoding <String>

The Encoding to use when decoding the Basic Authorization header.



Required? false

Position? named

Default value ISO-8859-1

Accept pipeline input? false

Accept wildcard characters? false



-HeaderTag <String>

The name of the type of Basic Authentication.



Required? false

Position? named

Default value Basic

Accept pipeline input? false

Accept wildcard characters? false



-Form [<SwitchParameter>]

If supplied, will use the inbuilt Form Authentication credentials retriever.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-UsernameField <String>

The name of the Username Field in the payload to retrieve the username.



Required? false

Position? named

Default value username

Accept pipeline input? false

Accept wildcard characters? false



-PasswordField <String>

The name of the Password Field in the payload to retrieve the password.



Required? false

Position? named

Default value password

Accept pipeline input? false

Accept wildcard characters? false



-Custom [<SwitchParameter>]

If supplied, will allow you to create a Custom Authentication credentials retriever.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-ScriptBlock <ScriptBlock>

The ScriptBlock to retrieve user credentials.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ArgumentList <Hashtable>

An array of arguments to supply to the Custom Authentication type's ScriptBlock.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

System.Collections.Hashtable





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>$basic_auth = New-PodeAuthType -Basic













-------------------------- EXAMPLE 2 --------------------------



PS C:\\>$form_auth = New-PodeAuthType -Form -UsernameField 'Email'













-------------------------- EXAMPLE 3 --------------------------



PS C:\\>$custom_auth = New-PodeAuthType -Custom -ScriptBlock { /* logic */ }















RELATED LINKS