feature/upgrade-soko-web #21
@ -80,16 +80,14 @@ class OAuthController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function getUserInfo() : IContent
 | 
					    public function getUserInfo() : IContent
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        //TODO: headers should be set by soko-web
 | 
					        $authorization = $this->request->header('Authorization');
 | 
				
			||||||
        $headers = getallheaders();
 | 
					        if ($authorization === null) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (!isset($headers['Authorization'])) {
 | 
					 | 
				
			||||||
            return new JsonContent([
 | 
					            return new JsonContent([
 | 
				
			||||||
                'error' => 'No Authorization header was sent.'
 | 
					                'error' => 'No Authorization header was sent.'
 | 
				
			||||||
            ]);
 | 
					            ]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $accessToken = substr($headers['Authorization'], strlen('Bearer '));
 | 
					        $accessToken = substr($authorization, strlen('Bearer '));
 | 
				
			||||||
        $token = $this->oAuthTokenRepository->getByAccessToken($accessToken);
 | 
					        $token = $this->oAuthTokenRepository->getByAccessToken($accessToken);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($token === null || $token->getExpiresDate() < new DateTime()) {
 | 
					        if ($token === null || $token->getExpiresDate() < new DateTime()) {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								web.php
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								web.php
									
									
									
									
									
								
							@ -86,6 +86,7 @@ Container::$request = new SokoWeb\Request\Request(
 | 
				
			|||||||
    $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'],
 | 
					    $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'],
 | 
				
			||||||
    $_GET,
 | 
					    $_GET,
 | 
				
			||||||
    $_POST,
 | 
					    $_POST,
 | 
				
			||||||
 | 
					    getallheaders(),
 | 
				
			||||||
    $_SESSION,
 | 
					    $_SESSION,
 | 
				
			||||||
    new RVR\Repository\UserRepository()
 | 
					    new RVR\Repository\UserRepository()
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user