Code Duplication    Length = 10-10 lines in 2 locations

lib/private/User/Session.php 1 location

@@ 796-805 (lines=10) @@
793
	 */
794
	public function tryTokenLogin(IRequest $request) {
795
		$authHeader = $request->getHeader('Authorization');
796
		if ($authHeader === null || strpos($authHeader, 'token ') === false) {
797
			// No auth header, let's try session id
798
			try {
799
				$token = $this->session->getId();
800
			} catch (SessionNotAvailableException $ex) {
801
				return false;
802
			}
803
		} else {
804
			$token = substr($authHeader, 6);
805
		}
806
807
		if (!$this->loginWithToken($token)) {
808
			return false;

lib/private/User/TokenAuthModule.php 1 location

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