Set the role that is used if you're authenticated and the identity provides no role

@param string|\Zend\Permissions\Acl\Role\RoleInterface $authenticatedRole

@throws \BjyAuthorize\Exception\InvalidRoleException
176937
public function setAuthenticatedRole($authenticatedRole)
    {
        if (! ($authenticatedRole instanceof RoleInterface || is_string($authenticatedRole))) {
            throw InvalidRoleException::invalidRoleInstance($authenticatedRole);
        }

        $this->authenticatedRole = $authenticatedRole;
    }
298085
public function setRoles($roles) {
        if ($this->configured) throw new IllegalStateException('Configuration is frozen');
        $name = $this->name ? ' name="'.$this->name.'"':'';
        $path = $this->path ? ' path="'.$this->path.'"':'';

        //static $pattern = '/^!?[A-Za-z_][A-Za-z0-9_]*(,!?[A-Za-z_][A-Za-z0-9_]*)*$/';
        static $pattern = '/^!?[A-Za-z_][A-Za-z0-9_]*$/';
        if (!strlen($roles) || !preg_match($pattern, $roles)) throw new StrutsConfigException('<mapping'.$name.$path.' roles="'.$roles.'": Invalid roles expression.');

        // check for invalid id combinations, e.g. "Member,!Member"
        $tokens = explode(',', $roles);
        $keys = \array_flip($tokens);

        foreach ($tokens as $role) {
            if (isset($keys['!'.$role])) throw new StrutsConfigException('<mapping'.$name.$path.' roles="'.$roles.'": Invalid roles expression.');
        }

        // remove duplicates
        $this->roles = join(',', \array_flip($keys));
        return $this;
    }
1361797
public function authenticate(TokenInterface $authenticationToken)
    {
        parent::authenticate($authenticationToken);
        if (!$authenticationToken->getAuthenticationStatus() === TokenInterface::AUTHENTICATION_SUCCESSFUL) {
            return;
        }

        // Force set isAuthenticated to true on authentication manager to update roles needed for entity privileges
        ObjectAccess::setProperty($this->authenticationManager, 'isAuthenticated', true, true);

        $domain = $this->domainRepository->findOneByActiveRequest();
        if ($domain === null) {
            if (!$this->securityContext->hasRole('Neos.Neos:Administrator')) {
                $this->securityLogger->log('No domain found and user has not assigned "Neos.Neos:Administrator", rolling back.', LOG_DEBUG);
                $this->rollback($authenticationToken);
            }
            return;
        }

        $site = $domain->getSite();
        try {
            $site->getName();
            // Site access allowed, continue
        } catch (EntityNotFoundException $e) {
            $this->securityLogger->log('Domain found but user has no access to site, rolling back.', LOG_DEBUG);
            $this->rollback($authenticationToken);
        }
    }
236557
public function assertAuthenticatedByRole($role)
    {
        // Check if a user with this role is already logged in.
        if (!$this->loggedInWithRole($role)) {
            // Create user (and project)
            $user = (object) array(
            'name' => $this->getRandom()->name(8),
            'pass' => $this->getRandom()->name(16),
            'role' => $role,
            );
            $user->mail = "{$user->name}@example.com";

            $this->userCreate($user);

            $roles = explode(',', $role);
            $roles = array_map('trim', $roles);
            foreach ($roles as $role) {
                if (!in_array(strtolower($role), array('authenticated', 'authenticated user'))) {
                    // Only add roles other than 'authenticated user'.
                    $this->getDriver()->userAddRole($user, $role);
                }
            }

            // Login.
            $this->login($user);
        }
    }
1104224
public function setRoleId($v)
    {
        if ($v !== null && is_numeric($v)) {
            $v = (int) $v;
        }

        if ($this->role_id !== $v) {
            $this->role_id = $v;
            $this->modifiedColumns[] = UserRolePeer::ROLE_ID;
        }

        if ($this->aRole !== null && $this->aRole->getId() !== $v) {
            $this->aRole = null;
        }


        return $this;
    }
