From 446f104c9033940848989cf214d3fccdafa2cba2 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 5 May 2021 11:48:16 +0200 Subject: [PATCH] core: add user UID to API Signed-off-by: Jens Langhammer --- authentik/core/api/users.py | 2 ++ outpost/pkg/ldap/instance_search.go | 3 +-- swagger.yaml | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/authentik/core/api/users.py b/authentik/core/api/users.py index c4d1f6bb9..9b0fc38d8 100644 --- a/authentik/core/api/users.py +++ b/authentik/core/api/users.py @@ -42,6 +42,7 @@ class UserSerializer(ModelSerializer): avatar = CharField(read_only=True) attributes = JSONField(validators=[is_dict], required=False) groups = ListSerializer(child=GroupSerializer(), read_only=True, source="ak_groups") + uid = CharField(read_only=True) class Meta: @@ -57,6 +58,7 @@ class UserSerializer(ModelSerializer): "email", "avatar", "attributes", + "uid", ] diff --git a/outpost/pkg/ldap/instance_search.go b/outpost/pkg/ldap/instance_search.go index 15bc352f7..4e5665adc 100644 --- a/outpost/pkg/ldap/instance_search.go +++ b/outpost/pkg/ldap/instance_search.go @@ -4,7 +4,6 @@ import ( "errors" "fmt" "net" - "strconv" "strings" "github.com/nmcclain/ldap" @@ -79,7 +78,7 @@ func (pi *ProviderInstance) Search(bindDN string, searchReq ldap.SearchRequest, }, { Name: "uid", - Values: []string{strconv.Itoa(int(u.Pk))}, + Values: []string{u.UID}, }, { Name: "name", diff --git a/swagger.yaml b/swagger.yaml index 039f99cbf..506ea0868 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -15395,6 +15395,11 @@ definitions: attributes: title: Attributes type: object + uid: + title: Uid + type: string + readOnly: true + minLength: 1 Token: required: - identifier