Lines Matching defs:challenge

80         $challenge = new Message();
81 $challenge->set('algorithm', 'md5-sess');
82 $challenge->set('nonce', $options['nonce'] ?? $this->generateNonce($options['nonce_size'] ?? self::NONCE_SIZE));
83 $challenge->set('qop', $this->generateAvailableQops($options));
84 $challenge->set('realm', $options['realm'] ?? $_SERVER['USERDOMAIN'] ?? gethostname());
85 $challenge->set('maxbuf', $options['maxbuf'] ?? '65536');
86 $challenge->set('charset', 'utf-8');
87 if (in_array('auth-conf', $challenge->get('qop'))) {
88 $challenge->set('cipher', $this->getAvailableCiphers($options));
91 return $challenge;
107 protected function generateClientResponse(array $options, Message $challenge): Message
113 $response->set('nonce', $challenge->get('nonce'));
116 $response->set('qop', $this->selectQopFromChallenge($challenge, $qop));
118 $response->set('realm', $options['realm'] ?? $this->getRealmFromChallenge($challenge));
119 $response->set('digest-uri', $options['digest-uri'] ?? $this->getDigestUri($options, $response, $challenge));
121 $this->setCipherForChallenge($options, $response, $challenge);
130 protected function getDigestUri(array $options, Message $response, Message $challenge): string
160 protected function selectQopFromChallenge(Message $challenge, ?string $qop): string
162 $available = (array) ($challenge->get('qop') ?? []);
211 protected function setCipherForChallenge(array $options, Message $response, Message $challenge): void
213 if (!$challenge->has('cipher')) {
214 throw new SaslException('The client requested auth-conf, but the challenge contains no ciphers.');
216 $ciphers = $challenge->get('cipher');
229 'No recognized ciphers were offered in the challenge: %s',
249 * Only populate if one realm is provided in the challenge. If more than one exists then the client must supply this.
251 protected function getRealmFromChallenge(Message $challenge): string
253 if (!$challenge->has('realm')) {
256 $realms = (array) $challenge->get('realm');