prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Get username from mailcow source
  **Is your feature request related to a problem? Please describe.**
  I like to get a username from mailcow. With username the enrollment for new users is more simple.
  
  **Describe the solution you'd like**
  Set username to full_name provided by mailcow oauths source.
  
  **Additional context**
  For other sources the username is also set redundant to another attribute if there is no special source attribute:
  azure_ad.py:
  ```
              "username": info.get("displayName"),
              "name": info.get("displayName"),
  ```
  
  discord.py:
  ```
              "username": info.get("username"),
              "name": info.get("username"),
  ```
  
  facebook.py:
  ```
              "username": info.get("name"),
              "name": info.get("name"),
  ```
  
  reddit.py
  ```
              "username": info.get("name"),
              "name": info.get("name"),
  ```
  
  
  </issue>
  <code>
  [start of authentik/sources/oauth/types/mailcow.py]
  1 """Mailcow OAuth Views"""
  2 from typing import Any, Optional
  3 
  4 from requests.exceptions import RequestException
  5 from structlog.stdlib import get_logger
  6 
  7 from authentik.sources.oauth.clients.oauth2 import OAuth2Client
  8 from authentik.sources.oauth.types.manager import MANAGER, SourceType
  9 from authentik.sources.oauth.views.callback import OAuthCallback
  10 from authentik.sources.oauth.views.redirect import OAuthRedirect
  11 
  12 LOGGER = get_logger()
  13 
  14 
  15 class MailcowOAuthRedirect(OAuthRedirect):
  16     """Mailcow OAuth2 Redirect"""
  17 
  18     def get_additional_parameters(self, source):  # pragma: no cover
  19         return {
  20             "scope": ["profile"],
  21         }
  22 
  23 
  24 class MailcowOAuth2Client(OAuth2Client):
  25     """MailcowOAuth2Client, for some reason, mailcow does not like the default headers"""
  26 
  27     def get_profile_info(self, token: dict[str, str]) -> Optional[dict[str, Any]]:
  28         "Fetch user profile information."
  29         profile_url = self.source.type.profile_url or ""
  30         if self.source.type.urls_customizable and self.source.profile_url:
  31             profile_url = self.source.profile_url
  32         try:
  33             response = self.session.request(
  34                 "get",
  35                 f"{profile_url}?access_token={token['access_token']}",
  36             )
  37             response.raise_for_status()
  38         except RequestException as exc:
  39             LOGGER.warning("Unable to fetch user profile", exc=exc, body=response.text)
  40             return None
  41         else:
  42             return response.json()
  43 
  44 
  45 class MailcowOAuth2Callback(OAuthCallback):
  46     """Mailcow OAuth2 Callback"""
  47 
  48     client_class = MailcowOAuth2Client
  49 
  50     def get_user_enroll_context(
  51         self,
  52         info: dict[str, Any],
  53     ) -> dict[str, Any]:
  54         return {
  55             "email": info.get("email"),
  56             "name": info.get("full_name"),
  57         }
  58 
  59 
  60 @MANAGER.type()
  61 class MailcowType(SourceType):
  62     """Mailcow Type definition"""
  63 
  64     callback_view = MailcowOAuth2Callback
  65     redirect_view = MailcowOAuthRedirect
  66     name = "Mailcow"
  67     slug = "mailcow"
  68 
  69     urls_customizable = True
  70
  [end of authentik/sources/oauth/types/mailcow.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/authentik/sources/oauth/types/mailcow.py b/authentik/sources/oauth/types/mailcow.py
  --- a/authentik/sources/oauth/types/mailcow.py
  +++ b/authentik/sources/oauth/types/mailcow.py
  @@ -52,6 +52,7 @@
           info: dict[str, Any],
       ) -> dict[str, Any]:
           return {
  +            "username": info.get("full_name"),
               "email": info.get("email"),
               "name": info.get("full_name"),
           }
  
