Closed krisnashaypp closed 4 weeks ago
Hi @krisnashaypp - not to hand but of the top of my head, if you use current_app
you should be able to access the auth
object of that for the decorator.
I haven't tried that however and it would be a good idea to include that as an example so I'll try and add something later.
Thanks @felnne
I think I managed to get it working in a slightly different way, I tried with current_app but it didn't work out of the box . Do you see any issues with this solution?
No reference to the lib inside where the flask app is instantiated
from flask_entra_auth.resource_protector import EntraResourceProtector
auth = EntraResourceProtector()
from extensions import auth
bp = Blueprint('example', __name__, url_prefix='/example')
@bp.route("/", methods=["GET"])
@auth()
def get_something():
#something
@krisnashaypp, I think that would be fine - and having seen your implementation, am reminded that's how I think Flask intends extensions to be used so 👍.
Hi, thanks for your great library. I was wondering if you have an example how you can decorate endpoints that exist in other files and are imported into the entrypoint using blueprints? Thanks again.