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

Add oauth2 authorization code flow support #345

Merged
merged 10 commits into from
Jan 26, 2021
Merged

Conversation

thezultimate
Copy link
Member

Insert a description of your pull request (PR) here, and check off the boxes below when they are done.


Contributor checklist

  • 🎉 This PR closes #ISSUE_NUMBER.
  • 📜 I have broken down my PR into the following tasks:
    • Task 1
    • Task 2
  • 🤖 I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR.
  • 📖 I have considered adding a new entry in CHANGELOG.md, and added it if should be communicated there.

Copy link
Collaborator

@anders-kiaer anders-kiaer left a comment

Choose a reason for hiding this comment

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

This is great @thezultimate. 🎉👍🥳

One thing I've been thinking about: Should we remove the --oauth command line argument? Instead I have a suggestion we can discuss going along something like this:

  • Plugins (which are Python classes) can choose to have a @property method def oauth2(self): (or some other descriptive name.
  • In the jinja2 generated app script, if >=1 plugin instances have that property method defined AND it returns True during app startup, we do what you know do when --oauth2 is provided.

Being a plugin property method, the plugins will also be able to give True / False based on user configuration input in the YAML file (e.g. the plugin deduces that if user has not specified files on disk, it is expected to use external API etc... the logic here will be plugin specific).

We can take a short video session and discuss? I'm also open for contributing myself in the same PR here in order to move it to 🥅 .

@thezultimate thezultimate force-pushed the oauth2 branch 3 times, most recently from 4f7ba45 to cd16e81 Compare December 21, 2020 14:31
@thezultimate
Copy link
Member Author

thezultimate commented Jan 3, 2021

This is great @thezultimate. 🎉👍🥳

One thing I've been thinking about: Should we remove the --oauth command line argument? Instead I have a suggestion we can discuss going along something like this:

  • Plugins (which are Python classes) can choose to have a @property method def oauth2(self): (or some other descriptive name.
  • In the jinja2 generated app script, if >=1 plugin instances have that property method defined AND it returns True during app startup, we do what you know do when --oauth2 is provided.

Being a plugin property method, the plugins will also be able to give True / False based on user configuration input in the YAML file (e.g. the plugin deduces that if user has not specified files on disk, it is expected to use external API etc... the logic here will be plugin specific).

We can take a short video session and discuss? I'm also open for contributing myself in the same PR here in order to move it to 🥅 .

I think I have implemented the changes you suggested in the last commit. I have tested it and it worked as expected. Would it be possible for you to check? Or someone else if you are not available? Thanks.

Copy link
Collaborator

@anders-kiaer anders-kiaer left a comment

Choose a reason for hiding this comment

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

Nice refactoring @thezultimate ! 🎉 Now we are close on getting this into master.

Some comments below.

It would also be nice with a new paragraph in https://github.com/equinor/webviz-config/blob/master/CONTRIBUTING.md explaining this nice new optional feature for plugin authors🚀

@anders-kiaer anders-kiaer changed the title Added --oauth2 flag for Oauth2 authorization code flow Add oauth2 authorization code flow support Jan 4, 2021
Copy link
Collaborator

@HansKallekleiv HansKallekleiv left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Comment on lines 47 to 48
WEBVIZ_SESSION_SECRET_KEY environment variable is also needed for signing the
session cookie.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Replaced by autogenerated key, isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah yes, this should be removed :)

CHANGELOG.md Outdated
Comment on lines 9 to 12
### Changed
- [#345](https://github.com/equinor/webviz-config/pull/345) - Added Oauth2
Authorization Code flow support for Azure AD applications.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
### Changed
- [#345](https://github.com/equinor/webviz-config/pull/345) - Added Oauth2
Authorization Code flow support for Azure AD applications.
### Added
- [#345](https://github.com/equinor/webviz-config/pull/345) - Added Oauth2
Authorization Code flow support for Azure AD applications.
### Changed

@asnyv asnyv merged commit 693fd6b into equinor:master Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants