Skip to content

Commit

Permalink
Merge pull request #149 from Seykotron/master
Browse files Browse the repository at this point in the history
#116 Raise PermissionDenied when token is lacking information needed to create a user.
  • Loading branch information
JonasKs authored Mar 25, 2021
2 parents 4b6f796 + b17fc45 commit 87237a4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions django_auth_adfs/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ def create_user(self, claims):
# Create the user
username_claim = settings.USERNAME_CLAIM
usermodel = get_user_model()

if not claims.get(username_claim):
logger.error("User claim's doesn't have the claim '%s' in his claims: %s" % (username_claim, claims))
raise PermissionDenied
userdata = {usermodel.USERNAME_FIELD: claims[username_claim]}

try:
Expand Down

0 comments on commit 87237a4

Please sign in to comment.