Skip to content

New-PodeAuthApiKeyScheme

SYNOPSIS

Creates a new API Key Authentication Scheme.

SYNTAX

New-PodeAuthApiKeyScheme [[-Realm] <String>] [[-Location] <String>] [[-LocationName] <String>]
 [[-Secret] <String>] [[-Description] <String>] [[-Middleware] <Object[]>] [[-InnerScheme] <Hashtable>]
 [-AsJWT] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

Creates a new API Key Authentication Scheme.

EXAMPLES

EXAMPLE 1

$scheme = New-PodeAuthApiKeyScheme

EXAMPLE 2

$scheme = New-PodeAuthApiKeyScheme -Location 'Query' -LocationName 'my_api_key'

EXAMPLE 3

$scheme = New-PodeAuthApiKeyScheme -AsJWT

EXAMPLE 4

$scheme = New-PodeAuthApiKeyScheme -AsJWT -Secret 'my_secret_key

PARAMETERS

-AsJWT

Indicates whether the token should be issued as a JWT, and the payload supplied instead.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Description

An optional short description for Authentication Scheme. CommonMark syntax MAY be used for rich text representation.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-InnerScheme

An optional Authentication Scheme (such as New-PodeAuthBasicScheme) that will be called prior to this Scheme.

Type: Hashtable
Parameter Sets: (All)
Aliases:

Required: False
Position: 7
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Location

The location to look for the API Key, either Header, Query or Cookie. (Default: Header)

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: Header
Accept pipeline input: False
Accept wildcard characters: False

-LocationName

The name of the Header, Query or Cookie to look for the API Key. (Default: for Header/Cookie: X-API-KEY, for Query: api_key)

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Middleware

An optional array of Middleware ScriptBlocks to run before the Scheme's scriptblock.

Type: Object[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Realm

An optional Realm to use. (Default: User)

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: User
Accept pipeline input: False
Accept wildcard characters: False

-Secret

An optional secret key used for signing the token, enabling verification of the token's integrity.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Collections.Hashtable

NOTES