|
| 1 | +# [START swagger] |
| 2 | +swagger: "2.0" |
| 3 | +info: |
| 4 | + description: "A simple Google Cloud Endpoints API example." |
| 5 | + title: "Endpoints Example" |
| 6 | + version: "1.0.0" |
| 7 | +host: "YOUR-PROJECT-ID.appspot.com" |
| 8 | +# [END swagger] |
| 9 | +basePath: "/" |
| 10 | +consumes: |
| 11 | +- "application/json" |
| 12 | +produces: |
| 13 | +- "application/json" |
| 14 | +schemes: |
| 15 | +- "https" |
| 16 | +paths: |
| 17 | + "/echo": |
| 18 | + post: |
| 19 | + description: "Echo back a given message." |
| 20 | + operationId: "echo" |
| 21 | + produces: |
| 22 | + - "application/json" |
| 23 | + responses: |
| 24 | + 200: |
| 25 | + description: "Echo" |
| 26 | + schema: |
| 27 | + $ref: "#/definitions/echoMessage" |
| 28 | + parameters: |
| 29 | + - description: "Message to echo" |
| 30 | + in: body |
| 31 | + name: message |
| 32 | + required: true |
| 33 | + schema: |
| 34 | + $ref: "#/definitions/echoMessage" |
| 35 | + security: |
| 36 | + - api_key: [] |
| 37 | + "/auth/info/googlejwt": |
| 38 | + get: |
| 39 | + description: "Returns the requests' authentication information." |
| 40 | + operationId: "auth_info_google_jwt" |
| 41 | + produces: |
| 42 | + - "application/json" |
| 43 | + responses: |
| 44 | + 200: |
| 45 | + description: "Authentication info." |
| 46 | + schema: |
| 47 | + $ref: "#/definitions/authInfoResponse" |
| 48 | + security: |
| 49 | + - google_jwt: [] |
| 50 | + - gae_default_service_account: [] |
| 51 | + - google_service_account: [] |
| 52 | + "/auth/info/googleidtoken": |
| 53 | + get: |
| 54 | + description: "Returns the requests' authentication information." |
| 55 | + operationId: "authInfoGoogleIdToken" |
| 56 | + produces: |
| 57 | + - "application/json" |
| 58 | + responses: |
| 59 | + 200: |
| 60 | + description: "Authentication info." |
| 61 | + schema: |
| 62 | + $ref: "#/definitions/authInfoResponse" |
| 63 | + security: |
| 64 | + - google_id_token: [] |
| 65 | + "/auth/info/firebase": |
| 66 | + get: |
| 67 | + description: "Returns the requests' authentication information." |
| 68 | + operationId: "authInfoFirebase" |
| 69 | + produces: |
| 70 | + - "application/json" |
| 71 | + responses: |
| 72 | + 200: |
| 73 | + description: "Authentication info." |
| 74 | + schema: |
| 75 | + $ref: "#/definitions/authInfoResponse" |
| 76 | + security: |
| 77 | + - firebase: [] |
| 78 | + |
| 79 | +definitions: |
| 80 | + echoMessage: |
| 81 | + properties: |
| 82 | + message: |
| 83 | + type: "string" |
| 84 | + authInfoResponse: |
| 85 | + properties: |
| 86 | + id: |
| 87 | + type: "string" |
| 88 | + email: |
| 89 | + type: "string" |
| 90 | +# [START securityDef] |
| 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 | +# [END securityDef] |
| 98 | + # This section configures authentication using Google API Service Accounts |
| 99 | + # to sign a json web token. This is mostly used for server-to-server |
| 100 | + # communication. |
| 101 | + google_jwt: |
| 102 | + authorizationUrl: "" |
| 103 | + flow: "implicit" |
| 104 | + type: "oauth2" |
| 105 | + # This must match the 'iss' field in the JWT. |
| 106 | + x-google-issuer: "jwt-client.endpoints.sample.google.com" |
| 107 | + # Update this with your service account's email address. |
| 108 | + x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/jwk/YOUR-SERVICE-ACCOUNT-EMAIL" |
| 109 | + # This must match the "aud" field in the JWT. You can add multiple audiences to accept JWTs from multiple clients. |
| 110 | + x-google-audiences: "echo.endpoints.sample.google.com" |
| 111 | + # This section configures authentication using Google App Engine default |
| 112 | + # service account to sign a json web token. This is mostly used for |
| 113 | + # server-to-server communication. |
| 114 | + gae_default_service_account: |
| 115 | + authorizationUrl: "" |
| 116 | + flow: "implicit" |
| 117 | + type: "oauth2" |
| 118 | + # Replace YOUR-CLIENT-PROJECT-ID with your client project ID. |
| 119 | + x-google-issuer: "YOUR-CLIENT-PROJECT-ID@appspot.gserviceaccount.com" |
| 120 | + # Replace YOUR-CLIENT-PROJECT-ID with your client project ID. |
| 121 | + x-google-jwks_uri: "https://www.googleapis.com/robot/v1/metadata/x509/YOUR-CLIENT-PROJECT-ID@appspot.gserviceaccount.com" |
| 122 | + # This must match the "aud" field in the JWT. You can add multiple audiences to accept JWTs from multiple clients. |
| 123 | + x-google-audiences: "echo.endpoints.sample.google.com" |
| 124 | + # This section configures authentication using a service account |
| 125 | + # to sign a json web token. This is mostly used for server-to-server |
| 126 | + # communication. |
| 127 | + google_service_account: |
| 128 | + authorizationUrl: "" |
| 129 | + flow: "implicit" |
| 130 | + type: "oauth2" |
| 131 | + # Replace YOUR-SERVICE-ACCOUNT-EMAIL with your service account email. |
| 132 | + x-google-issuer: "YOUR-SERVICE-ACCOUNT-EMAIL" |
| 133 | + # Replace YOUR-SERVICE-ACCOUNT-EMAIL with your service account email. |
| 134 | + x-google-jwks_uri: "https://www.googleapis.com/robot/v1/metadata/x509/YOUR-SERVICE-ACCOUNT-EMAIL" |
| 135 | + # This must match the "aud" field in the JWT. You can add multiple audiences to accept JWTs from multiple clients. |
| 136 | + x-google-audiences: "echo.endpoints.sample.google.com" |
| 137 | + # This section configures authentication using Google OAuth2 ID Tokens. |
| 138 | + # ID Tokens can be obtained using OAuth2 clients, and can be used to access |
| 139 | + # your API on behalf of a particular user. |
| 140 | + google_id_token: |
| 141 | + authorizationUrl: "" |
| 142 | + flow: "implicit" |
| 143 | + type: "oauth2" |
| 144 | + x-google-issuer: "https://accounts.google.com" |
| 145 | + x-google-jwks_uri: "https://www.googleapis.com/oauth2/v3/certs" |
| 146 | + # Your OAuth2 client's Client ID must be added here. You can add multiple client IDs to accept tokens form multiple clients. |
| 147 | + x-google-audiences: "YOUR-CLIENT-ID" |
| 148 | + # This section configures authentication using Firebase Auth. |
| 149 | + # [START firebaseAuth] |
| 150 | + firebase: |
| 151 | + authorizationUrl: "" |
| 152 | + flow: "implicit" |
| 153 | + type: "oauth2" |
| 154 | + x-google-issuer: "https://securetoken.google.com/YOUR-PROJECT-ID" |
| 155 | + x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/metadata/x509/securetoken@system.gserviceaccount.com" |
| 156 | + x-google-audiences: "YOUR-PROJECT-ID" |
| 157 | + # [END firebaseAuth] |
0 commit comments