Skip to content

Commit

Permalink
Merge pull request #185 from KonPaw/add-aad-normalization
Browse files Browse the repository at this point in the history
Add AAD username normalization
  • Loading branch information
primetheus authored Oct 10, 2023
2 parents 9c37e64 + 846a635 commit d975887
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion githubapp/azuread.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ def get_group_members(self, token=None, group_name=None):
else:
username = user_info[self.USERNAME_ATTRIBUTE]
if self.AZURE_USER_IS_UPN:
username = username.split("@")[0]
if r"\\" in username:
username = username.split(r"\\")[1]
username = username.split("@")[0].split("#")[0].split("_")[0]
username = username.translate(str.maketrans("._!#^~", "------"))
username = username.lower()
if "EMU_SHORTCODE" in os.environ:
username = username + "_" + os.environ["EMU_SHORTCODE"]
user = {
Expand Down

0 comments on commit d975887

Please sign in to comment.