You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 9, 2024. It is now read-only.
@@ -799,7 +797,7 @@ API Gateway hosts serving the API endpoints will be shown during deployment.
799
797
$ serverless deploy
800
798
...
801
799
endpoints:
802
-
GET https://xxx-gws.api-gw.mybluemix.net/service_name/api/path --> service_name-dev-my_function
800
+
GET https://xxx-gws.api-gw.mybluemix.net/service_name/api/greeting --> service_name-dev-my_function
803
801
```
804
802
805
803
Calling the configured API endpoints will execute the deployed functions.
@@ -849,6 +847,99 @@ resources:
849
847
cors: false
850
848
```
851
849
850
+
### Application Authentication
851
+
852
+
API endpoints can be protected by API keys with a secret or API keys alone.
853
+
854
+
Setting the HTTP headers used to pass keys and secrets automatically enables API Gateway authentication.
855
+
856
+
This parameter configures the HTTP header containing the API key. Without the additional secret header, authentication uses an API key alone.
857
+
858
+
```yaml
859
+
resources:
860
+
apigw:
861
+
auth:
862
+
key: API-Key-Header
863
+
```
864
+
865
+
Adding the secret header parameter enables authentication using keys with secrets.
866
+
867
+
```yaml
868
+
resources:
869
+
apigw:
870
+
auth:
871
+
key: API-Key-Header
872
+
secret: API-Key-Secret-Header
873
+
```
874
+
875
+
*See the API Gateway [configuration panel](https://cloud.ibm.com/openwhisk/apimanagement) to manage API keys and secrets after authentication is enabled.*
876
+
877
+
### Application Authentication with OAuth
878
+
879
+
API endpoints can also be protected by an external OAuth providers.
880
+
881
+
OAuth tokens must be included as the Authorization header of each API request. Token will be validated with the specified token provider. If the token is invalid, requests are rejected with response code 401.
882
+
883
+
The following OAuth providers are supported: *[IBM Cloud App ID](https://cloud.ibm.com/catalog/services/app-id), Google, Facebook and Github.*
884
+
885
+
```yaml
886
+
resources:
887
+
apigw:
888
+
oauth:
889
+
provider: app-id || google || facebook || github
890
+
```
891
+
892
+
If the `app-id` provider is selected, the tenant identifier must be provided as an additional configuration token. This can be retrieved from the `tenantId` property of provisioned service credentials for the instance
893
+
894
+
```yaml
895
+
resources:
896
+
apigw:
897
+
oauth:
898
+
provider: app-id
899
+
tenant: uuid
900
+
```
901
+
902
+
*Application Authentication with keys (and secrets) and OAuth support are mutually exclusive configuration options.*
903
+
904
+
### Rate Limiting
905
+
906
+
API Gateways endpoints support rate limiting to reject excess traffic. When rate limiting is enabled, API calls falling outside of the limit will be rejected and response code 429 will be returned.
907
+
908
+
**Rate limiting is on a per-key basis and application authentication (without oauth) must be enabled.**
909
+
910
+
The leaky bucket algorithm is used to prevent sudden bursts of invocations of APIs. If the limit is set as 10 calls per minute, users will be restricted to 1 call every 6 seconds (60/10 = 6).
911
+
912
+
```yaml
913
+
resources:
914
+
apigw:
915
+
rate_limit:
916
+
rate: 100
917
+
unit: minute || second || hour || day
918
+
```
919
+
920
+
- `rate`: number of API calls per unit of time.
921
+
- `unit`: unit of time (*minute, second, hour, day*) used to threshold API calls with rate.
922
+
923
+
### Base Path
924
+
925
+
All API Gateway endpoints defined as HTTP events in the `serverless.yml` are deployed under the default base path (`/`). This basepath can be configured explicitly using the following parameter.
926
+
927
+
```yaml
928
+
resources:
929
+
apigw:
930
+
basepath: /api
931
+
```
932
+
933
+
### API Name
934
+
935
+
The service name is used as the API identifier in the API Gateway swagger files. This can be configured explicitly using the following parameter.
936
+
937
+
```yaml
938
+
resources:
939
+
apigw:
940
+
name: my-api-name
941
+
```
942
+
852
943
## Exporting Web Actions
853
944
854
945
Functions can be turned into "*web actions*" which return HTTP content without use of an API Gateway. This feature is enabled by setting an annotation (`web-export`) in the configuration file.
0 commit comments