Register an authentication implementation.
Implementation must implement
`\Phramework\Authentication\IAuthentication` interface
@param  string $implementation implementation class
@throws Exception
182091
public static function register($implementation)
    {
        $object = new $implementation();
        if (!($object instanceof \Phramework\Authentication\IAuthentication)) {
            throw new \Exception(
                'Class is not implementing \Phramework\Authentication\IAuthentication'
            );
        }

        self::$implementations[] = $object;
    }
1150202
public static function setInstance($registry)
    {
        if (self::$_registry !== null) {
            throw new Exception('Registry is already initialized');
        }

        self::setClassName(get_class($registry));
        self::$_registry = $registry;
    }
1035891
public function setAuthnContextDecl(Chunk $authnContextDecl) : void
    {
        if (!empty($this->authnContextDeclRef)) {
            throw new \Exception(
                'AuthnContextDeclRef is already registered! May only have either a Decl or a DeclRef, not both!'
            );
        }

        $this->authnContextDecl = $authnContextDecl;
    }
882415
public static function register(Package $package, ...$bootload): void {
        $pid = $package->pid();

        if (!$pid) {
            throw new \RuntimeException("package id of ".
                get_class($package)." can not be null");
        }
        if (self::instance()->has($pid)) {
            throw new \RuntimeException(get_class($package).
                " class package id $pid is conflicted");
        }
        self::instance()->set($pid, $package);

        self::$_bootloads[$pid] = $bootload;
    }
227467
@Override
    public void register(IESigType eSigType) throws Exception {
        if (typeRegistry.get(eSigType.getESigTypeId()) != null) {
            throw new Exception("Duplicate esig type identifier: " + eSigType.getESigTypeId());
        }

        typeRegistry.put(eSigType.getESigTypeId(), eSigType);
        init(eSigType);
    }
38808
public function give($implementation)
    {
        foreach (Arr::wrap($this->concrete) as $concrete) {
            $this->container->addContextualBinding($concrete, $this->needs, $implementation);
        }
    }
251690
public function onAuthenticationSuccess(AuthenticationEvent $event)
    {
        /** @var \Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token */
        $token = $event->getAuthenticationToken();

        $this->logger->info(
            sprintf(
                'Entity (%s) was successfully recognized.',
                $token->getUsername()
            )
        );
    }
579109
public function register($nodeName, ProcessorDefinitionInterface $definition)
    {
        if (array_key_exists($nodeName, $this->items)) {
            throw new \RuntimeException(sprintf('Processor definition for node name "%s" already exists in registry.', $nodeName));
        }

        $this->items[$nodeName] = $definition;
    }
1186056
public function register($identifier, $value)
    {
        parent::register($identifier, $value);

        $sql = sprintf(
            'INSERT INTO %s (`entityId`, `data`) set (`%s`, `%s`);',
            $this->mysql->quote($this->section),
            $this->mysql->quote($identifier),
            $this->decorator->normalizeValue($value)
        );
        $result = $this->mysql->query($sql);

        if (false === $result) {

            $this->registry[$this->section][$identifier] = null;

            $this->throwException(
                'Error occurred while registering an entity: ',
                $this->mysql->errorInfo()
            );
        }
    }
330150
public function assignIdentifier($object, array $identifier) : void
    {
        if (! $object instanceof IdentifiableInterface) {
            throw new InvalidArgumentException(sprintf('%s must implement IdentifiableInterface.', get_class($object)));
        }

        $object->assignIdentifier($identifier);
    }
756295
protected function set_algorithm(string $algorithm):void{
		$algorithm = strtoupper($algorithm);

		if(!in_array($algorithm, ['SHA1', 'SHA256', 'SHA512'], true)){
			throw new AuthenticatorException('Invalid algorithm: '.$algorithm);
		}

		$this->algorithm = $algorithm;
	}
655372
public function &addTrait($interface = null, $implementation = null)
    {
        if (is_array($interface)) {
            foreach ($interface as $k => $v) {
                $this->addTrait($k, $v);
            }
        } else {
            if ($interface || $implementation) {
                if (empty($interface)) {
                    $interface = '--just-paste-trait--';
                }

                if (empty($this->traits[$interface])) {
                    $this->traits[$interface] = [];
                }

                if ($implementation && array_search($implementation, $this->traits[$interface]) === false) {
                    $this->traits[$interface][] = $implementation;
                }
            } else {
                throw new InvalidArgumentException('Interface or implementation are required');
            }
        }

        return $this;
    }
