@param string         $attribute
@param mixed          $subject
@param TokenInterface $token

@return bool
13534
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        if ($this->isSuperAdmin($token)) {
            return true;
        }

        if (ContributionActionInterface::READ === $attribute) {
            return $this->voteForReadAction($subject, $token);
        }

        if ($this->isCreator($subject, $token->getUser())) {
            return $this->voteForOwnedSubject($attribute, $subject, $token);
        }

        return $this->voteForSomeoneElseSubject($attribute, $subject, $token);
    }
1207109
public function serialize($subject, &$data = array(), SerializerInterface $serializer = null)
    {
        $context = $this->serializer();
        $context($subject, $data, $serializer);
        return $data;
    }
1057660
public function checkCreation(TokenInterface $token, $object)
    {
        return $this->manager->isAllowedBadgeManagement($token, $object->getBadge());
    }
137117
protected function containsRole(TokenInterface $token, ReadNodeInterface $subject)
    {
        $tokenRoles = $this->roleHierarchy->getReachableRoles($token->getRoles());;
        foreach ($tokenRoles as $key => $role) {
            if ($role instanceof RoleInterface) {
                $tokenRoles[$key] = $role->getRole();
            }
        }

        return empty($subject->getFrontRoles())
            || ($this->accessDecisionManger->decide($token, array('IS_AUTHENTICATED_FULLY'))
                && !empty(array_intersect($tokenRoles, $subject->getFrontRoles())));
    }
267765
protected function isAllowedEAVAttribute(
        DataInterface $object,
        AttributeInterface $attribute,
        /** @noinspection PhpUnusedParameterInspection */
        $format = null,
        array $context = []
    ) {
        $options = $attribute->getOption(static::SERIALIZER_OPTIONS, []);

        // Ignore attributes set as serializer: expose: false
        if (array_key_exists(static::EXPOSE_KEY, $options) && !$options[static::EXPOSE_KEY]) {
            return false;
        }

        // If normalizing by reference, we just check if it's among the allowed attributes
        if ($this->byReferenceHandler->isByReference($context)) {
            return \in_array($attribute->getCode(), $this->referenceAttributes, true);
        }

        // Also check ignored attributes
        if (\in_array($attribute->getCode(), $this->ignoredAttributes, true)) {
            return false;
        }

        return $this->isEAVGroupAllowed($object, $attribute, $context);
    }
799046
public function setTokenAttribute(Token $token)
    {
        $value = null;

        if (! $token->isValid()) {
            $value = $token->toJson();
        }

        $this->attributes['token'] = $value;
    }
540614
public function getClientKey($client_id, $subject)
    {
        $result = $this->client->getItem(array(
            "TableName"=> $this->config['jwt_table'],
            "Key" => array('client_id'   => array('S' => $client_id), 'subject' => array('S' => $subject))
        ));
        if ($result->count()==0) {
            return false ;
        }
        $token = $this->dynamo2array($result);

        return $token['public_key'];
    }
207017
public function vote(TokenInterface $token, $object, array $attributes)
    {
        if ($object instanceof FieldFacetCollection) {
            //fields right management is done at the Panel level
            return $this->fieldFacetVote($object, $token, strtolower($attributes[0]));
        }

        if ($object instanceof PanelFacet) {
            return $this->panelFacetVote($object, $token, strtolower($attributes[0]));
        } elseif ($object instanceof Facet) {
            //no implementation yet
        }

        return VoterInterface::ACCESS_ABSTAIN;
    }
278207
protected function validateAttribute($object, $attribute)
    {
        $method = $this->method;
        $object->{$method}($attribute, $this->params);
    }
659271
public function injectSubject(\PHPCraft\Subject\Subject $subject)
    {
        $this->subjects[$subject->name] = $subject;
    }
90718
public function validate($subject): bool
    {
        foreach ($this->validatorMap as $validatorName => $validatorClass) {
            if (\array_key_exists($validatorName, $this->schema)) {
                /**
                 * @var ValidatorInterface $typeValidator
                 */
                $typeValidator = new $validatorClass($this->schema, $this->rootSchema);
                if (!$typeValidator->validate($subject)) {
                    return false;
                }
            }
        }
        return true;
    }
341894
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        /** @var BaseUser $user */
        $user = $token->getUser();

        return $user instanceof BaseUser && ($user->hasRole('ROLE_ADMIN') || $user->getId() === $subject->getId());
    }
864045
public static function fromToken(TokenInterface $token)
    {
        $user = $token->getUser();

        if ($user instanceof UserInterface) {
            return self::fromAccount($user);
        }

        return new self((string) $user, is_object($user) ? ClassUtils::getRealClass($user) : ClassUtils::getRealClass($token));
    }
1294943
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        return $this->hasRole($token, ContributionRoleInterface::DEVELOPER);
    }
112044
public function refreshToken(Token $token)
    {
        $user = $this->getProvider()->retrieveById($token->getClaim('sub'));
        $claimValidation = [static::JWT_GUARD_CLAIM => $this->id];
        if (!($user instanceof SubjectContract)
            || !$token->ensureClaimValues(array_merge($user->getJWTClaimValidation(), $claimValidation))) {
            return false;
        }
        return $this->generateToken($user);
    }
513793
protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
    {
        $user = $token->getUser();

        if (!$user instanceof UserInterface) {
            return false;
        }

        $groupable = $subject;

        switch ($attribute) {
            case self::VIEW:
                return $this->canView($groupable, $token);
            case self::EDIT:
                return $this->canEdit($groupable, $token);
        }
    }
272238
public function vote(TokenInterface $token, $subject, array $attributes): int
    {
        if ($token->getUser() instanceof AdminUserInterface) {
            return self::ACCESS_GRANTED;
        }

        return self::ACCESS_ABSTAIN;
    }