sources/oauth: Add Mailcow oauth source (#2380)
* Feat: Add Mailcow oauth source * Feat: Add mailcow icon * Run make * Feat: Add tests * Fix: Remainder from discord test * Docs: Add mailcow oauth source docs * Docs: add mailcow source to menu * Fix: Mailcow provider type in test * Fix: Formatting * Fix: Doc file name
This commit is contained in:
		| @ -17,6 +17,7 @@ AUTHENTIK_SOURCES_OAUTH_TYPES = [ | |||||||
|     "authentik.sources.oauth.types.okta", |     "authentik.sources.oauth.types.okta", | ||||||
|     "authentik.sources.oauth.types.reddit", |     "authentik.sources.oauth.types.reddit", | ||||||
|     "authentik.sources.oauth.types.twitter", |     "authentik.sources.oauth.types.twitter", | ||||||
|  |     "authentik.sources.oauth.types.mailcow", | ||||||
| ] | ] | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
| @ -111,6 +111,16 @@ class GitHubOAuthSource(OAuthSource): | |||||||
|         verbose_name_plural = _("GitHub OAuth Sources") |         verbose_name_plural = _("GitHub OAuth Sources") | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class MailcowOAuthSource(OAuthSource): | ||||||
|  |     """Social Login using Mailcow.""" | ||||||
|  |  | ||||||
|  |     class Meta: | ||||||
|  |  | ||||||
|  |         abstract = True | ||||||
|  |         verbose_name = _("Mailcow OAuth Source") | ||||||
|  |         verbose_name_plural = _("Mailcow OAuth Sources") | ||||||
|  |  | ||||||
|  |  | ||||||
| class TwitterOAuthSource(OAuthSource): | class TwitterOAuthSource(OAuthSource): | ||||||
|     """Social Login using Twitter.com""" |     """Social Login using Twitter.com""" | ||||||
|  |  | ||||||
|  | |||||||
							
								
								
									
										38
									
								
								authentik/sources/oauth/tests/test_type_mailcow.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								authentik/sources/oauth/tests/test_type_mailcow.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,38 @@ | |||||||
