Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(examples): update authorizers examples with comments on public endpoints #644

Merged
merged 1 commit into from
Oct 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/2016-10-31/api_cognito_auth/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Resources:
RestApiId: !Ref MyApi
Path: /
Method: GET
# NOTE: This endpoint is publicly accessible
Auth:
Authorizer: NONE
ProxyAny:
Expand All @@ -48,6 +49,7 @@ Resources:
RestApiId: !Ref MyApi
Path: /{proxy+}
Method: ANY
# NOTE: This endpoint is publicly accessible
Auth:
Authorizer: NONE
GetUsers:
Expand All @@ -56,6 +58,7 @@ Resources:
RestApiId: !Ref MyApi
Path: /users
Method: GET
# NOTE: This endpoint is publicly accessible
Auth:
Authorizer: NONE
GetUser:
Expand All @@ -64,6 +67,7 @@ Resources:
RestApiId: !Ref MyApi
Path: /users/{userId}
Method: GET
# NOTE: This endpoint is publicly accessible
Auth:
Authorizer: NONE
CreateUser:
Expand Down
9 changes: 8 additions & 1 deletion examples/2016-10-31/api_lambda_request_auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ The Authorizer Lambda Function in this example simply accepts an `auth` query st

## Running the example

Optional: Uncomment the following lines in `template.yaml` to enable a publicly accessible endpoint:

```yaml
# Auth:
# Authorizer: NONE
```

Deploy the example into your account:

```bash
Expand All @@ -15,7 +22,7 @@ aws cloudformation package --template-file template.yaml --output-template-file
aws cloudformation deploy --template-file ./template.packaged.yaml --stack-name sam-example-api-lambda-request-auth --capabilities CAPABILITY_IAM
```

Invoke the API's root endpoint `/` without an `auth` query string to see the API respond with a 200. In the SAM template, we explicitly state `Authorizer: NONE` to make this a public/open endpoint (the Authorizer Lambda Function is not invoked).
Invoke the API's root endpoint `/` without an `auth` query string to see the API respond with a 200 (assuming you followed the optional step above). In the SAM template, we explicitly state `Authorizer: NONE` to make this a public/open endpoint (the Authorizer Lambda Function is not invoked).

```bash
api_url=$(aws cloudformation describe-stacks --stack-name sam-example-api-lambda-request-auth --query 'Stacks[].Outputs[?OutputKey==`ApiURL`].OutputValue' --output text)
Expand Down
5 changes: 3 additions & 2 deletions examples/2016-10-31/api_lambda_request_auth/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ Resources:
RestApiId: !Ref MyApi
Path: /
Method: get
Auth:
Authorizer: NONE
# NOTE: Uncomment the two lines below to make `GET /` publicly accessible
# Auth:
# Authorizer: NONE
GetUsers:
Type: Api
Properties:
Expand Down
9 changes: 8 additions & 1 deletion examples/2016-10-31/api_lambda_token_auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ The Authorizer Lambda Function in this example simply accepts an `Authorization`

## Running the example

Optional: Uncomment the following lines in `template.yaml` to enable a publicly accessible endpoint:

```yaml
# Auth:
# Authorizer: NONE
```

Deploy the example into your account:

```bash
Expand All @@ -15,7 +22,7 @@ aws cloudformation package --template-file template.yaml --output-template-file
aws cloudformation deploy --template-file ./template.packaged.yaml --stack-name sam-example-api-lambda-token-auth --capabilities CAPABILITY_IAM
```

Invoke the API's root endpoint `/` without an `Authorization` header to see the API respond with a 200. In the SAM template, we explicitly state `Authorizer: NONE` to make this a public/open endpoint (the Authorizer Lambda Function is not invoked).
Invoke the API's root endpoint `/` without an `Authorization` header to see the API respond with a 200 (assuming you followed the optional step above). In the SAM template, we explicitly state `Authorizer: NONE` to make this a public/open endpoint (the Authorizer Lambda Function is not invoked).

```bash
curl "$(aws cloudformation describe-stacks --stack-name sam-example-api-lambda-token-auth --query 'Stacks[].Outputs[?OutputKey==`ApiURL`].OutputValue' --output text)"
Expand Down
5 changes: 3 additions & 2 deletions examples/2016-10-31/api_lambda_token_auth/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ Resources:
RestApiId: !Ref MyApi
Path: /
Method: get
Auth:
Authorizer: NONE
# NOTE: Uncomment the two lines below to make `GET /` publicly accessible
# Auth:
# Authorizer: NONE
GetUsers:
Type: Api
Properties:
Expand Down