Skip to content
This repository was archived by the owner on Mar 16, 2024. It is now read-only.

Commit 7f0a073

Browse files
yannicschroeerYannic Schröer
andauthored
Initial roles (#33)
* fixed intial roles * initial roles does additional requests Co-authored-by: Yannic Schröer <[email protected]>
1 parent f35e6ff commit 7f0a073

File tree

5 files changed

+12
-446
lines changed

5 files changed

+12
-446
lines changed

fastapi_keycloak/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Keycloak API Client for integrating authentication and authorization with FastAPI"""
22

3-
__version__ = "1.0.3"
3+
__version__ = "1.0.4"
44

55
from fastapi_keycloak.api import FastAPIKeycloak
66
from fastapi_keycloak.model import OIDCUser, UsernamePassword, HTTPMethod, KeycloakError, KeycloakUser, KeycloakToken, KeycloakRole, KeycloakIdentityProvider, KeycloakGroup

fastapi_keycloak/api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,6 @@ def create_user(
666666
"firstName": first_name,
667667
"lastName": last_name,
668668
"enabled": enabled,
669-
"realmRoles": initial_roles,
670669
"credentials": [
671670
{
672671
"temporary": False,
@@ -682,6 +681,9 @@ def create_user(
682681
user = self.get_user(query=f'username={username}')
683682
if send_email_verification:
684683
self.send_email_verification(user.id)
684+
if initial_roles:
685+
self.add_user_roles(initial_roles, user.id)
686+
user = self.get_user(user_id=user.id)
685687
return user
686688

687689
@result_or_error()

0 commit comments

Comments
 (0)