public function authenticate(TokenInterface $token) { $user = $this->userProvider->loadUserByUsername($token->getUsername()); if ($user) { if ($this->validateDigest((string) $token->digest, $token->getUsername(), $token->nonce, $token->created, $user->getAuthSecret())) { $authenticatedToken = new WsseUserToken(array('IS_AUTHENTICATED')); $authenticatedToken->setUser($user); $authenticatedToken->setAuthenticated(TRUE); return $authenticatedToken; } } throw new AuthenticationException('The WSSE authentication failed.'); }