Lines Matching defs:options

63     public function create(int $type, array $options = [], ?Message $received = null): Message
66 return $this->generateClientResponse($options, $received);
68 return $this->generateServerResponse($options);
70 return $this->generateServerChallenge($options);
78 protected function generateServerChallenge(array $options): Message
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');
88 $challenge->set('cipher', $this->getAvailableCiphers($options));
94 protected function generateServerResponse(array $options): Message
96 $rspAuth = $options['rspauth'] ?? null;
107 protected function generateClientResponse(array $options, Message $challenge): Message
110 $qop = isset($options['qop']) ? (string) $options['qop'] : null;
114 $response->set('cnonce', $options['cnonce'] ?? $this->generateNonce($options['nonce_size'] ?? self::NONCE_SIZE));
115 $response->set('nc', $options['nc'] ?? 1);
117 $response->set('username', $options['username'] ?? $this->getCurrentUser());
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
132 if (!isset($options['service'])) {
138 $options['service'],
143 protected function generateAvailableQops(array $options): array
147 if (isset($options['use_integrity']) && $options['use_integrity'] === true) {
150 if (isset($options['use_privacy']) && $options['use_privacy'] === true) {
167 $options = $qop !== null ? [$qop] : ['auth-conf', 'auth-int', 'auth'];
169 foreach ($options as $method) {
181 protected function getAvailableCiphers(array $options): array
186 if (isset($options['cipher'])) {
187 $wanted = (array) $options['cipher'];
211 protected function setCipherForChallenge(array $options, Message $response, Message $challenge): void
218 $toCheck = isset($options['cipher']) ? (array) $options['cipher'] : ['3des', 'des', 'rc4', 'rc4-56', 'rc4-40', ];