|  | """Mailcow Type tests""" | ||||||
|  | from django.test import TestCase | ||||||
|  |  | ||||||
|  | from authentik.sources.oauth.models import OAuthSource | ||||||
|  | from authentik.sources.oauth.types.mailcow import MailcowOAuth2Callback | ||||||
|  |  | ||||||
|  | # https://community.mailcow.email/d/13-mailcow-oauth-json-format/2 | ||||||
|  | MAILCOW_USER = { | ||||||
|  |     "success": True, | ||||||
|  |     "username": "email@example.com", | ||||||
|  |     "identifier": "email@example.com", | ||||||
|  |     "email": "email@example.com", | ||||||
|  |     "full_name": "Example User", | ||||||
|  |     "displayName": "Example User", | ||||||
|  |     "created": "2020-05-15 11:33:08", | ||||||
|  |     "modified": "2020-05-15 12:23:31", | ||||||
|  |     "active": 1, | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class TestTypeMailcow(TestCase): | ||||||
|  |     """OAuth Source tests""" | ||||||
|  |  | ||||||
|  |     def setUp(self): | ||||||
|  |         self.source = OAuthSource.objects.create( | ||||||
|  |             name="test", | ||||||
|  |             slug="test", | ||||||
|  |             provider_type="mailcow", | ||||||
|  |             authorization_url="", | ||||||
|  |             profile_url="", | ||||||
|  |             consumer_key="", | ||||||
|  |         ) | ||||||
|  |  | ||||||
|  |     def test_enroll_context(self): | ||||||
|  |         """Test mailcow Enrollment context""" | ||||||
|  |         ak_context = MailcowOAuth2Callback().get_user_enroll_context(MAILCOW_USER) | ||||||
|  |         self.assertEqual(ak_context["email"], MAILCOW_USER["email"]) | ||||||
|  |         self.assertEqual(ak_context["name"], MAILCOW_USER["full_name"]) | ||||||
							
								
								
									
										69
									
								
								authentik/sources/oauth/types/mailcow.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								authentik/sources/oauth/types/mailcow.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,69 @@ | |||||||
|  | """Mailcow OAuth Views""" | ||||||
|  | from typing import Any, Optional | ||||||
|  |  | ||||||
|  | from requests.exceptions import RequestException | ||||||
|  | from structlog.stdlib import get_logger | ||||||
|  |  | ||||||
|  | from authentik.sources.oauth.clients.oauth2 import OAuth2Client | ||||||
|  | from authentik.sources.oauth.types.manager import MANAGER, SourceType | ||||||
|  | from authentik.sources.oauth.views.callback import OAuthCallback | ||||||
|  | from authentik.sources.oauth.views.redirect import OAuthRedirect | ||||||
|  |  | ||||||
|  | LOGGER = get_logger() | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class MailcowOAuthRedirect(OAuthRedirect): | ||||||
|  |     """Mailcow OAuth2 Redirect""" | ||||||
|  |  | ||||||
|  |     def get_additional_parameters(self, source):  # pragma: no cover | ||||||
|  |         return { | ||||||
|  |             "scope": ["profile"], | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class MailcowOAuth2Client(OAuth2Client): | ||||||
|  |     """MailcowOAuth2Client, for some reason, mailcow does not like the default headers""" | ||||||
|  |  | ||||||
|  |     def get_profile_info(self, token: dict[str, str]) -> Optional[dict[str, Any]]: | ||||||
|  |         "Fetch user profile information." | ||||||
|  |         profile_url = self.source.type.profile_url or "" | ||||||
|  |         if self.source.type.urls_customizable and self.source.profile_url: | ||||||
|  |             profile_url = self.source.profile_url | ||||||
|  |         try: | ||||||
|  |             response = self.session.request( | ||||||
|  |                 "get", | ||||||
|  |                 f"{profile_url}?access_token={token['access_token']}", | ||||||
|  |             ) | ||||||
|  |             response.raise_for_status() | ||||||
|  |         except RequestException as exc: | ||||||
|  |             LOGGER.warning("Unable to fetch user profile", exc=exc) | ||||||
|  |             return None | ||||||
|  |         else: | ||||||
|  |             return response.json() | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class MailcowOAuth2Callback(OAuthCallback): | ||||||
|  |     """Mailcow OAuth2 Callback""" | ||||||
|  |  | ||||||
|  |     client_class = MailcowOAuth2Client | ||||||
|  |  | ||||||
|  |     def get_user_enroll_context( | ||||||
|  |         self, | ||||||
|  |         info: dict[str, Any], | ||||||
|  |     ) -> dict[str, Any]: | ||||||
|  |         return { | ||||||
|  |             "email": info.get("email"), | ||||||
|  |             "name": info.get("full_name"), | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | @MANAGER.type() | ||||||
|  | class MailcowType(SourceType): | ||||||
|  |     """Mailcow Type definition""" | ||||||
|  |  | ||||||
|  |     callback_view = MailcowOAuth2Callback | ||||||
|  |     redirect_view = MailcowOAuthRedirect | ||||||
|  |     name = "Mailcow" | ||||||
|  |     slug = "mailcow" | ||||||
|  |  | ||||||
|  |     urls_customizable = True | ||||||
| @ -29017,6 +29017,7 @@ components: | |||||||
|       - okta |       - okta | ||||||
|       - reddit |       - reddit | ||||||
|       - twitter |       - twitter | ||||||
|  |       - mailcow | ||||||
|       type: string |       type: string | ||||||
|     ProxyMode: |     ProxyMode: | ||||||
|       enum: |       enum: | ||||||
|  | |||||||
							
								
								
									
										182
									
								
								web/authentik/sources/mailcow.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										182
									
								
								web/authentik/sources/mailcow.svg
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,182 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||||||
|  | <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  --> | ||||||
|  |  | ||||||
|  | <svg | ||||||
|  |    xmlns:dc="http://purl.org/dc/elements/1.1/" | ||||||
|  |    xmlns:cc="http://creativecommons.org/ns#" | ||||||
|  |    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||||||
|  |    xmlns:svg="http://www.w3.org/2000/svg" | ||||||
|  |    xmlns="http://www.w3.org/2000/svg" | ||||||
|  |    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||||||
|  |    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||||||
|  |    version="1.1" | ||||||
|  |    id="layer1" | ||||||
|  |    x="0px" | ||||||
|  |    y="0px" | ||||||
|  |    width="394.82101" | ||||||
|  |    height="376.871" | ||||||
|  |    viewBox="0 0 394.82101 376.871" | ||||||
|  |    enable-background="new 0 0 374.82 356.871" | ||||||
|  |    xml:space="preserve" | ||||||
|  |    inkscape:version="0.91 r13725" | ||||||
|  |    sodipodi:docname="cow_mailcow.svg"><metadata | ||||||
|  |      id="metadata77"><rdf:RDF><cc:Work | ||||||
|  |          rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type | ||||||
|  |            rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title><cc:license | ||||||
|  |            rdf:resource="" /></cc:Work></rdf:RDF></metadata><defs | ||||||
|  |      id="defs75" /><sodipodi:namedview | ||||||
|  |      pagecolor="#ffffff" | ||||||
|  |      bordercolor="#666666" | ||||||
|  |      borderopacity="1" | ||||||
|  |      objecttolerance="10" | ||||||
|  |      gridtolerance="10" | ||||||
|  |      guidetolerance="10" | ||||||
|  |      inkscape:pageopacity="0" | ||||||
|  |      inkscape:pageshadow="2" | ||||||
|  |      inkscape:window-width="1721" | ||||||
|  |      inkscape:window-height="1177" | ||||||
|  |      id="namedview73" | ||||||
|  |      showgrid="false" | ||||||
|  |      inkscape:zoom="1.4142136" | ||||||
|  |      inkscape:cx="179.01206" | ||||||
|  |      inkscape:cy="236.74715" | ||||||
|  |      inkscape:window-x="-8" | ||||||
|  |      inkscape:window-y="-8" | ||||||
|  |      inkscape:window-maximized="1" | ||||||
|  |      inkscape:current-layer="layer1" | ||||||
|  |      fit-margin-top="10" | ||||||
|  |      fit-margin-left="10" | ||||||
|  |      fit-margin-bottom="10" | ||||||
|  |      fit-margin-right="10" | ||||||
|  |      showguides="true" /><g | ||||||
|  |      id="g3" | ||||||
|  |      transform="translate(10,10)"><g | ||||||
|  |        id="grey_5_"><path | ||||||
|  |          d="m 55.948,213.25 c 0.07331,-20.26146 -0.716379,-17.26061 -3.655806,-39.26743 2.227824,-22.4392 -7.627923,-38.85857 -7.669233,-58.34044 0,-4.715 -5.805961,-6.78013 -4.760961,-11.13713 -6.292,13.037 -9.833,27.707 -9.833,43.222 0,25.946 9.89,49.533 26.027,67.059 -0.048,-0.511 -0.082,-1.023 -0.108,-1.536 z" | ||||||
|  |          id="path6" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#3d5263" | ||||||
|  |          sodipodi:nodetypes="ccccscc" /></g><g | ||||||
|  |        id="yellow"><path | ||||||
|  |          d="m 254.808,180.412 -0.567,0.455 c -10.49,39.88 -40.951,71.658 -80.048,83.996 l 10.952,9.206 53.296,44.799 31.601,26.563 c 0.783,-2.011 1.229,-4.19 1.231,-6.478 0,-0.007 10e-4,-0.013 10e-4,-0.02 l 0,-16.836 0,-10e-4 0,-28.141 0,-126.736 -16.466,13.193 z" | ||||||
|  |          id="path9" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#f9e82d" /><path | ||||||
|  |          d="m 23.027,185.52 -6.574,-5.225 -16.452,-13.076 0,90.407 0,81.307 c 0,2.295 0.447,4.481 1.233,6.499 l 58.39,-48.683 26.964,-22.481 12.38,-10.321 C 62.73,251.524 34.307,222.274 23.027,185.52 Z" | ||||||
|  |          id="path11" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#f9e82d" /><path | ||||||
|  |          d="m 238.441,318.868 -53.296,-44.799 -10.952,-9.206 c -11.431,3.607 -23.597,5.558 -36.22,5.558 -13.653,0 -26.772,-2.28 -39.004,-6.474 l -12.38,10.321 -26.965,22.482 -58.39,48.683 c 2.605,6.69 9.094,11.438 16.706,11.438 l 235.394,0 c 7.613,0 14.103,-4.749 16.707,-11.44 l -31.6,-26.563 z" | ||||||
|  |          id="path13" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#edd514;fill-opacity:0.89499996" /></g><g | ||||||
|  |        id="grey_4_"><path | ||||||
|  |          enable-background="new    " | ||||||
|  |          d="M 238.441,318.868 C 196.984,322.876 123.368,324.434 59.625,296.75 38.082,287.394 17.666,274.7 0.002,257.627 l 0,81.307 c 0,2.295 0.447,4.481 1.233,6.499 2.605,6.69 9.094,11.438 16.706,11.438 l 235.394,0 c 7.613,0 14.103,-4.749 16.707,-11.44 0.783,-2.011 1.229,-4.19 1.231,-6.478 l 0,-24.584 c 0,0 -12.58,2.541 -32.832,4.499 z" | ||||||
|  |          id="path16" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="opacity:0.1;fill:#3d5263" /><path | ||||||
|  |          enable-background="new    " | ||||||
|  |          d="m 86.588,274.268 c 14.979,6.703 31.579,10.435 49.051,10.435 17.648,0 34.408,-3.803 49.505,-10.634 37.082,-16.777 64.125,-51.824 69.664,-93.657 l -0.567,0.455 c -10.49,39.88 -40.951,71.658 -80.048,83.996 -11.431,3.607 -23.597,5.558 -36.22,5.558 -13.653,0 -26.772,-2.28 -39.004,-6.474 C 62.731,251.524 34.308,222.274 23.028,185.52 l -6.574,-5.225 c 5.525,42.054 32.786,77.261 70.134,93.973 z" | ||||||
|  |          id="path18" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="opacity:0.1;fill:#3d5263" /></g><g | ||||||
|  |        id="white_1_"><path | ||||||
|  |          d="m 54.293,63.875 c -1.799,1.745 -3.541,3.548 -5.229,5.402 -0.042,0.046 -0.085,0.092 -0.127,0.139 -0.234,0.258 -0.473,0.51 -0.705,0.77 0.055,-0.055 0.111,-0.108 0.166,-0.163 21.76,-21.782 51.828,-35.259 85.046,-35.259 66.396,0 120.222,53.826 120.222,120.223 0,30.718 -11.526,58.74 -30.482,79.991 21.633,-21.737 35.006,-51.7 35.01,-84.791 0,-0.004 0,-0.009 0,-0.013 0,-21.143 -5.465,-41.007 -15.049,-58.269 -1.449,-2.608 -2.991,-5.157 -4.624,-7.643 -5.377,-8.187 -11.727,-15.676 -18.885,-22.307 -5.903,-5.467 -12.351,-10.354 -19.26,-14.558 -4.278,-2.604 -8.734,-4.944 -13.341,-7.006 -10.627,-4.756 -22.07,-8.016 -34.062,-9.509 -4.915,-0.612 -9.921,-0.931 -15.001,-0.931 -5.747,0 -11.398,0.409 -16.93,1.189 -12.291,1.733 -23.981,5.329 -34.784,10.487 -4.742,2.264 -9.313,4.83 -13.688,7.672 -6.561,4.266 -12.682,9.149 -18.277,14.576 z" | ||||||
|  |          id="path21" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#ffffff" /><path | ||||||
|  |          d="m 95.828,118.535 c 2.559,0 4.63,-2.071 4.63,-4.629 0,-2.553 -2.071,-4.626 -4.63,-4.626 -2.558,0 -4.634,2.074 -4.634,4.626 10e-4,2.557 2.076,4.629 4.634,4.629 z" | ||||||
|  |          id="path23" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#ffffff" /><path | ||||||
|  |          d="m 186.85,118.535 c 2.556,0 4.629,-2.071 4.629,-4.629 0,-2.553 -2.074,-4.626 -4.629,-4.626 -2.559,0 -4.631,2.074 -4.631,4.626 0,2.557 2.073,4.629 4.631,4.629 z" | ||||||
|  |          id="path25" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#ffffff" /></g><g | ||||||
|  |        id="grey_3_"><g | ||||||
|  |          id="g28"><path | ||||||
|  |            d="m 223.701,234.394 c 18.648,-21.18 29.965,-48.971 29.965,-79.408 0,-66.396 -53.825,-120.223 -120.222,-120.223 -33.218,0 -63.286,13.477 -85.046,35.259 -4.591,5.125 -8.746,10.647 -12.413,16.507 -1.524,2.437 -2.963,4.931 -4.314,7.48 -7.067,13.341 -11.704,28.167 -13.301,43.893 -0.411,4.043 -0.622,8.146 -0.622,12.298 0,3.849 0.188,7.653 0.542,11.409 0.776,8.241 2.38,16.24 4.735,23.912 11.281,36.754 39.703,66.004 75.941,78.427 12.231,4.193 25.351,6.474 39.004,6.474 12.623,0 24.79,-1.95 36.22,-5.558 18.139,-5.725 34.412,-15.64 47.7,-28.603 0.536,-0.522 1.811,-1.867 1.811,-1.867 z m -5.788,-58.356 c -2.132,7.217 -5.052,14.085 -8.668,20.495 -16.571,29.372 -47.64,49.146 -83.233,49.146 -27.584,0 -52.447,-11.88 -69.956,-30.895 C 39.919,197.26 30.03,173.673 30.03,147.726 c 0,-15.515 3.54,-30.185 9.833,-43.222 15.648,-32.42 48.344,-54.73 86.15,-54.73 3.967,0 7.876,0.25 11.717,0.728 47.479,5.898 84.262,47.175 84.262,97.224 -0.002,9.846 -1.431,19.348 -4.079,28.312 z" | ||||||
|  |            id="path30" | ||||||
|  |            inkscape:connector-curvature="0" | ||||||
|  |            style="fill:#f1f2f2" /></g><path | ||||||
|  |          d="m 49.064,69.277 c -0.042,0.046 -0.085,0.092 -0.127,0.139 0.042,-0.047 0.085,-0.093 0.127,-0.139 z" | ||||||
|  |          id="path32" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#f1f2f2" /></g><g | ||||||
|  |        id="darkbrown_1_"><path | ||||||
|  |          d="m 257.626,161.89 c -0.488,5.062 -1.29,10.032 -2.387,14.89 -0.31,1.371 -0.643,2.733 -0.999,4.086 l 0.567,-0.455 16.466,-13.193 0,-0.023 -13.647,-5.305 z" | ||||||
|  |          id="path35" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#5a3620" /><path | ||||||
|  |          d="m 0.001,167.219 16.451,13.076 6.574,5.225 c -2.354,-7.672 -3.959,-15.671 -4.735,-23.912 l -2.85,0.871 L 0,167.196" | ||||||
|  |          id="path37" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#5a3620" /><path | ||||||
|  |          d="m 87.491,192.337 c -6.21,0 -11.254,5.034 -11.254,11.257 0,6.216 5.043,11.257 11.254,11.257 6.221,0 11.261,-5.041 11.261,-11.257 0,-6.223 -5.041,-11.257 -11.261,-11.257 z" | ||||||
|  |          id="path39" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#5a3620" /><path | ||||||
|  |          d="m 181.307,192.337 c -6.218,0 -11.259,5.034 -11.259,11.257 0,6.216 5.041,11.257 11.259,11.257 6.22,0 11.257,-5.041 11.257,-11.257 0,-6.223 -5.037,-11.257 -11.257,-11.257 z" | ||||||
|  |          id="path41" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#5a3620" /><path | ||||||
|  |          d="m 182.997,102.25057 c -6.963,0 -15.44243,7.76632 -15.44243,14.73532 0,6.965 8.12588,17.2072 15.08888,17.2072 6.968,0 15.79898,-9.53609 15.79898,-16.50009 0.001,-6.97 -8.47743,-15.44243 -15.44543,-15.44243 z m 3.853,16.28443 c -2.558,0 -4.631,-2.072 -4.631,-4.629 0,-2.552 2.072,-4.626 4.631,-4.626 2.555,0 4.629,2.073 4.629,4.626 0,2.558 -2.073,4.629 -4.629,4.629 z" | ||||||
|  |          id="path43" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#5a3620" | ||||||
|  |          sodipodi:nodetypes="ssscssssss" /><path | ||||||
|  |          d="m 89.709786,102.60413 c -6.971,0 -14.379767,8.11987 -14.379767,15.08887 0,6.965 8.824981,16.14653 15.793981,16.14653 6.963,0 15.79298,-9.18253 15.79298,-16.14653 0.001,-6.97 -10.243194,-15.08887 -17.207194,-15.08887 z M 95.828,118.535 c -2.559,0 -4.634,-2.072 -4.634,-4.629 0,-2.552 2.076,-4.626 4.634,-4.626 2.559,0 4.63,2.073 4.63,4.626 0,2.558 -2.071,4.629 -4.63,4.629 z" | ||||||
|  |          id="path45" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#5a3620" | ||||||
|  |          sodipodi:nodetypes="ssscssssss" /></g><g | ||||||
|  |        id="cream"><path | ||||||
|  |          d="m 336.302,256.425 c 3.59,-9.155 7.701,-11 9.346,-11.346 -40.757,3.757 -36.661,27.769 -34.026,35.96 0.55,1.712 1.037,2.733 1.037,2.733 0,0 2.031,4.787 7.536,8.748 4.149,2.986 10.27,5.503 18.995,5.144 27.063,0.461 35.631,-50.166 35.631,-50.166 -6.654,11.655 -26.404,9.876 -38.519,8.927 z" | ||||||
|  |          id="path48" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#fef3df" /><path | ||||||
|  |          d="m 48.937,69.415 c 0.042,-0.046 0.085,-0.092 0.127,-0.139 1.688,-1.854 3.43,-3.657 5.229,-5.402 -8.915,-6.977 -24.344,-15.826 -41.744,-11.633 0,0 2.814,20.458 23.437,34.287 3.667,-5.86 7.822,-11.381 12.413,-16.507 -0.055,0.055 -0.111,0.108 -0.166,0.163 0.231,-0.258 0.47,-0.511 0.704,-0.769 z" | ||||||
|  |          id="path50" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#fef3df" /><path | ||||||
|  |          d="m 258.812,52.242 c -15.831,-3.815 -30.029,3.169 -39.176,9.714 7.158,6.63 13.508,14.12 18.885,22.307 17.763,-13.689 20.291,-32.021 20.291,-32.021 z" | ||||||
|  |          id="path52" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#fef3df" /><path | ||||||
|  |          d="m 134.269,160.225 c -43.299,0 -78.388,22.964 -78.388,51.289 0,0.582 0.038,1.157 0.067,1.735 0.026,0.514 0.06,1.025 0.108,1.535 17.508,19.015 42.371,30.895 69.956,30.895 35.594,0 66.662,-19.774 83.233,-49.146 -9.796,-21.016 -39.651,-36.308 -74.976,-36.308 z M 87.491,214.85 c -6.211,0 -11.254,-5.041 -11.254,-11.257 0,-6.223 5.044,-11.257 11.254,-11.257 6.22,0 11.261,5.034 11.261,11.257 0,6.216 -5.04,11.257 -11.261,11.257 z m 93.816,0 c -6.218,0 -11.259,-5.041 -11.259,-11.257 0,-6.223 5.041,-11.257 11.259,-11.257 6.22,0 11.257,5.034 11.257,11.257 0,6.216 -5.037,11.257 -11.257,11.257 z" | ||||||
|  |          id="path54" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#fef3df" /><path | ||||||
|  |          d="M 86.265,0 C 68.102,16.373 86.113,41.427 86.258,41.628 97.061,36.47 108.751,32.874 121.042,31.141 97.629,27.686 86.265,0 86.265,0 Z" | ||||||
|  |          id="path56" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#fef3df" /><path | ||||||
|  |          d="m 186.204,0 c 0,0 -10.863,26.476 -33.231,30.883 11.992,1.493 23.435,4.752 34.062,9.509 C 190.383,35.136 202.036,14.271 186.204,0 Z" | ||||||
|  |          id="path58" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#fef3df" /></g><g | ||||||
|  |        id="g60"><path | ||||||
|  |          d="m 217.913,176.038 c 2.647,-8.964 6.55187,-25.89162 6.55187,-35.73662 C 224.46487,90.252379 185.208,56.4 137.728,50.502 c -2.157,28.03 3.629,87.043 80.185,125.536 z m -47.53,-58.345 c 0,-6.97 5.651,-12.614 12.614,-12.614 6.968,0 12.617,5.645 12.617,12.614 0,6.964 -5.649,12.611 -12.617,12.611 -6.963,0 -12.614,-5.646 -12.614,-12.611 z" | ||||||
|  |          id="path62" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#87654a" | ||||||
|  |          sodipodi:nodetypes="csccsssss" /></g><g | ||||||
|  |        id="brown"><path | ||||||
|  |          d="m 312.658,283.772 c 0,0 -0.487,-1.021 -1.037,-2.733 -3.758,3.317 -13.036,10.236 -27.03,12.416 l 0,-10e-4 c -0.009,0.002 -0.019,0.003 -0.027,0.005 -4.044,0.628 -8.479,0.863 -13.29,0.497 l 0,28.141 c 2.059,-0.801 4.607,-1.834 7.477,-3.083 5.462,-2.377 12.093,-5.542 18.771,-9.395 0.027,-0.016 0.054,-0.031 0.081,-0.047 8.158,-4.713 16.37,-10.452 22.593,-17.052 -5.506,-3.961 -7.538,-8.748 -7.538,-8.748 z" | ||||||
|  |          id="path65" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#b58765" /><path | ||||||
|  |          d="m 12.549,52.242 c 17.4,-4.193 32.83,4.656 41.744,11.633 C 59.888,58.449 66.009,53.565 72.57,49.301 48.272,18.498 2.169,37.201 2.169,37.201 -1.114,67.502 15.288,84.594 31.672,94.01 33.023,91.461 34.462,88.966 35.986,86.53 15.363,72.699 12.549,52.242 12.549,52.242 Z" | ||||||
|  |          id="path67" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#b58765" /><path | ||||||
|  |          d="m 200.376,47.398 c 6.909,4.205 13.356,9.091 19.26,14.558 9.146,-6.545 23.345,-13.529 39.176,-9.714 0,0 -2.527,18.332 -20.291,32.021 1.633,2.485 3.175,5.034 4.624,7.643 15.141,-9.784 29.097,-26.539 26.046,-54.704 0,-10e-4 -44.152,-17.909 -68.815,10.196 z" | ||||||
|  |          id="path69" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#b58765" /><path | ||||||
|  |          d="m 138.854,50.502 c -3.841,-0.478 -8.875,-0.728 -12.842,-0.728 -37.806,0 -70.502,22.31 -86.15,54.73 -1.045,4.357 -1.603,8.897 -1.603,13.612 0,1.454 0.085,2.787 0.121,4.175 0.127,3.935 0.448,7.585 0.855,11.135 4.291755,24.95762 7.959057,42.49186 13.464,66.758 0.056,0.407 0.164,0.804 0.224,1.211 0.617,4.028 1.642,7.992 3.025,11.854 -0.029,-0.578 -0.067,-1.153 -0.067,-1.735 0,-28.325 35.089,-51.289 78.388,-51.289 35.325,0 65.181,15.292 74.977,36.308 3.616,-6.409 6.536,-13.277 8.668,-20.495 C 179.98905,152.54886 163.9995,134.88987 153.25313,111.82124 142.50675,88.752624 137.775,64.517 138.854,50.502 Z m -47.73,79.802 c -6.97,0 -12.612,-5.646 -12.612,-12.611 0,-6.97 5.642,-12.614 12.612,-12.614 6.964,0 12.611,5.645 12.611,12.614 0.001,6.964 -5.648,12.611 -12.611,12.611 z" | ||||||
|  |          id="path71" | ||||||
|  |          inkscape:connector-curvature="0" | ||||||
|  |          style="fill:#b58765" | ||||||
|  |          sodipodi:nodetypes="cscscccccssccscssscs" /></g></g></svg> | ||||||
| After Width: | Height: | Size: 14 KiB | 
							
								
								
									
										52
									
								
								website/integrations/sources/mailcow/index.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								website/integrations/sources/mailcow/index.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,52 @@ | |||||||
|  | --- | ||||||
|  | title: Mailcow | ||||||
|  | --- | ||||||
|  |  | ||||||
|  | Allows users to authenticate using their Mailcow credentials | ||||||
|  |  | ||||||
|  | ## Preparation | ||||||
|  |  | ||||||
|  | The following placeholders will be used: | ||||||
|  |  | ||||||
|  | - `authentik.company` is the FQDN of the authentik install. | ||||||
|  | - `mailcow.company` is the FQDN of the mailcow install. | ||||||
|  |  | ||||||
|  | ## Mailcow | ||||||
|  |  | ||||||
|  | 1. Log into mailcow as an admin and navigate to the OAuth2 Apps settings  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 2. Click "Add OAuth2 Client" | ||||||
|  |  | ||||||
|  | 3. Insert the redirect URL: `https://authentik.company/source/oauth/callback/mailcow` | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 4. Copy the **Client ID** and **Client secret** and _save it for later_ | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ## Authentik | ||||||
|  |  | ||||||
|  | 5. Under _Directory -> Federation & Social login_ Click **Create > Mailcow OAuth Source** | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 6. **Name:** Choose a name (For the example I used Mailcow) | ||||||
|  | 7. **Slug:** mailcow (You can choose a different slug, if you do you will need to update the Mailcow redirect URL and point it to the correct slug.) | ||||||
|  | 8. **Consumer Key:** Client ID from step 4 | ||||||
|  | 9. **Consumer Secret:** Client Secret from step 4 | ||||||
|  | 10. **Authorization URL:** https://mailcow.company/oauth/authorize | ||||||
|  | 11. **Access token URL:** https://mailcow.company/oauth/token | ||||||
|  | 12. **Profile URL:** https://mailcow.company/oauth/profile | ||||||
|  |  | ||||||
|  | Here is an example of a complete authentik Mailcow OAuth Source | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | Save, and you now have Mailcow as a source. | ||||||
|  |  | ||||||
|  | :::note | ||||||
|  | For more details on how-to have the new source display on the Login Page see [here](../). | ||||||
|  | ::: | ||||||
							
								
								
									
										
											BIN
										
									
								
								website/integrations/sources/mailcow/mailcow1.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								website/integrations/sources/mailcow/mailcow1.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 7.4 KiB | 
							
								
								
									
										
											BIN
										
									
								
								website/integrations/sources/mailcow/mailcow2.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								website/integrations/sources/mailcow/mailcow2.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 27 KiB | 
							
								
								
									
										
											BIN
										
									
								
								website/integrations/sources/mailcow/mailcow3.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								website/integrations/sources/mailcow/mailcow3.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 24 KiB | 
							
								
								
									
										
											BIN
										
									
								
								website/integrations/sources/mailcow/mailcow4.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								website/integrations/sources/mailcow/mailcow4.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 34 KiB | 
							
								
								
									
										
											BIN
										
									
								
								website/integrations/sources/mailcow/mailcow5.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								website/integrations/sources/mailcow/mailcow5.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 78 KiB | 
| @ -60,6 +60,7 @@ module.exports = { | |||||||
|                 "sources/github/index", |                 "sources/github/index", | ||||||
|                 "sources/google/index", |                 "sources/google/index", | ||||||
|                 "sources/ldap/index", |                 "sources/ldap/index", | ||||||
|  |                 "sources/mailcow/index", | ||||||
|                 "sources/oauth/index", |                 "sources/oauth/index", | ||||||
|                 "sources/plex/index", |                 "sources/plex/index", | ||||||
|                 "sources/saml/index", |                 "sources/saml/index", | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Dorian Zedler
					Dorian Zedler