goauthentik / authentik

The authentication glue you need.
https://goauthentik.io
Other
13.28k stars 887 forks source link

Update source docs with new property mappings #10724

Open rissson opened 2 months ago

rissson commented 2 months ago

With #8771, it is now possible to get additional properties from an OAuth and SAML source, plus getting groups and syncing those. We need to update our sources documentation with those changes. As some of those docs are community supported, I'm opening this issue to ping whomever made recent changes to those if they want to update them with the new (and recommended) way of getting that data. Those changes will make it in 2024.8, so it may be a bit difficult to try things out just yet, but the currently documented way of getting data will still work until the documentation can be changed.

Documentation for those changes is available in #10652 (see the authentik-docs comment for the preview link). Please link back to this issue if you open a PR for those.

Keyinator commented 2 months ago

If I understand correctly

request.context["oauth_userinfo"]["email"]

would become

request.context["source"]["info"]["email"]

Also do we have docs on how to use the OAuth client object (i.e. what methods are available)?

From my understanding

requests.get(
    GUILD_API_URL,
    headers= {
        "Authorization": f"Bearer {access_token}",
    }
).json()

would become something like

request.context["source"]["client"].get(GUILD_API_URL)
rissson commented 2 months ago

Not quite. Instead of getting all that information in the flow, you'd write property mappings to get that information. I'll update one of the sources examples once we get everything merged, so we'll have an example to refer to.