Skip to content
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

Auth API cleanup - First steps #119

Merged
4 commits merged into from
Sep 26, 2016
Merged

Auth API cleanup - First steps #119

4 commits merged into from
Sep 26, 2016

Conversation

ghost
Copy link

@ghost ghost commented Jul 27, 2016

First step towards #102

This PR provides the following improvements:

  1. Reorganization of the auth API into something more semantically correct
  2. Refactor of the auth.js code to make it simpler and more concise
  3. Extraction of the extractParams functions and checkSignature function in an isofunctional way.

auth.check = (request, log, awsService, data) => {
log.debug('running auth checks', { method: 'auth' });
function extractParams(request, log, awsService, data) {
log.trace('extracting authentication signature informations');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

informations s/b information
do we want to use the "method" log format instead and state the function name?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by log format, do you mean the logged dictionnary ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as in {method: extractParams}

@ghost ghost force-pushed the dev/cleanup/AuthAPI-Step1 branch 2 times, most recently from 9a43094 to 3267fd0 Compare July 27, 2016 19:02
const payloadChecksum = crypto.createHash('sha256').update(payload)
.digest('hex');
const path = request.path;
Object.assign(request, { path: '/' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should come out. I did pr to remove but it appears the rebase did not catch it since the function changed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you point me and @AntoninCoulibaly (who will take up these PRs in my absence) to the PR in question ? this would greatly help

const authHeader = request.headers.authorization;
// Check whether signature is in header
const checkFunctions = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's declare this outside the function :)

@ghost
Copy link

ghost commented Aug 5, 2016

Two little documentations nits for me. Good job otherwise.

@koolfunky
Copy link

Updated, the commits will be squash and clean after all comments addressed

@ghost
Copy link

ghost commented Aug 5, 2016

👍 once the lint errors are solved.

@koolfunky koolfunky force-pushed the dev/cleanup/AuthAPI-Step1 branch 2 times, most recently from d6ae49d to 2b1c8a9 Compare August 5, 2016 15:26
@koolfunky
Copy link

Updated, I removed lib/auth/vault.js and the associated tests

@ghost
Copy link
Author

ghost commented Aug 31, 2016

@ironman-machine Please validate this step :d (Yes I know, this is kinda new and shiny, and I wanted to play with it first !) 🎱
SCALITY_INTEGRATION_BRANCH=fix/nimrod-build-dep
SCALITY_FEDERATION_BRANCH=ft/dep-patcher-ansible
SCALITY_S3_BRANCH=dev/cleanup/AuthAPI-Step1
SCALITY_VAULT_BRANCH=dev/cleanup/AuthAPI-Step1
SCALITY_VAULTCLIENT_BRANCH=dev/cleanup/AuthAPI

@ironman-machine
Copy link
Contributor

Hello @DavidPineauScality,

Starting end to end procedure using the following payload:
{"SCALITY_INTEGRATION_BRANCH":"fix/nimrod-build-dep","SCALITY_FEDERATION_BRANCH":"ft/dep-patcher-ansible","SCALITY_S3_BRANCH":"dev/cleanup/AuthAPI-Step1","SCALITY_VAULT_BRANCH":"dev/cleanup/AuthAPI-Step1","SCALITY_VAULTCLIENT_BRANCH":"dev/cleanup/AuthAPI","DEFAULT_BRANCH":"master","SCALITY_ARSENAL_BRANCH":"dev/cleanup/AuthAPI-Step1"}

Please follow http://ci.ironmann.io/gh/scality/Integration/2827 for circle status.

@ghost
Copy link
Author

ghost commented Sep 8, 2016

@ironman-machine Please check (rebase still needed)
SCALITY_INTEGRATION_BRANCH=fix/nimrod-build-dep
SCALITY_FEDERATION_BRANCH=ft/dep-patcher-ansible
SCALITY_S3_BRANCH=dev/cleanup/AuthAPI-Step1
SCALITY_VAULT_BRANCH=dev/cleanup/AuthAPI-Step1
SCALITY_VAULTCLIENT_BRANCH=dev/cleanup/AuthAPI

@ironman-machine
Copy link
Contributor

Hello @DavidPineauScality,

Starting end to end procedure using the following payload:
{"SCALITY_INTEGRATION_BRANCH":"fix/nimrod-build-dep","SCALITY_FEDERATION_BRANCH":"ft/dep-patcher-ansible","SCALITY_S3_BRANCH":"dev/cleanup/AuthAPI-Step1","SCALITY_VAULT_BRANCH":"dev/cleanup/AuthAPI-Step1","SCALITY_VAULTCLIENT_BRANCH":"dev/cleanup/AuthAPI","DEFAULT_BRANCH":"master","SCALITY_ARSENAL_BRANCH":"dev/cleanup/AuthAPI-Step1"}

Please follow http://ci.ironmann.io/gh/scality/Integration/3046 for circle status.

@alexandre-merle
Copy link
Contributor

@ironman-machine You will work, i know that :)
SCALITY_INTEGRATION_BRANCH=fix/nimrod-build-dep
SCALITY_FEDERATION_BRANCH=ft/dep-patcher-ansible
SCALITY_S3_BRANCH=dev/cleanup/AuthAPI-Step1
SCALITY_VAULT_BRANCH=dev/cleanup/AuthAPI-Step1
SCALITY_VAULTCLIENT_BRANCH=dev/cleanup/AuthAPI

@ironman-machine
Copy link
Contributor

Hello @alexandre-merle,

Starting end to end procedure using the following payload:
{"SCALITY_INTEGRATION_BRANCH":"fix/nimrod-build-dep","SCALITY_FEDERATION_BRANCH":"ft/dep-patcher-ansible","SCALITY_S3_BRANCH":"dev/cleanup/AuthAPI-Step1","SCALITY_VAULT_BRANCH":"dev/cleanup/AuthAPI-Step1","SCALITY_VAULTCLIENT_BRANCH":"dev/cleanup/AuthAPI","DEFAULT_BRANCH":"master","SCALITY_ARSENAL_BRANCH":"dev/cleanup/AuthAPI-Step1"}

Please follow http://ci.ironmann.io/gh/scality/Integration/3055 for circle status.

@alexandre-merle
Copy link
Contributor

@ironman-machine Please, tell me i'm not wrong about rebase :D
SCALITY_INTEGRATION_BRANCH=fix/nimrod-build-dep
SCALITY_FEDERATION_BRANCH=ft/dep-patcher-ansible
SCALITY_S3_BRANCH=dev/cleanup/AuthAPI-Step1
SCALITY_VAULT_BRANCH=dev/cleanup/AuthAPI-Step1
SCALITY_VAULTCLIENT_BRANCH=dev/cleanup/AuthAPI

@ironman-machine
Copy link
Contributor

Hello @alexandre-merle,

Starting end to end procedure using the following payload:
{"SCALITY_INTEGRATION_BRANCH":"fix/nimrod-build-dep","SCALITY_FEDERATION_BRANCH":"ft/dep-patcher-ansible","SCALITY_S3_BRANCH":"dev/cleanup/AuthAPI-Step1","SCALITY_VAULT_BRANCH":"dev/cleanup/AuthAPI-Step1","SCALITY_VAULTCLIENT_BRANCH":"dev/cleanup/AuthAPI","DEFAULT_BRANCH":"master","SCALITY_ARSENAL_BRANCH":"dev/cleanup/AuthAPI-Step1"}

Please follow http://ci.ironmann.io/gh/scality/Integration/3799 for circle status.

@alexandre-merle
Copy link
Contributor

alexandre-merle commented Sep 20, 2016

@ironman-machine let's try again ^^

SCALITY_INTEGRATION_BRANCH=fix/nimrod-build-dep
SCALITY_FEDERATION_BRANCH=ft/dep-patcher-ansible
SCALITY_S3_BRANCH=dev/cleanup/AuthAPI-Step1
SCALITY_VAULT_BRANCH=dev/cleanup/AuthAPI-Step1
SCALITY_VAULTCLIENT_BRANCH=dev/cleanup/AuthAPI

@ironman-machine
Copy link
Contributor

Hello @alexandre-merle,

Starting end to end procedure using the following payload:
{"SCALITY_INTEGRATION_BRANCH":"fix/nimrod-build-dep","SCALITY_FEDERATION_BRANCH":"ft/dep-patcher-ansible","SCALITY_S3_BRANCH":"dev/cleanup/AuthAPI-Step1","SCALITY_VAULT_BRANCH":"dev/cleanup/AuthAPI-Step1","SCALITY_VAULTCLIENT_BRANCH":"dev/cleanup/AuthAPI","DEFAULT_BRANCH":"master","SCALITY_ARSENAL_BRANCH":"dev/cleanup/AuthAPI-Step1"}

Please follow http://ci.ironmann.io/gh/scality/Integration/4016 for circle status.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question: Was that test removal necessary? I'd rather not see the coverage fall further behind.

David Pineau and others added 4 commits September 26, 2016 14:17
Provides the following:
 - Reduces redundancy by removing known information from module and function
 names
 - Simplifies the way the check functions are exported in either auth scheme
 - Rework the code flow in checkSignature:
   - Now easier to follow (logic now appears through the code as a two-step
                           operation)
   - Improved logging (now only provides a few common messages with variable
                       parameters)
- Renames checkSignature into extractParams, as this function mostly extracts
the parameters from either the headers or the querystring to identify what kind
of auth to use
- Renames the data field of the returned data by extractParams into 'params',
as those are the real parameters for the signature check function that will
soon be extracted from the auth code.
- Simplifies the doAuth function as a first step towards its disappearance
  - with the refactor of auth API we can now remove unused files
      * lib/auth/vault.js
      * tests/unit/auth/v2/errorHandling.js
@ghost ghost force-pushed the dev/cleanup/AuthAPI-Step1 branch from 974bf57 to 87a86ec Compare September 26, 2016 12:25
@ghost
Copy link
Author

ghost commented Sep 26, 2016

@Michael-Zapata it's mostly due to the fact that my aim is to end with the removal of the doAuth function, so the associated tests are no longer relevant. That being said, other tests are still relying on it, so I'll try restoring the tests.

@ghost
Copy link
Author

ghost commented Sep 26, 2016

Also, please note that the removed tests were relying on the unused vault.js wrapper that was deleted alongside.

@ghost
Copy link
Author

ghost commented Sep 26, 2016

@ghost ghost merged commit 7dedb0a into master Sep 26, 2016
@ghost ghost deleted the dev/cleanup/AuthAPI-Step1 branch September 26, 2016 13:05
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants