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

feat: Added authentik as new identity provider #2168

Merged
merged 8 commits into from
Feb 15, 2024

Conversation

Yoyasp
Copy link
Contributor

@Yoyasp Yoyasp commented Nov 22, 2023

Description

Added Authentik as new identity provider.

This PR includes:

  • Authentik as new provider in the security manager.
  • Role mapping from Authentik groups
  • JWKS validation on Authentik tokens if provided in the config.py.
  • New exception if token signature cannot be validated.
  • Tests for the authentication for parsing the correct info, checking if the signature is valid and allowing unsigned tokens if specified in the config.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Is CRUD MVC related.
  • Is Auth, RBAC security related.
  • Changes the security db schema.
  • Introduces new feature
  • Removes existing feature

@Yoyasp Yoyasp changed the title feat - Added authentik as new identity provider feat: Added authentik as new identity provider Nov 22, 2023
Copy link

codecov bot commented Nov 22, 2023

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (59db85d) 79.31% compared to head (7d63e4a) 79.32%.

Files Patch % Lines
flask_appbuilder/security/manager.py 81.25% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2168   +/-   ##
=======================================
  Coverage   79.31%   79.32%           
=======================================
  Files          72       72           
  Lines        8974     9007   +33     
=======================================
+ Hits         7118     7145   +27     
- Misses       1856     1862    +6     
Flag Coverage Δ
python 79.32% <82.35%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

ncubed development host added 4 commits November 23, 2023 09:49
- Made the URI configurable
- Prevents malicous tokens from providing a fake jwks
- Fixed minor flake8 error
@Yoyasp
Copy link
Contributor Author

Yoyasp commented Nov 23, 2023

Some how flake8 keeps giving me errors in the CI pipeline, however i dont get any errors while running flake8 on my dev host...
Any help is appreciated.

@dpgaspar dpgaspar self-requested a review January 25, 2024 14:29
Copy link
Owner

@dpgaspar dpgaspar left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Owner

@dpgaspar dpgaspar left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, please remove the requests dependency

@dpgaspar
Copy link
Owner

Sorry for the delay, please remove the requests dependency

forget it we already depend on it, I'll open a PR to include it on extras

@dpgaspar dpgaspar merged commit 8e5cf22 into dpgaspar:master Feb 15, 2024
14 checks passed
resp = requests.get(jwks_url)
if resp.status_code == 200:
return resp.json()
return False
Copy link
Contributor

Choose a reason for hiding this comment

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

A bit late to the game but I am incorporating latest FAB changes to Airflow. I guess this should be a {} rather than False (or the return type should be dict | bool (but empty dict is likely better as it is Falsey value anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

...
You are right.

I don't know how I missed that 😧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants