Spring til indhold
For the complete documentation index, see llms.txt. This page is also available as Markdown.

New-PSUAuthorizationClaim

Synopsis

Opretter et nyt autorisationsclaim.

Syntaks

New-PSUAuthorizationClaim -Type <String> -Value <String> [-ValueType <String>] [-Properties <Hashtable>]
 [-Issuer <String>] [<CommonParameters>]

Beskrivelse

Opretter et nyt autorisationsclaim. Denne cmdlet bør bruges i scriptblokken Set-PSUAuthenticationMethod til at tildele claims til den bruger, der godkendes.

Eksempler

Eksempel 1

Set-PSUAuthenticationMethod -ScriptBlock {
    param([PSCredential]$Credential)

    if ($Credential.UserName -eq 'admin')
    {
        New-PSUAuthenticationResult -Success -UserName 'admin' -Claims {
            New-PSUAuthorizationClaim -Type 'MyRole' -Value 'MyValue' -ValueType 'String' -Issuer 'Something'
        }
    }
    else 
    {
        New-PSUAuthenticationResult -ErrorMessage 'Hello'
    }
}

New-PSURole -Name 'CustomRole' -Policy {
    param($User)

    $User.HasClaim("MyRole", "MyValue")
}

Godkender en bruger med navnet 'admin' og tilføjer et brugerdefineret autorisationsclaim. Autorisationsclaims kan bruges i scripts til rollepolitik og er tilgængelige i dashboards.

Parametre

-Issuer

Udstederen af autorisationsclaimet.

-Properties

En hashtable med egenskaber, der skal medtages sammen med claimet.

-Type

Typen af claim.

-Value

Værdien af claimet.

-ValueType

Værditypen for claimet.

CommonParameters

Denne cmdlet understøtter de fælles parametre: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -Verbose, -WarningAction, -WarningVariable og -ProgressAction. Se about_CommonParameters for at få flere oplysninger.

Input

Ingen

Output

System.Object

Noter

Sidst opdateret

Var dette nyttigt?