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