Skip to content

Commit

Permalink
replace port number correctly
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
  • Loading branch information
BeryJu committed Feb 5, 2025
1 parent 3a5d291 commit 5cf9f32
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions authentik/providers/oauth2/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,19 +271,23 @@ def jwt_key(self) -> tuple[str | PrivateKeyTypes, str]:

def get_issuer(self, request: HttpRequest) -> str | None:
"""Get issuer, based on request"""
full_url = ""
if self.issuer_mode == IssuerMode.GLOBAL:
return request.build_absolute_uri(reverse("authentik_core:root-redirect"))
try:
url = reverse(
"authentik_providers_oauth2:provider-root",
kwargs={
"application_slug": self.application.slug,
},
)
return request.build_absolute_uri(url)

except Provider.application.RelatedObjectDoesNotExist:
return None
full_url = request.build_absolute_uri(reverse("authentik_core:root-redirect"))

Check warning on line 276 in authentik/providers/oauth2/models.py

View check run for this annotation

Codecov / codecov/patch

authentik/providers/oauth2/models.py#L276

Added line #L276 was not covered by tests
else:
try:
url = reverse(
"authentik_providers_oauth2:provider-root",
kwargs={
"application_slug": self.application.slug,
},
)
full_url = request.build_absolute_uri(url)
except Provider.application.RelatedObjectDoesNotExist:
return None
if request.is_secure():
return full_url.replace(":443", "")

Check warning on line 289 in authentik/providers/oauth2/models.py

View check run for this annotation

Codecov / codecov/patch

authentik/providers/oauth2/models.py#L289

Added line #L289 was not covered by tests
return full_url

@property
def redirect_uris(self) -> list[RedirectURI]:
Expand Down

0 comments on commit 5cf9f32

Please sign in to comment.