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

New feature json web tokens - related to old issue SK-16 #342

Merged
merged 5 commits into from Feb 17, 2022

Conversation

Wrede
Copy link
Collaborator

@Wrede Wrede commented Feb 7, 2022

Status

  • Ready
  • Draft
  • Hold

Description

Included in this pr:

  • A token is generated (encoded) by json web tokens (jwt) based on the payload (including expire date and current date)
  • Expire date is set to 90 days
  • Adding the boolean flag --token will generate the token, by default false
  • If a token has been generated, combiner and clients must send the token via header in the request
  • If no token is used, the reducer will ignore the header.
  • The encryption alg. for encoding and decoding is set to HS256
  • obs the cli/tests does not currently work due to wrong reference import (no parent package, cli is not included in fedn module)
  • Obs. merge with develop needed because of PR Sk 56 #341

Types of changes

What types of changes does your code introduce to FEDn?

  • Hotfix (fixing a critical bug in production)
  • Bugfix
  • New feature
  • Documentation update

Checklist

If you're unsure about any of the items below, don't hesitate to ask. We're here to help!
This is simply a reminder of what we are going to look for before merging your code.

  • [x ] This pull request is against develop branch (not applicable for hotfixes)
  • I have included a link to the issue on GitHub or JIRA (if any)
  • I have included migration files (if there are changes to the model classes)
  • I have read the CONTRIBUTING doc
  • I have included tests to complement my changes
  • I have updated the related documentation (if necessary)
  • I have added a reviewer for this pull request
  • I have added myself as an author for this pull request

Further comments

Anything else you think we should know before merging your code!

@mcapuccini
Copy link
Contributor

mcapuccini commented Feb 10, 2022

I will review it soon SK-74

@mcapuccini
Copy link
Contributor

Is there any documentation on how to test this?

@Wrede
Copy link
Collaborator Author

Wrede commented Feb 14, 2022

No, since there is no docs for CLI, nor help string in click.
´fedn run reducer --token´ will generate and use token
´fedn run client --token='paste-token' if token is not provided, expect raise error -> connection failed

Copy link
Member

@ahellander ahellander left a comment

Choose a reason for hiding this comment

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

Looks good, tested and it works.

I think we should change so that the token is used by default and can optionally be turned off.

Copy link
Contributor

@mcapuccini mcapuccini left a comment

Choose a reason for hiding this comment

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

LGTM. I think for now it's best to have the token disabled by default. If we enable it we then need some way to pass the one time token to the quickstart compose deployments. I will look into it later when I'll refactor the compose yamls.

@ahellander
Copy link
Member

Good point @mcapuccini I did not think of that. A reasonable solution there though is to be able to just set the token in the config files. But I am ok having it disabled by default for now. Actually, that would also be a bit nicer to users, then they get a couple of versions to adapt their deployment automation also.

@mcapuccini
Copy link
Contributor

@ahellander sure, we should have it set in the config files later on. We could have the token generation as an additional step before the deployment. If we have a default token pushed to the GitHub configs is like disabling the token by default. My thinking is that we could explicitly disable it instead :)

@ahellander
Copy link
Member

ahellander commented Feb 15, 2022 via email

@Wrede
Copy link
Collaborator Author

Wrede commented Feb 16, 2022

@ahellander you requested change, but I think you decided to keep it as is based on the discussion above? Please approve if so.

@ahellander
Copy link
Member

ahellander commented Feb 16, 2022 via email

@Wrede
Copy link
Collaborator Author

Wrede commented Feb 16, 2022

@ahellander great, please approve this PR

@Wrede
Copy link
Collaborator Author

Wrede commented Feb 16, 2022

Forgot that we should probably remove token in combiner-settings.yaml.template. Will do ASAP tomorrow.

@Wrede Wrede merged commit c0501d7 into develop Feb 17, 2022
@Wrede Wrede deleted the feature/SK-16 branch February 17, 2022 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants