Skip to content

Authorizer is hard to handle #37

@amias-channer

Description

@amias-channer

Hello All ,

Thanks for biscuits , its fascinating and very powerful :)

I'm getting my head round it but something i'm finding hard to handle is the way the authorizer signals success of failure.

if i pass an authorization i get back a zero , this feels wrong , shouldn't it be True or 1 ?

if i fail an authorization i get an exception , which is kind of ok but its not the opposite of what happens on success.
The exception seems to be of a type that will cause a try: except block to emit another error.

Traceback (most recent call last):
File "C:\Users\me\PycharmProjects\unicorn\biscuit.py", line 118, in
except biscuit_auth.UnverifiedBiscuit as e:
TypeError: catching classes that do not inherit from BaseException is not allowed

I get that this is wrapped from rust so options are limited , i would have patched this if i understood how the shimming works, but it feels like this would be much easier to use if it authorizer.authorize() return a boolean.

if you need exception handling inside the method then maybe just wrap the method in its own try except block so that it catches the exception itself and returns false , then we get very solid true or false behaviour which is easier to work with than one sided exceptions.

I also thought i should raise this now before you release the new version so it could be part of that.

I am software tester so i'd be happy to help with the new release somehow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions