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/id token projects #684

Merged
merged 12 commits into from
Sep 4, 2019
Merged

Feat/id token projects #684

merged 12 commits into from
Sep 4, 2019

Conversation

Avantol13
Copy link
Contributor

@Avantol13 Avantol13 commented Aug 22, 2019

New Features

Breaking Changes

  • projects field (user access) removed from id_token for implicit client flow

Bug Fixes

Improvements

Dependency updates

Deployment changes

@github-actions
Copy link

github-actions bot commented Aug 22, 2019

This PR contains code that is not formatted correctly according to black. Run black on your code before merging.

Expand the full diff to see formatting changes
--- fence/jwt/token.py
+++ blackened
@@ -374,33 +374,33 @@
         },
         "azp": client_id or "",
     }
 
     if include_project_access:
-      # NOTE: "THIS IS A TERRIBLE STOP-GAP SOLUTION SO THAT USERS WITH
-      #       MINIMAL ACCESS CAN STILL USE LATEST VERSION OF FENCE
-      #       WITH VERSIONS OF PEREGRINE/SHEEPDOG THAT DO NOT CURENTLY
-      #       SUPPORT AUTHORIZATION CHECKS AGAINST ARBORIST (AND INSTEAD
-      #       RELY ON THE PROJECTS IN THE TOKEN). If the token is too large
-      #       everything breaks. I'm sorry" --See PXP-3717
-      if len(dict(user.project_access)) < config["TOKEN_PROJECTS_CUTOFF"]:
-          claims["context"]["user"]["projects"] = dict(user.project_access)
-      else:
-          # truncate to configured number of projects in token
-          projects = dict(user.project_access)
-          for key in list(projects)[config["TOKEN_PROJECTS_CUTOFF"]:]:
-              del projects[key]
-          claims["context"]["user"]["projects"] = projects
-          logger.warning(
-              "NOT including project_access = {} in claims for user {} because there are too many projects for the token\n".format(
-                  {
-                      k: dict(user.project_access)[k]
-                      for k in set(dict(user.project_access)) - set(projects)
-                  },
-                  user.username,
-              )
-          )
+        # NOTE: "THIS IS A TERRIBLE STOP-GAP SOLUTION SO THAT USERS WITH
+        #       MINIMAL ACCESS CAN STILL USE LATEST VERSION OF FENCE
+        #       WITH VERSIONS OF PEREGRINE/SHEEPDOG THAT DO NOT CURENTLY
+        #       SUPPORT AUTHORIZATION CHECKS AGAINST ARBORIST (AND INSTEAD
+        #       RELY ON THE PROJECTS IN THE TOKEN). If the token is too large
+        #       everything breaks. I'm sorry" --See PXP-3717
+        if len(dict(user.project_access)) < config["TOKEN_PROJECTS_CUTOFF"]:
+            claims["context"]["user"]["projects"] = dict(user.project_access)
+        else:
+            # truncate to configured number of projects in token
+            projects = dict(user.project_access)
+            for key in list(projects)[config["TOKEN_PROJECTS_CUTOFF"] :]:
+                del projects[key]
+            claims["context"]["user"]["projects"] = projects
+            logger.warning(
+                "NOT including project_access = {} in claims for user {} because there are too many projects for the token\n".format(
+                    {
+                        k: dict(user.project_access)[k]
+                        for k in set(dict(user.project_access)) - set(projects)
+                    },
+                    user.username,
+                )
+            )
 
     # only add google linkage information if provided
     if linked_google_email:
         claims["context"]["user"]["google"][
             "linked_google_account"

This formatting comment was generated automatically by a script in uc-cdis/wool.

@coveralls
Copy link

coveralls commented Aug 22, 2019

Pull Request Test Coverage Report for Build 7616

  • 5 of 11 (45.45%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage remained the same at ?%

Changes Missing Coverage Covered Lines Changed/Added Lines %
fence/oidc/grants/implicit_grant.py 0 1 0.0%
fence/jwt/token.py 5 10 50.0%
Files with Coverage Reduction New Missed Lines %
fence/oidc/jwt_generator.py 1 49.06%
Totals Coverage Status
Change from base Build 7612: 0.0%
Covered Lines:
Relevant Lines: 0

💛 - Coveralls

Avantol13 and others added 4 commits August 23, 2019 18:09
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.

3 participants