|
| 1 | +# Copyright 2017 Google Inc. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# [START swagger] |
| 16 | +swagger: "2.0" |
| 17 | +info: |
| 18 | + description: "A simple Google Cloud Endpoints API example." |
| 19 | + title: "Endpoints Example" |
| 20 | + version: "1.0.0" |
| 21 | +host: "YOUR-PROJECT-ID.appspot.com" |
| 22 | +# [END swagger] |
| 23 | +basePath: "/" |
| 24 | +consumes: |
| 25 | + - "application/json" |
| 26 | +produces: |
| 27 | + - "application/json" |
| 28 | +schemes: |
| 29 | + - "https" |
| 30 | +paths: |
| 31 | + "/echo": |
| 32 | + post: |
| 33 | + description: "Echo back a given message." |
| 34 | + operationId: "echo" |
| 35 | + produces: |
| 36 | + - "application/json" |
| 37 | + responses: |
| 38 | + 200: |
| 39 | + description: "Echo" |
| 40 | + schema: |
| 41 | + $ref: "#/definitions/echoMessage" |
| 42 | + parameters: |
| 43 | + - |
| 44 | + description: "Message to echo" |
| 45 | + in: body |
| 46 | + name: message |
| 47 | + required: true |
| 48 | + schema: |
| 49 | + $ref: "#/definitions/echoMessage" |
| 50 | + security: |
| 51 | + - api_key: [] |
| 52 | + "/auth/info/googlejwt": |
| 53 | + get: |
| 54 | + description: "Returns the requests' authentication information." |
| 55 | + operationId: "auth_info_google_jwt" |
| 56 | + produces: |
| 57 | + - "application/json" |
| 58 | + responses: |
| 59 | + 200: |
| 60 | + description: "Authenication info." |
| 61 | + schema: |
| 62 | + $ref: "#/definitions/authInfoResponse" |
| 63 | + security: |
| 64 | + - api_key: [] |
| 65 | + google_jwt: [] |
| 66 | + "/auth/info/googleidtoken": |
| 67 | + get: |
| 68 | + description: "Returns the requests' authentication information." |
| 69 | + operationId: "authInfoGoogleIdToken" |
| 70 | + produces: |
| 71 | + - "application/json" |
| 72 | + responses: |
| 73 | + 200: |
| 74 | + description: "Authenication info." |
| 75 | + schema: |
| 76 | + $ref: "#/definitions/authInfoResponse" |
| 77 | + security: |
| 78 | + - api_key: [] |
| 79 | + google_id_token: [] |
| 80 | +definitions: |
| 81 | + echoMessage: |
| 82 | + properties: |
| 83 | + message: |
| 84 | + type: "string" |
| 85 | + authInfoResponse: |
| 86 | + properties: |
| 87 | + id: |
| 88 | + type: "string" |
| 89 | + email: |
| 90 | + type: "string" |
| 91 | +securityDefinitions: |
| 92 | + # This section configures basic authentication with an API key. |
| 93 | + api_key: |
| 94 | + type: "apiKey" |
| 95 | + name: "key" |
| 96 | + in: "query" |
| 97 | + # This section configures authentication using Google API Service Accounts |
| 98 | + # to sign a json web token. This is mostly used for server-to-server |
| 99 | + # communication. |
| 100 | + google_jwt: |
| 101 | + authorizationUrl: "" |
| 102 | + flow: "implicit" |
| 103 | + type: "oauth2" |
| 104 | + # This must match the 'iss' field in the JWT. |
| 105 | + x-google-issuer: "jwt-client.endpoints.sample.google.com" |
| 106 | + # Update this with your service account's email address. |
| 107 | + x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/jwk/YOUR-SERVICE-ACCOUNT-EMAIL" |
| 108 | + # This must match the "aud" field in the JWT. You can add multiple |
| 109 | + # audiences to accept JWTs from multiple clients. |
| 110 | + x-google-audiences: "echo.endpoints.sample.google.com" |
| 111 | + # This section configures authentication using Google OAuth2 ID Tokens. |
| 112 | + # ID Tokens can be obtained using OAuth2 clients, and can be used to access |
| 113 | + # your API on behalf of a particular user. |
| 114 | + google_id_token: |
| 115 | + authorizationUrl: "" |
| 116 | + flow: "implicit" |
| 117 | + type: "oauth2" |
| 118 | + x-google-issuer: "https://accounts.google.com" |
| 119 | + x-google-jwks_uri: "https://www.googleapis.com/oauth2/v3/certs" |
| 120 | + # Your OAuth2 client's Client ID must be added here. You can add |
| 121 | + # multiple client IDs to accept tokens from multiple clients. |
| 122 | + x-google-audiences: "YOUR-CLIENT-ID" |
0 commit comments