GODT-1166: Do not expose current auth token in interface

This commit is contained in:
Jakub
2021-06-11 13:45:00 +02:00
parent 21dcac9fac
commit a3e102e456
10 changed files with 300 additions and 297 deletions

View File

@ -64,7 +64,16 @@ func (ctx *TestContext) LoginUser(username string, password, mailboxPassword []b
// FinishLogin prevents authentication if not necessary.
func (ctx *TestContext) FinishLogin(client pmapi.Client, mailboxPassword []byte) error {
user, err := ctx.users.FinishLogin(client, client.GetCurrentAuth(), mailboxPassword)
type currentAuthGetter interface {
GetCurrentAuth() *pmapi.Auth
}
c, ok := client.(currentAuthGetter)
if c == nil || !ok {
return errors.New("cannot get current auth tokens from client")
}
user, err := ctx.users.FinishLogin(client, c.GetCurrentAuth(), mailboxPassword)
if err != nil {
return errors.Wrap(err, "failed to finish login")
}