| 94 | } |
| 95 | |
| 96 | async test(name, request) { |
| 97 | |
| 98 | Hoek.assert(name, 'Missing authentication strategy name'); |
| 99 | const strategy = this.#strategies[name]; |
| 100 | Hoek.assert(strategy, 'Unknown authentication strategy:', name); |
| 101 | |
| 102 | const bind = strategy.methods; |
| 103 | const realm = strategy.realm; |
| 104 | const response = await request._core.toolkit.execute(strategy.methods.authenticate, request, { bind, realm, auth: true }); |
| 105 | |
| 106 | if (!response.isAuth) { |
| 107 | throw response; |
| 108 | } |
| 109 | |
| 110 | if (response.error) { |
| 111 | throw response.error; |
| 112 | } |
| 113 | |
| 114 | return response.data; |
| 115 | } |
| 116 | |
| 117 | async verify(request) { |
| 118 | |