tomasvotava / fastapi-sso

FastAPI plugin to enable SSO to most common providers (such as Facebook login, Google login and login via Microsoft Office 365 Account)
https://tomasvotava.github.io/fastapi-sso/
MIT License
348 stars 53 forks source link

Generic Framework Support? #201

Open ccrvlh opened 1 month ago

ccrvlh commented 1 month ago

Hey, thanks for sharing this!

Most of the code seems to be pretty generic when it comes to framework. I started converting it to Litestar here, however, the conversion seems to be so simple, that I was wondering if it would make sense to have a single SSO lib for the main frameworks (though of FastAPI, Litestar, Flask, Django).

For Litestar specifically, I just replaced Response, Redirect and the routers, had to add the location header manually, and all tests are passing. I'll be testing this in a "live" environment soon, to check if that was indeed enough.

I don't know Django much, but I guess having an interface for response, redirect, should be a big step forward, and then maybe just passing the driver (eg. framework) that is being used when instantiating the main SSO class. I guess dependency can get tricky (some litestar projects will use Msgspec instead of Pydantic for example), but should be doable.

Thoughts?

tomasvotava commented 3 weeks ago

Hey, that's a great idea, actually! I am still having a huge refactor for 1.0.0 release in mind, but there's no time yet to do it and it would be awesome to split the openid/sso part and the fascade for frameworks.