Closed cyb3r4nt closed 5 months ago
I reviewed the changes and I think they are not breaking anything.
The only thing I still do not understand is the original issue, could you please describe it in more detail, and maybe provide a code snippet which reproduces it? Ideally a test which reproduces the problem in master.
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
v2/auth.go | 22 | 24 | 91.67% | ||
<!-- | Total: | 22 | 24 | 91.67% | --> |
Totals | |
---|---|
Change from base Build 8627959567: | -0.02% |
Covered Lines: | 2558 |
Relevant Lines: | 3092 |
The only thing I still do not understand is the original issue, could you please describe it in more detail, and maybe provide a code snippet which reproduces it? Ideally a test which reproduces the problem in master.
I was trying to use this auth lib in my dev environment, and only a single dev provider was configured there.
It is possible to reproduce it with TestIntegrationProtected
and commenting out all other providers in prepService() preparation method
This check was failing for me during the request to some protected web endpoint.
Same thing may be reproduced if remark42 is started only with option --auth.dev
and without specifying any other providers.
The new and modified version of TestIntegrationProtected
from this PR should cover this issue.
Totals | |
---|---|
Change from base Build 8627959567: | 0.6% |
Covered Lines: | 2577 |
Relevant Lines: | 3092 |
Totals | |
---|---|
Change from base Build 8627959567: | 0.6% |
Covered Lines: | 2577 |
Relevant Lines: | 3092 |
@umputun, this one is good to merge.
@cyb3r4nt, please prepare an MR to v2, which would prohibit underscore in the provider name; that would be good if we know it breaks something.
There was one minor problem related to the dev and Apple providers registration.
Now it is possible to have a configuration, where only one single dev provider is enabled.
Providers were not registered into
Service.authMiddleware.Providers
slice in theService.AddDevProvider()
andService.AddAppleProvider()
methods before.This worked before, because other providers were registered at the same time, and
authMiddleware.Providers
slice was reassigned by other methods.