1212351
public function register($entity, $entityMap = null)
    {
        // If an object is provider, get the class name from it
        if (!is_string($entity)) {
            $entity = get_class($entity);
        }

        if ($this->isRegisteredEntity($entity)) {
            throw new MappingException("Entity $entity is already registered.");
        }

        if (!class_exists($entity)) {
            throw new MappingException("Class $entity does not exists");
        }

        if ($entityMap === null) {
            $entityMap = $this->getEntityMapInstanceFor($entity);
        }

        if (is_string($entityMap)) {
            $entityMap = new $entityMap();
        }

        if (!$entityMap instanceof EntityMap) {
            throw new MappingException(get_class($entityMap).' must be an instance of EntityMap.');
        }

        $entityMap->setClass($entity);

        $this->entityClasses[$entity] = $entityMap;
    }
195004
public function create($serverIdentifier) {
		if (!isset($this->serverConfigurations[$serverIdentifier]) || !is_array($this->serverConfigurations[$serverIdentifier])) {
			throw new Exception('Invalid configuration for server "' . $serverIdentifier . '" in Flowpack.SingleSignOn.Client.server', 1351688340);
		}
		$serverConfiguration = $this->serverConfigurations[$serverIdentifier];
		$ssoServer = new \Flowpack\SingleSignOn\Client\Domain\Model\SsoServer();
		if (!isset($serverConfiguration['serviceBaseUri']) || (string)$serverConfiguration['serviceBaseUri'] === '') {
			throw new Exception('Missing serviceBaseUri setting in Flowpack.SingleSignOn.Client.server.' . $serverIdentifier, 1352719244);
		}
		$serverConfiguration['serviceBaseUri'] = rtrim($serverConfiguration['serviceBaseUri'], '/');
		$ssoServer->setServiceBaseUri($serverConfiguration['serviceBaseUri']);
		$ssoServer->setEndpointUri($serverConfiguration['serviceBaseUri'] . '/authentication');

		if (!isset($serverConfiguration['publicKeyFingerprint']) || (string)$serverConfiguration['publicKeyFingerprint'] === '') {
			throw new Exception('Missing publicKeyFingerprint setting for Flowpack.SingleSignOn.Client.server.' . $serverIdentifier, 1351688420);
		}
		$ssoServer->setPublicKey($serverConfiguration['publicKeyFingerprint']);
		if (!isset($serverConfiguration['publicKeyFingerprint']) || (string)$serverConfiguration['publicKeyFingerprint'] === '') {
			throw new Exception('Missing publicKeyFingerprint setting for Flowpack.SingleSignOn.Client.server.' . $serverIdentifier, 1351688420);
		}

		// TODO Set service base URI
		return $ssoServer;
	}
184657
public function registerInterfaceBindings(Application $app)
    {
        $app->bind(ClientInterface::class, FluentClient::class);
        $app->bind(ScopeInterface::class, FluentScope::class);
        $app->bind(SessionInterface::class, FluentSession::class);
        $app->bind(AuthCodeInterface::class, FluentAuthCode::class);
        $app->bind(AccessTokenInterface::class, FluentAccessToken::class);
        $app->bind(RefreshTokenInterface::class, FluentRefreshToken::class);
    }
562208
protected function authenticate($password)
    {
        $message = new Message($password, Message::TYPE_AUTH);
        $response = $this->sendMessage($message);

        if ($response->getType() === Message::TYPE_AUTH_FAILURE) {
            throw new AuthenticationFailedException('Could not authenticate to the server.');
        }
    }
45788
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
    {
        $data = array(
            'message' => strtr($exception->getMessageKey(), $exception->getMessageData())
        );
        $def_response = new JsonResponse($data, 403);

        $event = new CASAuthenticationFailureEvent($request,$exception, $def_response);
        $this->eventDispatcher->dispatch(CASAuthenticationFailureEvent::POST_MESSAGE, $event);

        return $event->getResponse();
    }