Code Duplication    Length = 10-10 lines in 2 locations

lib/private/User/TokenAuthModule.php 1 location

@@ 117-126 (lines=10) @@
114
	 */
115
	private function getToken(IRequest $request, &$token) {
116
		$authHeader = $request->getHeader('Authorization');
117
		if ($authHeader === null || \strpos($authHeader, 'token ') === false) {
118
			// No auth header, let's try session id
119
			try {
120
				$token = $this->session->getId();
121
			} catch (SessionNotAvailableException $ex) {
122
				return null;
123
			}
124
		} else {
125
			$token = \substr($authHeader, 6);
126
		}
127
128
		try {
129
			return $this->tokenProvider->getToken($token);

lib/private/User/Session.php 1 location

@@ 853-862 (lines=10) @@
850
	 */
851
	public function tryTokenLogin(IRequest $request) {
852
		$authHeader = $request->getHeader('Authorization');
853
		if ($authHeader === null || \strpos($authHeader, 'token ') === false) {
854
			// No auth header, let's try session id
855
			try {
856
				$token = $this->session->getId();
857
			} catch (SessionNotAvailableException $ex) {
858
				return false;
859
			}
860
		} else {
861
			$token = \substr($authHeader, 6);
862
		}
863
864
		if (!$this->loginWithToken($token)) {
865
			return false;