@param $resource

@throws AuthenticationFailed
356601
public function authenticate($resource)
    {
        $pubkeyFile = $this->pubkeyFile;
        if (!is_file($pubkeyFile)) {
            $pubkeyFile = KeyFinder::find(KeyFinder::TYPE_PUBLICKEY);
        }

        $privkeyFile = $this->privkeyFile;
        if (!is_file($privkeyFile)) {
            $privkeyFile = KeyFinder::find(KeyFinder::TYPE_PRIVATEKEY);
        }

        if (!ssh2_auth_pubkey_file($resource, $this->username, $pubkeyFile, $privkeyFile, $this->passphrase)) {
            throw new AuthenticationFailed;
        }
    }
530411
protected function setError($resource)
    {
        if (is_string($resource)) {
            $this->getDriver()->setError(
                $resource, -1
            );
        } else {
            $this->getDriver()->setError(
                $this->realError($resource),
                $this->realErrorCode($resource)
            );
        }
    }
1082405
public function supports($resource)
    {
        return $resource === ''
            || $this->getIssue($resource)
            || $this->jiraService->urlMatches($resource);
    }
670690
public function logFailure(AuthenticationFailureEvent $event)
    {
        $request = $this->requestStack->getCurrentRequest();

        $exception = $event->getAuthenticationException()
            ->getPrevious();
        if (null === $exception) {
            $exception = $event->getAuthenticationException();
        }

        $authLog = $this->createAuthLog();
        $authLog->setSuccess(false);
        $authLog->setUsername($request->request->get('_username'));
        $authLog->setMessage($exception->getMessage());

        $this->em->persist($authLog);
        $this->em->flush();
    }
757876
public function apply($resource){
		// Extract arguments
		@list(,$x,$y,$width,$height)=func_get_args();
		$x=(int)$x;
		$y=(int)$y;
		$width=(int)$width;
		$height=(int)$height;
		// Get resolution
		$w_src=imagesx($resource);
		$h_src=imagesy($resource);
		if($w_src===false || $h_src===false){
			throw new Exception("An error was encountered while getting source image resolution");
		}
		// Verifications
		if(!$width || !$height){
			throw new Exception("Invalid image resolution provided");
		}
		if(($x+$width)>$w_src || ($y+$height)>$h_src){
			throw new Exception("Dimensions provided seems to be out of the image resolution");
		}
		// Create new image
		$image=$this->_createTrueColor($width,$height);
		// Cut image
		if(!imagecopy($image,$resource,0,0,$x,$y,$width,$height)){
			throw new Exception("Failed to copy image portion");
		}
		return $image;
	}
310766
static function configure($resource) {
		foreach( static::lookup_methods() as $type => $cb )
			$resource->addLookup($cb, $type);
		$refcnt =& self::$refcnt[static::class];
		if ( ! $refcnt++ ) static::on_setup();
	}
76888
protected function authorizeResource($resource)
    {
        if ($this->isEditing($resource)) {
            return $this->user()->can($resource . '.update');
        }

        return $this->user()->can($resource . '.create');
    }
342460
public function post($resource, $data = [])
    {
        $exec = $this->execute(Method::$HTTP_POST, $resource, ['json' => $data]);

        return $exec;
    }
802107
private function protectWithRedirect(Authentication $authentication, string $location): void
    {
        if (($this->authentication = $authentication->isLogged()) === false) {
            \header('Location: '.$location);
            throw new AuthenticationException('');
        }
    }
1097732
public function authenticate(Request $request)
    {
        $this->checkForToken($request);

        try {
            if (! $this->auth->parseToken()->authenticate()) {
                throw new UnauthorizedHttpException('jwTauth', 'User not found');
            }
        } catch (JwTException $e) {
            throw new UnauthorizedHttpException('jwTauth', $e->getMessage(), $e, $e->getCode());
        }
    }
675895
protected function onAuthenticationFailure(AuthenticationRequiredException $exception = null)
    {
        if ($this->view instanceof JsonView) {
            $this->view->assign('value', ['success' => false]);
        } else {
            $this->addFlashMessage('The entered username or password was wrong', 'Wrong credentials', Message::SEVERITY_ERROR, [], ($exception === null ? 1347016771 : $exception->getCode()));
        }
    }
1280061
public function claimUsedResourceIdentifier(ResourceInterface $resource) {
		if ($resource->getResource()->hasIdentification() === false) {
			throw new InputException('can not validate resource without identifier, set type and id first');
		}
		
		$resourceKey = $resource->getResource()->getIdentificationKey();
		if (isset($this->usedResourceIdentifiers[$resourceKey]) === false) {
			$this->usedResourceIdentifiers[$resourceKey] = true;
			return;
		}
		
		throw new DuplicateException('can not have multiple resources with the same identification');
	}
1136604
public function isAllowed($resource, $privilege = null)
    {
        $this->loaded && $this->loaded->__invoke();

        try {
            return $this->acl->isAllowed($this->getIdentity(), $resource, $privilege);
        } catch (InvalidArgumentException $e) {
            return false;
        }
    }
1131833
public function attach($resource){
        if(!is_resource($resource) || "stream" !== get_resource_type($resource)){
            throw new \InvalidArgumentException(
                "Argument must be of the type stream resource, " . gettype($resource) . " given."
            );
        }

        $this->resource = $resource;
    }
1006543
public function checkResourcePrepared(AbstractResource $resource)
    {
        $stringErrors = '';

        //null or '' shouldn't be valid
        if ($resource->getName() == null) {
            $stringErrors .= 'The resource name is missing' . PHP_EOL;
        }

        if ($stringErrors !== '') {
            throw new MissingResourceNameException($stringErrors);
        }
    }
786960
private static function resource($resource)
    {
        exception_if(($resource != 'session' && $resource != 'cookie'), LogicException::class, 'The resource name of \''.$resource.'\' is not supported by Vinala, only session or cookie');

        return Hash::make(config('auth.'.$resource));

        // For more security, make for every user a resource name
        return Hash::make(config('auth.'.$resource).static::$user->rememberToken);
    }
275509
public function setResource( $resource )
	{
		if( !is_resource( $resource ) )
			throw new InvalidArgumentException( 'Must be a valid image resource' );
		if( $this->resource )
			imagedestroy( $this->resource );

		$this->resource	= $resource;
		$this->width	= imagesx( $resource );
		$this->height	= imagesy( $resource );

		if( function_exists( 'imageantialias' ) )
			imageantialias( $this->resource, TRUE );

		imagealphablending( $this->resource, FALSE );											//  disable alpha blending in favour to
		imagesavealpha( $this->resource, TRUE );											//  copying the complete alpha channel
	}