Skip to content

How to protect endpoints by URL prefix without using decorators? #988

Answered by jwag956
oddy asked this question in Q&A
Discussion options

You must be logged in to vote

Not totally sure I understand what you are trying to do - however - 'decorators' are really just callable functions that return a callable.. so you can use them directly in code rather than as a 'decorator'.

@route("/prefix")
def myview():
    auth_required()(real_my_view_for_prefix)()

Or you could create your OWN decorator that performs different algorithms depending on what security framework you are using.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by oddy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants