goauthentik / goauthentik/authentik

Attributes fields of a user are not available when generating dynamic application URLs

Open
#19,604 2 comments 0 reactions 0 assignees View on GitHub
enhancement/confirmed
Dominant language
Python
Stars
25.6k
Forks
2k
Avg merge
1d 1h
Merged PRs (30d)
644

Description

### Describe the bug

The problem seems to be that python `%` formatting is limited and cannot reference fields that are nested. I suppose the problem is `get_launch_url()` in `Application`:
https://github.com/goauthentik/authentik/blob/083b61ca7f44b5ee95bea7fad3c5ec65cc5530d3/authentik/core/models.py#L735

### How to reproduce

1. Create a user with a an attribute, say `vnc_connection: 8382-2929-1111`
2. Create an app (doesn't need a provider), and for the launch URL, use: `http://example.com/%(attributes.vnc_connection)s`
3. Log in as the user and observe the generated link for the application we created in the previous step. Note that the launch URL doesn't have the value filled in.

### Expected behavior

Nested fields should also be filled in properly. It would be nice if we can use a dot notation to reference nested fields. In the example provided, the generated link must instead be `http://example.com/8382-2929-1111`.

### Screenshots

_No response_

### Additional context

Here's an example which demonstrates what might be happening when `url % user_data` is performed in `get_launch_url()` in `Application`:
https://github.com/goauthentik/authentik/blob/083b61ca7f44b5ee95bea7fad3c5ec65cc5530d3/authentik/core/models.py#L735

```python
user_data = {
"username": "jdoe",
"email": "jdoe@example.com",
"name": "John Doe",
"pk": 1,
"attributes": {"vnc_connection": "8382-2929-1111", "other_setting": "true"},
}
print("http://example.com/%(username)s" % user_data)
# http://example.com/jdoe
print("http://example.com/%(attributes.vnc_connection)s" % user_data)
# Traceback (most recent call last):
# File "", line 1, in
# KeyError: 'attributes.vnc_connection'
```

### Deployment Method

Kubernetes

### Version

2025.8 (but looking at the code seems the latest version also has this problem)

### Relevant log output

```shell

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.