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

@@ 931-940 (lines=10) @@
928
	 */
929
	public function tryTokenLogin(IRequest $request) {
930
		$authHeader = $request->getHeader('Authorization');
931
		if ($authHeader === null || \strpos($authHeader, 'token ') === false) {
932
			// No auth header, let's try session id
933
			try {
934
				$token = $this->session->getId();
935
			} catch (SessionNotAvailableException $ex) {
936
				return false;
937
			}
938
		} else {
939
			$token = \substr($authHeader, 6);
940
		}
941
942
		if (!$this->loginWithToken($token)) {
943
			return false;