-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add Endpoints gRPC + JWT sample #419
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8a7b05b
Add Endpoints gRPC + JWT sample
b93eed2
Report parameter error through yargs instead of throwing it
0d173d1
Fix lint
6b23575
Address comments
bc2eba2
Merge branch 'master' into endpoints-authtoken
d5f8a92
Address jeffmendoza's comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Copyright 2017 Google Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# | ||
# An example API configuration. | ||
# | ||
# Below, replace MY_PROJECT_ID with your Google Cloud Project ID. | ||
# | ||
|
||
# The configuration schema is defined by service.proto file | ||
# https://github.com/googleapis/googleapis/blob/master/google/api/service.proto | ||
type: google.api.Service | ||
config_version: 3 | ||
|
||
# | ||
# Name of the service configuration. | ||
# | ||
name: hellogrpc.endpoints.MY_PROJECT_ID.cloud.goog | ||
|
||
# | ||
# API title to appear in the user interface (Google Cloud Console). | ||
# | ||
title: Hello gRPC API | ||
apis: | ||
- name: helloworld.Greeter | ||
|
||
# | ||
# API usage restrictions | ||
# | ||
usage: | ||
rules: | ||
# None of these API methods require an API key | ||
# N.B: JWTs are not a substitute for API keys | ||
- selector: "*" | ||
allow_unregistered_calls: true | ||
|
||
# | ||
# Request authentication (in this case, a JWT) | ||
# | ||
authentication: | ||
providers: | ||
- id: google_service_account | ||
# Replace SERVICE-ACCOUNT-ID with your service account's email address. | ||
issuer: SERVICE-ACCOUNT-ID | ||
jwks_uri: https://www.googleapis.com/robot/v1/metadata/x509/SERVICE-ACCOUNT-ID | ||
rules: | ||
# This auth rule will apply to all methods. | ||
- selector: "*" | ||
requirements: | ||
- provider_id: google_service_account |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,13 +15,15 @@ | |
"scripts": { | ||
"start": "node server.js", | ||
"system-test": "ava -T 30s --verbose system-test/*.test.js", | ||
"test": "npm run system-test" | ||
"test": "semistandard && npm run system-test" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should be using |
||
}, | ||
"dependencies": { | ||
"body-parser": "1.17.2", | ||
"express": "4.15.3", | ||
"grpc": "1.3.8", | ||
"yargs": "8.0.2" | ||
"yargs": "8.0.2", | ||
"google-auth-library": "^0.10.0", | ||
"jsonwebtoken": "^7.4.1" | ||
}, | ||
"devDependencies": { | ||
"@google-cloud/nodejs-repo-tools": "1.4.15", | ||
|
@@ -33,7 +35,9 @@ | |
"requiredEnvVars": [ | ||
"ENDPOINTS_API_KEY", | ||
"ENDPOINTS_GCE_HOST", | ||
"ENDPOINTS_GKE_HOST" | ||
"ENDPOINTS_GKE_HOST", | ||
"ENDPOINTS_SERVICE_NAME", | ||
"GOOGLE_APPLICATION_CREDENTIALS" | ||
] | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add instructions for using jwt here too.