

Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.

# HttpApiAuth
<a name="sam-property-httpapi-httpapiauth"></a>

Konfigurieren Sie die Autorisierung, um den Zugriff auf Ihre Amazon API Gateway Gateway-HTTP-API zu kontrollieren.

Weitere Informationen zur Konfiguration des Zugriffs auf HTTP APIs finden Sie unter [Steuern und Verwalten des Zugriffs auf eine HTTP-API in API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-access-control.html) im *API Gateway Developer Guide*.

## Syntax
<a name="sam-property-httpapi-httpapiauth-syntax"></a>

Verwenden Sie die folgende Syntax, um diese Entität in Ihrer Vorlage AWS Serverless Application Model (AWS SAM) zu deklarieren.

### YAML
<a name="sam-property-httpapi-httpapiauth-syntax.yaml"></a>

```
  [Authorizers](#sam-httpapi-httpapiauth-authorizers): OAuth2Authorizer | LambdaAuthorizer
  [DefaultAuthorizer](#sam-httpapi-httpapiauth-defaultauthorizer): String
  [EnableIamAuthorizer](#sam-httpapi-httpapiauth-enableiamauthorizer): Boolean
```

## Eigenschaften
<a name="sam-property-httpapi-httpapiauth-properties"></a>

 `Authorizers`   <a name="sam-httpapi-httpapiauth-authorizers"></a>
Der Autorisierer, der zur Steuerung des Zugriffs auf Ihre API-Gateway-API verwendet wird.  
*Typ*: [OAuth2Authorizer \$1 [LambdaAuthorizer](sam-property-httpapi-lambdaauthorizer.md)](sam-property-httpapi-oauth2authorizer.md)  
*Required*: No  
*Standard*: Keiner  
*CloudFormation Kompatibilität*: Diese Eigenschaft ist einzigartig für AWS SAM und hat kein CloudFormation Äquivalent.  
*Zusätzliche Hinweise*: AWS SAM Fügt die Autorisierer zur OpenAPI-Definition hinzu.

 `DefaultAuthorizer`   <a name="sam-httpapi-httpapiauth-defaultauthorizer"></a>
Geben Sie den Standard-Authorizer an, der für die Autorisierung von API-Aufrufen an Ihre API-Gateway-API verwendet werden soll. Sie können ihn `AWS_IAM` als Standardautorisierer angeben, wenn er auf gesetzt `EnableIamAuthorizer` ist. `true` Geben Sie andernfalls einen Autorisierer an, den Sie in definiert haben. `Authorizers`  
*Typ:* Zeichenfolge  
*Required*: No  
*Standard*: Keiner  
*CloudFormation Kompatibilität*: Diese Eigenschaft ist einzigartig für AWS SAM und hat kein CloudFormation Äquivalent.

 `EnableIamAuthorizer`   <a name="sam-httpapi-httpapiauth-enableiamauthorizer"></a>
Geben Sie an, ob die IAM-Autorisierung für die API-Route verwendet werden soll.  
*Typ*: Boolesch  
*Required*: No  
*CloudFormation Kompatibilität*: Diese Eigenschaft ist einzigartig für AWS SAM und hat kein CloudFormation Äquivalent.

## Beispiele
<a name="sam-property-httpapi-httpapiauth--examples"></a>

### OAuth 2.0 Autorisierer
<a name="sam-property-httpapi-httpapiauth--examples--oauth-2.0-authorizer"></a>

OAuth Beispiel für einen 2.0-Authorizer

#### YAML
<a name="sam-property-httpapi-httpapiauth--examples--oauth-2.0-authorizer--yaml"></a>

```
Auth:
  Authorizers:
    OAuth2Authorizer:
      AuthorizationScopes:
        - scope1
        - scope2
      JwtConfiguration:
        issuer: "https://www.example.com/v1/connect/oauth2"
        audience:
          - MyApi
      IdentitySource: "$request.querystring.param"
  DefaultAuthorizer: OAuth2Authorizer
```

### Ein IAM-Autorisierer
<a name="sam-property-httpapi-httpapiauth--examples--iam-authorizer"></a>

Beispiel für einen IAM-Autorisierer

#### YAML
<a name="sam-property-httpapi-httpapiauth--examples--iam-authorizer--yaml"></a>

```
Auth:
  EnableIamAuthorizer: true
  DefaultAuthorizer: AWS_IAM
```