Fix Basic Auth handling

- bugfixes
- testcases