code-specialist / fastapi-keycloak

Keycloak integration for Python FastAPI
https://fastapi-keycloak.code-specialist.com/
Apache License 2.0
193 stars 50 forks source link

Fix the type hint of get_current_user #59

Closed DaGuich closed 2 years ago

DaGuich commented 2 years ago

FastAPIs Depends function expects a callable. get_current_user is returning a callable but its type hint did not reflect this.

It's just a small change but PyCharms type checker annoyed me...

DaGuich commented 2 years ago

Right now we are only allowing OAuth2PasswordBearer. Maybe we want to be a little bit more flexible there and use the base class of OAuth2PasswordBearer (which is OAuth2 I think...)

JonasScholl commented 2 years ago

Right now we are only allowing OAuth2PasswordBearer. Maybe we want to be a little bit more flexible there and use the base class of OAuth2PasswordBearer (which is OAuth2 I think...)

We can think of supporting this, then we would need to somehow make the user_auth_scheme method extendable 6 customizable so that one can use different auth schemes too. I will just open an issue, anyone interested in supporting this can then pick this up.