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

Commit

Permalink
Fix Initial roles (#32)
Browse files Browse the repository at this point in the history
* fixed intial roles

* v1.0.3

Co-authored-by: Yannic Schröer <yannicschroer@Yannics-MBP.fritz.box>
  • Loading branch information
yannicschroeer and Yannic Schröer authored Mar 27, 2022
1 parent 5fe7f7f commit f49424d
Show file tree
Hide file tree
Showing 7 changed files with 309 additions and 294 deletions.
2 changes: 1 addition & 1 deletion fastapi_keycloak/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Keycloak API Client for integrating authentication and authorization with FastAPI"""

__version__ = "1.0.2"
__version__ = "1.0.3"

from fastapi_keycloak.api import FastAPIKeycloak
from fastapi_keycloak.model import OIDCUser, UsernamePassword, HTTPMethod, KeycloakError, KeycloakUser, KeycloakToken, KeycloakRole, KeycloakIdentityProvider, KeycloakGroup
Expand Down
5 changes: 1 addition & 4 deletions fastapi_keycloak/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,16 +660,13 @@ def create_user(
Raises:
KeycloakError: If the resulting response is not a successful HTTP-Code (>299)
"""
initial_roles = self.get_roles(initial_roles)
initial_roles_json = [role.dict() for role in initial_roles]

data = {
"email": email,
"username": username,
"firstName": first_name,
"lastName": last_name,
"enabled": enabled,
"clientRoles": initial_roles_json,
"realmRoles": initial_roles,
"credentials": [
{
"temporary": False,
Expand Down
2 changes: 2 additions & 0 deletions fastapi_keycloak/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class KeycloakUser(BaseModel):
email (Optional[str]):
disableableCredentialTypes (List[str]):
requiredActions (List[str]):
realmRoles (List[str]):
notBefore (int):
access (dict):
attributes (Optional[dict]):
Expand All @@ -54,6 +55,7 @@ class KeycloakUser(BaseModel):
email: Optional[str]
disableableCredentialTypes: List[str]
requiredActions: List[str]
realmRoles: Optional[List[str]]
notBefore: int
access: dict
attributes: Optional[dict]
Expand Down
Loading

0 comments on commit f49424d

Please sign in to comment.