936640
public function setRole(UserInterface $user, array $selectedRole)
    {
        $choices = $this->rolesManager->getChoices();

        if (!isset($choices[$selectedRole['roles']])) {
            throw new InvalidArgumentException(
                sprintf('Impossible to set role %s', $selectedRole['roles'])
            );
        }

        $user->setRoles([$choices[$selectedRole['roles']]]);

        $this->entityManager->flush();
    }
301741
public function setGrantableRolesAtHq($grantableRolesAtHq)
    {
        $allowedValues = $this->getGrantableRolesAtHqAllowableValues();
        if (!is_null($grantableRolesAtHq) && array_diff($grantableRolesAtHq, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'grantableRolesAtHq', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['grantableRolesAtHq'] = $grantableRolesAtHq;

        return $this;
    }
1139957
public Authorizations setRoles(Set<Role> roles) {
        this.roles.clear();
        this.aggregatePermissions = null;
        addRoles(roles);

        return this;
    }
373571
public function setRolesAtBase($rolesAtBase)
    {
        $allowedValues = $this->getRolesAtBaseAllowableValues();
        if (!is_null($rolesAtBase) && array_diff($rolesAtBase, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'rolesAtBase', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['rolesAtBase'] = $rolesAtBase;

        return $this;
    }
471955
public function setUserRole(\Dacorp\ExtraBundle\Entity\UserRole $userRole = null)
    {
        $this->userRole = $userRole;
    
        return $this;
    }
971052
public function setRole($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->role !== $v) {
            $this->role = $v;
            $this->modifiedColumns[] = RolePeer::ROLE;
        }


        return $this;
    }
516974
public function grant(UserRole $aRole)
    {
        if (false === $this->isRoleAllowed($aRole)) {
            throw new UserRoleInvalidException();
        }
        if (true === $this->isGranted($aRole)) {
            throw new UserRoleAlreadyGrantedException();
        }
        $this->roles[] = $aRole;
        $this->updatedOn = new \DateTimeImmutable();

        $this->publish(
            new UserRoleGranted(
                $this->id,
                $this->email,
                $aRole
            )
        );
    }
10475
public function setRoleUnauthenticated($role)
    {
        $role = (string) $role;
        if ($role === '') {
            throw new \InvalidArgumentException('$role cannot be empty');
        }

        $this->roleUnauthenticated = $role;
    }
363669
public function setAuthenticationUrl($authenticationUrl)
    {
      if(!is_string($authenticationUrl) || strlen(trim($authenticationUrl)) == 0)
        throw new InvalidArgumentException(__METHOD__ . '; Invalid authentication url, must be a non empty string');

      $this->authenticationUrl = $authenticationUrl;
    }
561065
public function setGrantableRolesAtBase($grantableRolesAtBase)
    {
        $allowedValues = $this->getGrantableRolesAtBaseAllowableValues();
        if (!is_null($grantableRolesAtBase) && array_diff($grantableRolesAtBase, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'grantableRolesAtBase', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['grantableRolesAtBase'] = $grantableRolesAtBase;

        return $this;
    }
496897
public function revoke(UserRole $aRole)
    {
        if (false === $this->isRoleAllowed($aRole)) {
            throw new UserRoleInvalidException();
        }

        $numberOfRoles = count($this->roles);
        for ($index = 0; $index < $numberOfRoles; $index++) {
            $role = $this->roles[$index];

            if ($role->equals($aRole)) {
                unset($this->roles[$index]);
                $this->roles = array_values($this->roles);
                break;
            }
        }
        if ($index === $numberOfRoles) {
            throw new UserRoleAlreadyRevokedException();
        }

        $this->updatedOn = new \DateTimeImmutable();
        $this->publish(
            new UserRoleRevoked(
                $this->id,
                $this->email,
                $aRole
            )
        );
    }
276688
public function removeRole(string $role): PermissionManager
    {
        if (!$this->hasRole($role)) {
            throw new RoleException("Undefined role '{$role}'");
        }

        unset($this->permissions[$role]);

        return $this;
    }