@@ 99-106 (lines=8) @@ | ||
96 | // Get token making sure the an authorization type is provided |
|
97 | $authToken = $request->getHeaderLine(self::AUTHORIZATION_HEADER); |
|
98 | $authTokenParts = explode(' ', $authToken); |
|
99 | if (count($authTokenParts) === 1) { |
|
100 | return new JsonResponse([ |
|
101 | 'error' => RestUtils::INVALID_AUTHORIZATION_ERROR, |
|
102 | 'message' => sprintf($this->translator->translate( |
|
103 | 'You need to provide the Bearer type in the %s header.' |
|
104 | ), self::AUTHORIZATION_HEADER), |
|
105 | ], 401); |
|
106 | } |
|
107 | ||
108 | // Make sure the authorization type is Bearer |
|
109 | list($authType, $jwt) = $authTokenParts; |
|
@@ 110-117 (lines=8) @@ | ||
107 | ||
108 | // Make sure the authorization type is Bearer |
|
109 | list($authType, $jwt) = $authTokenParts; |
|
110 | if (strtolower($authType) !== 'bearer') { |
|
111 | return new JsonResponse([ |
|
112 | 'error' => RestUtils::INVALID_AUTHORIZATION_ERROR, |
|
113 | 'message' => sprintf($this->translator->translate( |
|
114 | 'Provided authorization type %s is not supported. Use Bearer instead.' |
|
115 | ), $authType), |
|
116 | ], 401); |
|
117 | } |
|
118 | ||
119 | try { |
|
120 | if (! $this->jwtService->verify($jwt)) { |