| 127 | } |
| 128 | |
| 129 | async function negotiate( |
| 130 | client: KerberosClient, |
| 131 | retries: number, |
| 132 | payload: string |
| 133 | ): Promise<string> { |
| 134 | try { |
| 135 | const response = await client.step(payload); |
| 136 | return response || ''; |
| 137 | } catch (error) { |
| 138 | if (retries === 0) { |
| 139 | // Retries exhausted, raise error |
| 140 | throw error; |
| 141 | } |
| 142 | // Adjust number of retries and call step again |
| 143 | return await negotiate(client, retries - 1, payload); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | async function finalize(client: KerberosClient, user: string, payload: string): Promise<string> { |
| 148 | // GSS Client Unwrap |