spiffe / tornjak

Tornjak is a UI and management layer used for brokering human access to one or more SPIRE deployments
Apache License 2.0
74 stars 32 forks source link

Add back tests for Authentication/Authorization in backend #432

Open maia-iyer opened 4 months ago

maia-iyer commented 4 months ago

With the recent refactoring of code, the tests for authentication and authorization were removed. We should refactor and put these tests back.

Previous tests are found here

ankiiisharma commented 4 months ago

hey @maia-iyer , can you please elaborate this more. i am willing to work on this. thanks

maia-iyer commented 3 months ago

Hello that's awesome!

So this is a backend work in Golang.

Under ./pkg/agent, we have some libraries authentication and authorization. These were created from this PR which refactored an older library auth. The old code for the auth library is here.

If you look closer, the newer authentication and authorization libraries are mostly the same code as the auth library. However, as part of this refactoring, this specific file with the tests got deleted.

We need to bring those tests back to the code. Taking a look, it seems all of the tests that were written are only testing the authentication pkg, so I think it's a matter of making a copy of the file to the authentication folder and testing it, seeing if it works out of box, or if adjustments need to be made. Possibly some function names or variable names need to be changed.

Definitely follow up and let me know if you have any questions!