-
Notifications
You must be signed in to change notification settings - Fork 24
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
iam: Phase I: API Key #151
Conversation
- iam_endpoint and apikey required - new CLI options and variables - test updates - docs Fixes: #147
var missingField = utils.isMissingField(this._options.credentials, Object.keys(Consts.exampleCredentials)); | ||
if (missingField.length !== 0) { | ||
throw new Error("g11n-pipeline: missing credentials fields: \"" + missingField.join(' ') + "\" - expected: " + Consts.exampleCredentialsString); | ||
if(this._options.credentials.apikey) { |
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.
if apikey
is present, assume it is IAM.
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.
the assumption is correct
if(this._options.basicAuth) { | ||
// ignore basicAuth. | ||
// throw Error('basicAuth is not supported'); // TODO: support this- maybe? | ||
if (this._options.credentials.apikey) { |
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.
if apikey
is present, use the IAM interceptor
|
||
const authHeader = this.API_KEY + ' ' + this.credentials.apikey; | ||
if(this.VERBOSE) console.log('hmacHeader = ' + authHeader); | ||
obj.headers.Authorization = authHeader; |
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.
this is the actual change.
note that actually |
lib/gp-iam.js
Outdated
if(obj.url.indexOf("/swagger.json") !== -1) return obj; // skip for swagger.json | ||
|
||
const authHeader = this.API_KEY + ' ' + this.credentials.apikey; | ||
if(this.VERBOSE) console.log('hmacHeader = ' + authHeader); |
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.
do we want to log actual API_KEY in console?
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.
only if VERBOSE is on.
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.
I understand that, but I wasn't sure if it should ever be logged, like we never log it in our server side code. So just wanted to make sure it is intentional. I don't know the best practice for JS.
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.
I will change it to Authorization: API-KEY ****
(using replace to obfuscate the actual apikey)
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.
LGTM
lib/gp-iam.js
Outdated
if(obj.url.indexOf("/swagger.json") !== -1) return obj; // skip for swagger.json | ||
|
||
const authHeader = this.API_KEY + ' ' + this.credentials.apikey; | ||
if(this.VERBOSE) console.log('hmacHeader = ' + authHeader); |
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.
Do you really want hmacHeader=
here?
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.
it's a debug comment, i can change it to authHeader
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.
LGTM
Fixes #147