Compare commits

...

5 Commits

Author SHA1 Message Date
36e418436b Revert "Revert "core: applications api: add option to only list apps with launch url (#10336)""
This reverts commit 1eb9d7a9d6.
2024-07-04 12:58:29 +02:00
8b0058ada0 detect RAC differently
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-07-04 12:58:25 +02:00
3abf1421a2 return full URL when possible
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-07-04 12:57:56 +02:00
70c7454c69 return authentik launch URL
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-07-04 12:52:26 +02:00
1eb9d7a9d6 Revert "core: applications api: add option to only list apps with launch url (#10336)"
This reverts commit 42e0ff6492.
2024-07-04 12:50:46 +02:00
2 changed files with 12 additions and 4 deletions

View File

@ -7,7 +7,9 @@ from datetime import timedelta
from django.core.cache import cache
from django.db.models import QuerySet
from django.db.models.functions import ExtractHour
from django.http import HttpRequest
from django.shortcuts import get_object_or_404
from django.urls import reverse
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import OpenApiParameter, OpenApiResponse, extend_schema
from guardian.shortcuts import get_objects_for_user
@ -65,10 +67,16 @@ class ApplicationSerializer(ModelSerializer):
def get_launch_url(self, app: Application) -> str | None:
"""Allow formatting of launch URL"""
user = None
rel_url = reverse(
"authentik_core:application-launch",
kwargs={
"application_slug": app.slug,
},
)
if "request" in self.context:
user = self.context["request"].user
return app.get_launch_url(user)
request: HttpRequest = self.context["request"]
return request.build_absolute_uri(rel_url)
return rel_url
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)

View File

@ -90,7 +90,7 @@ export class LibraryApplication extends AKElement {
if (!this.application) {
return html``;
}
if (this.application?.launchUrl === "goauthentik.io://providers/rac/launch") {
if (this.application?.providerObj.component === "ak-provider-rac-form") {
return html`<ak-library-rac-endpoint-launch .app=${this.application}>
<a slot="trigger"> ${this.application.name} </a>
</ak-library-rac-endpoint-launch>`;