Code Duplication    Length = 4-7 lines in 3 locations

apps/federation/lib/Controller/OCSAuthAPIController.php 3 locations

@@ 102-105 (lines=4) @@
99
	 */
100
	public function requestSharedSecret($url, $token) {
101
102
		if ($this->trustedServers->isTrustedServer($url) === false) {
103
			$this->logger->error('remote server not trusted (' . $url . ') while requesting shared secret', ['app' => 'federation']);
104
			return ['statuscode' => Http::STATUS_FORBIDDEN];
105
		}
106
107
		// if both server initiated the exchange of the shared secret the greater
108
		// token wins
@@ 110-116 (lines=7) @@
107
		// if both server initiated the exchange of the shared secret the greater
108
		// token wins
109
		$localToken = $this->dbHandler->getToken($url);
110
		if (strcmp($localToken, $token) > 0) {
111
			$this->logger->info(
112
				'remote server (' . $url . ') presented lower token. We will initiate the exchange of the shared secret.',
113
				['app' => 'federation']
114
			);
115
			return ['statuscode' => Http::STATUS_FORBIDDEN];
116
		}
117
118
		// we ask for the shared secret so we no longer have to ask the other server
119
		// to request the shared secret
@@ 150-153 (lines=4) @@
147
	 */
148
	public function getSharedSecret($url, $token) {
149
150
		if ($this->trustedServers->isTrustedServer($url) === false) {
151
			$this->logger->error('remote server not trusted (' . $url . ') while getting shared secret', ['app' => 'federation']);
152
			return ['statuscode' => Http::STATUS_FORBIDDEN];
153
		}
154
155
		if ($this->isValidToken($url, $token) === false) {
156
			$expectedToken = $this->dbHandler->getToken($url);