verification_info: {"golden_diff": "diff --git a/authentik/sources/oauth/types/mailcow.py b/authentik/sources/oauth/types/mailcow.py\n--- a/authentik/sources/oauth/types/mailcow.py\n+++ b/authentik/sources/oauth/types/mailcow.py\n@@ -52,6 +52,7 @@\n         info: dict[str, Any],\n     ) -> dict[str, Any]:\n         return {\n+            \"username\": info.get(\"full_name\"),\n             \"email\": info.get(\"email\"),\n             \"name\": info.get(\"full_name\"),\n         }\n", "issue": "Get username from mailcow source\n**Is your feature request related to a problem? Please describe.**\r\nI like to get a username from mailcow. With username the enrollment for new users is more simple.\r\n\r\n**Describe the solution you'd like**\r\nSet username to full_name provided by mailcow oauths source.\r\n\r\n**Additional context**\r\nFor other sources the username is also set redundant to another attribute if there is no special source attribute:\r\nazure_ad.py:\r\n```\r\n            \"username\": info.get(\"displayName\"),\r\n            \"name\": info.get(\"displayName\"),\r\n```\r\n\r\ndiscord.py:\r\n```\r\n            \"username\": info.get(\"username\"),\r\n            \"name\": info.get(\"username\"),\r\n```\r\n\r\nfacebook.py:\r\n```\r\n            \"username\": info.get(\"name\"),\r\n            \"name\": info.get(\"name\"),\r\n```\r\n\r\nreddit.py\r\n```\r\n            \"username\": info.get(\"name\"),\r\n            \"name\": info.get(\"name\"),\r\n```\r\n\n", "before_files": [{"content": "\"\"\"Mailcow OAuth Views\"\"\"\nfrom typing import Any, Optional\n\nfrom requests.exceptions import RequestException\nfrom structlog.stdlib import get_logger\n\nfrom authentik.sources.oauth.clients.oauth2 import OAuth2Client\nfrom authentik.sources.oauth.types.manager import MANAGER, SourceType\nfrom authentik.sources.oauth.views.callback import OAuthCallback\nfrom authentik.sources.oauth.views.redirect import OAuthRedirect\n\nLOGGER = get_logger()\n\n\nclass MailcowOAuthRedirect(OAuthRedirect):\n    \"\"\"Mailcow OAuth2 Redirect\"\"\"\n\n    def get_additional_parameters(self, source):  # pragma: no cover\n        return {\n            \"scope\": [\"profile\"],\n        }\n\n\nclass MailcowOAuth2Client(OAuth2Client):\n    \"\"\"MailcowOAuth2Client, for some reason, mailcow does not like the default headers\"\"\"\n\n    def get_profile_info(self, token: dict[str, str]) -> Optional[dict[str, Any]]:\n        \"Fetch user profile information.\"\n        profile_url = self.source.type.profile_url or \"\"\n        if self.source.type.urls_customizable and self.source.profile_url:\n            profile_url = self.source.profile_url\n        try:\n            response = self.session.request(\n                \"get\",\n                f\"{profile_url}?access_token={token['access_token']}\",\n            )\n            response.raise_for_status()\n        except RequestException as exc:\n            LOGGER.warning(\"Unable to fetch user profile\", exc=exc, body=response.text)\n            return None\n        else:\n            return response.json()\n\n\nclass MailcowOAuth2Callback(OAuthCallback):\n    \"\"\"Mailcow OAuth2 Callback\"\"\"\n\n    client_class = MailcowOAuth2Client\n\n    def get_user_enroll_context(\n        self,\n        info: dict[str, Any],\n    ) -> dict[str, Any]:\n        return {\n            \"email\": info.get(\"email\"),\n            \"name\": info.get(\"full_name\"),\n        }\n\n\n@MANAGER.type()\nclass MailcowType(SourceType):\n    \"\"\"Mailcow Type definition\"\"\"\n\n    callback_view = MailcowOAuth2Callback\n    redirect_view = MailcowOAuthRedirect\n    name = \"Mailcow\"\n    slug = \"mailcow\"\n\n    urls_customizable = True\n", "path": "authentik/sources/oauth/types/mailcow.py"}]}