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

Commit f49424d

Browse files
yannicschroeerYannic Schröer
andauthored
Fix Initial roles (#32)
* fixed intial roles * v1.0.3 Co-authored-by: Yannic Schröer <[email protected]>
1 parent 5fe7f7f commit f49424d

File tree

7 files changed

+309
-294
lines changed

7 files changed

+309
-294
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.2"
3+
__version__ = "1.0.3"
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: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -660,16 +660,13 @@ def create_user(
660660
Raises:
661661
KeycloakError: If the resulting response is not a successful HTTP-Code (>299)
662662
"""
663-
initial_roles = self.get_roles(initial_roles)
664-
initial_roles_json = [role.dict() for role in initial_roles]
665-
666663
data = {
667664
"email": email,
668665
"username": username,
669666
"firstName": first_name,
670667
"lastName": last_name,
671668
"enabled": enabled,
672-
"clientRoles": initial_roles_json,
669+
"realmRoles": initial_roles,
673670
"credentials": [
674671
{
675672
"temporary": False,

fastapi_keycloak/model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class KeycloakUser(BaseModel):
3636
email (Optional[str]):
3737
disableableCredentialTypes (List[str]):
3838
requiredActions (List[str]):
39+
realmRoles (List[str]):
3940
notBefore (int):
4041
access (dict):
4142
attributes (Optional[dict]):
@@ -54,6 +55,7 @@ class KeycloakUser(BaseModel):
5455
email: Optional[str]
5556
disableableCredentialTypes: List[str]
5657
requiredActions: List[str]
58+
realmRoles: Optional[List[str]]
5759
notBefore: int
5860
access: dict
5961
attributes: Optional[dict]

0 commit comments

Comments
 (0)