Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable default callback #11

Closed
axlon opened this issue Jan 20, 2019 · 2 comments · May be fixed by #42
Closed

Configurable default callback #11

axlon opened this issue Jan 20, 2019 · 2 comments · May be fixed by #42
Assignees
Labels
help wanted Extra attention is needed In Progress This is being worked on
Milestone

Comments

@axlon
Copy link
Contributor

axlon commented Jan 20, 2019

Currently the default callback is set to a 401 response, it might be handy to make this configurable so an implementor won't have to add the same callback to his routes a 100 times

@axlon axlon added the help wanted Extra attention is needed label Jan 20, 2019
@yak0d3 yak0d3 added the In Progress This is being worked on label Jan 21, 2019
@yak0d3
Copy link
Member

yak0d3 commented Jan 22, 2019

I have worked on the default configuration implementation, the implementation is now located in the config-defaults branch.
The current tests are passing, i have not added tests for the implementation but i'll be sure to add those later.
The configuration now looks like this:

    'callbacks' => [
        // 'myCallback' => 'MyClass::myFunction',
    ],
    'defaults' => [

        'RULE' => 'allow', //Can be either `allow` or `deny`, anything else will set this to `deny` automatically.

        'CALLBACK' => [
            'name' => 'orUnauthorized',
            'args' => null
        ],
    ]

@axlon
Copy link
Contributor Author

axlon commented Jan 26, 2019

Adding a default rule doesn't add anything except overhead (unless I'm missing something), I think the general way of defining the default callback should be changed as well. I think we should fix the various callback issues (allowing instance methods for instance), before we tackle this issue

@yak0d3 yak0d3 self-assigned this Jun 8, 2019
@yak0d3 yak0d3 added this to the v0.4.0 milestone Oct 7, 2019
@axlon axlon closed this as completed Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed In Progress This is being worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants