Пример #1
0
  @Test(expected = SendFailedException.class)
  public void testTextMailMessageSendFailed() {
    String uuid = java.util.UUID.randomUUID().toString();
    String subject = "Text Message from $version Mail - " + uuid;
    String version = "Seam 3";
    mailConfig.setServerHost("localHost");
    mailConfig.setServerPort(8977);

    // Port is two off so this should fail
    Wiser wiser = new Wiser(mailConfig.getServerPort() + 2);
    try {
      wiser.start();

      person.setName(toName);
      person.setEmail(toAddress);

      mailMessage
          .get()
          .from(fromAddress, fromName)
          .replyTo(replyToAddress)
          .to(toAddress, toName)
          .subject(subject)
          .bodyText(new RenderTemplate(templateCompiler.get(), textTemplatePath))
          .put("person", person)
          .put("version", version)
          .importance(MessagePriority.HIGH)
          .send(session.get());
    } finally {
      stop(wiser);
    }
  }
Пример #2
0
  @Test(expected = SendFailedException.class)
  public void testFreeMarkerTextMailMessageSendFailed() {
    String uuid = java.util.UUID.randomUUID().toString();
    String subject = "Text Message from $version Mail - " + uuid;
    String version = "Seam 3";

    // Port is two off so this should fail
    Wiser wiser = new Wiser(mailConfig.getServerPort() + 2);
    wiser.setHostname(mailConfig.getServerHost());
    try {
      wiser.start();

      person.setName(toName);
      person.setEmail(toAddress);

      mailMessage
          .get()
          .from(fromAddress)
          .replyTo(replyToAddress)
          .to(toAddress)
          .subject(new FreeMarkerTemplate(subject))
          .bodyText(
              new FreeMarkerTemplate(
                  resourceProvider.loadResourceStream("template.text.freemarker")))
          .put("person", person)
          .put("version", version)
          .importance(MessagePriority.HIGH)
          .send(session.get());
    } finally {
      stop(wiser);
    }
  }
Пример #3
0
  @Test
  public void testSMTPSessionAuthentication() throws MessagingException, MalformedURLException {
    String subject = "HTML+Text Message from Seam Mail - " + java.util.UUID.randomUUID().toString();

    mailConfig.setServerHost("localHost");
    mailConfig.setServerPort(8978);

    Wiser wiser = new Wiser(mailConfig.getServerPort());
    wiser
        .getServer()
        .setAuthenticationHandlerFactory(
            new EasyAuthenticationHandlerFactory(new SMTPAuthenticator("test", "test12!")));
    try {
      wiser.start();

      person.setName(toName);
      person.setEmail(toAddress);

      mailMessage
          .get()
          .from(fromAddress, fromName)
          .to(person.getEmail(), person.getName())
          .subject(subject)
          .put("person", person)
          .put("version", "Seam 3")
          .bodyHtmlTextAlt(
              new RenderTemplate(templateCompiler.get(), htmlTemplatePath),
              new RenderTemplate(templateCompiler.get(), textTemplatePath))
          .importance(MessagePriority.LOW)
          .deliveryReceipt(fromAddress)
          .readReceipt("seam.test")
          .addAttachment(
              "htmlTemplatePath",
              "text/html",
              ContentDisposition.ATTACHMENT,
              resourceProvider.loadResourceStream(htmlTemplatePath))
          .addAttachment(
              new URLAttachment(
                  "http://design.jboss.org/seam/logo/final/seam_mail_85px.png",
                  "seamLogo.png",
                  ContentDisposition.INLINE))
          .send(gmailSession);
    } finally {
      stop(wiser);
    }

    Assert.assertTrue(
        "Didn't receive the expected amount of messages. Expected 1 got "
            + wiser.getMessages().size(),
        wiser.getMessages().size() == 1);

    MimeMessage mess = wiser.getMessages().get(0).getMimeMessage();

    Assert.assertEquals(
        "Subject has been modified", subject, MimeUtility.unfold(mess.getHeader("Subject", null)));
  }
Пример #4
0
 /**
  * {@link IdentityManager} instances are produced accordingly to the current {@link Partition} in
  * use. If no partition is provided, the default partition will be used.
  *
  * @return
  */
 @Produces
 @RequestScoped
 public IdentityManager createIdentityManager() {
   if (defaultPartition.isUnsatisfied() || defaultPartition.get() == null) {
     return new SecuredIdentityManager(this.partitionManager.createIdentityManager());
   } else {
     return new SecuredIdentityManager(
         this.partitionManager.createIdentityManager(defaultPartition.get()));
   }
 }
 /**
  * Creates a proper configuration form.
  *
  * @param policyDef
  */
 public IPolicyConfigurationForm createForm(PolicyDefinitionBean policyDef) {
   if ("IPWhitelistPolicy".equals(policyDef.getId())) { // $NON-NLS-1$
     return ipListFormFactory.get();
   }
   if ("IPBlacklistPolicy".equals(policyDef.getId())) { // $NON-NLS-1$
     return ipListFormFactory.get();
   }
   if ("BASICAuthenticationPolicy".equals(policyDef.getId())) { // $NON-NLS-1$
     return basicAuthFormFactory.get();
   }
   return defaultFormFactory.get();
 }
  @Override
  public User getUser() {
    User user = null;

    try {
      if (config.getMode() == ModeType.MOCK) {
        user =
            new User() {

              private static final long serialVersionUID = 1L;

              @Override
              public String getId() {
                return "mockuser";
              }

              @Override
              public Object getAttribute(Object key) {
                return null;
              }

              @Override
              public void setAttribute(Object key, Object value) {}
            };
      } else {
        user = service.get().getUser(credential.getUsername());
      }

    } catch (RaseaException e) {
      // TODO Colocar uma mensagem amigável para o programador saber o que ocorreu.
      e.printStackTrace();
    }

    return user;
  }
  @Override
  public void doSearch() {
    CriteriaBuilder builder = em.getCriteriaBuilder();
    CriteriaQuery<QuestionType> cquery = builder.createQuery(QuestionType.class);
    Root<QuestionType> rqt = cquery.from(QuestionType.class);

    cquery
        .select(rqt)
        .where(
            builder.like(
                builder.lower(rqt.get(QuestionType_.name)), searchCriteria.getSearchPattern()));

    List<QuestionType> results =
        em.createQuery(cquery)
            .setMaxResults(searchCriteria.getFetchSize())
            .setFirstResult(searchCriteria.getFetchOffset())
            .getResultList();

    nextPageAvailable = results.size() > searchCriteria.getPageSize();
    if (nextPageAvailable) {
      // NOTE create new ArrayList since subList creates unserializable list
      questionTypes = new ArrayList<QuestionType>(results.subList(0, searchCriteria.getPageSize()));
    } else {
      questionTypes = results;
    }
    log.info(
        messageBuilder
            .get()
            .text("Found {0} hotel(s) matching search term [ {1} ] (limit {2})")
            .textParams(
                questionTypes.size(), searchCriteria.getQuery(), searchCriteria.getPageSize())
            .build()
            .getText());
  }
 @Test
 @SpecAssertions({@SpecAssertion(section = DECORATOR_INVOCATION, id = "acb")})
 public void testDecoratorIsInvoked() {
   assertTrue(instance.isAmbiguous());
   Mule mule = instance.get();
   assertNotNull(mule);
 }
  @Override
  public Set<MavenRepositoryMetadata> getRepositoriesResolvingArtifact(
      final String pomXML, final MavenRepositoryMetadata... filter) {
    GAVPreferences gavPreferences = gavPreferencesProvider.get();
    gavPreferences.load();
    if (gavPreferences.isConflictingGAVCheckDisabled()) {
      return Collections.EMPTY_SET;
    }

    final InputStream pomStream = new ByteArrayInputStream(pomXML.getBytes(StandardCharsets.UTF_8));
    final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);
    final GAV gav =
        new GAV(mavenProject.getGroupId(), mavenProject.getArtifactId(), mavenProject.getVersion());

    final Set<MavenRepositoryMetadata> repositoriesResolvingArtifact =
        new HashSet<MavenRepositoryMetadata>();
    repositoriesResolvingArtifact.addAll(getRepositoriesResolvingArtifact(gav, mavenProject));

    // Filter results if necessary
    if (filter != null && filter.length > 0) {
      repositoriesResolvingArtifact.retainAll(Arrays.asList(filter));
    }

    return repositoriesResolvingArtifact;
  }
Пример #10
0
  protected <T> T safeGet(Instance<T> instance) {
    try {
      T object = instance.get();
      logger.debug("About to set object {} on task service", object);
      return object;
    } catch (AmbiguousResolutionException e) {
      // special handling in case cdi discovered multiple injections
      // that are actually same instances - e.g. weld on tomcat
      HashSet<T> available = new HashSet<T>();

      for (T object : instance) {
        available.add(object);
      }

      if (available.size() == 1) {
        return available.iterator().next();
      } else {
        throw e;
      }
    } catch (Throwable e) {
      logger.warn("Cannot get value of of instance {} due to {}", instance, e.getMessage());
    }

    return null;
  }
 @Test
 public void testAvailableTimeZonesProducerViaBean() {
   Assert.assertNotNull(availBean);
   List<ForwardingTimeZone> list = availBean.get().getAvailTimeZones();
   Assert.assertNotNull(list);
   Assert.assertTrue(!list.isEmpty());
   Assert.assertTrue(list.size() > 0);
 }
Пример #12
0
 @Test
 public void createRoute() {
   EventBridge b = bridge.get();
   Route r = b.createRoute(RouteType.EGRESS, Object.class);
   Assert.assertNotNull(r);
   Assert.assertEquals(RouteType.EGRESS, r.getType());
   Assert.assertEquals(Object.class, r.getPayloadType());
 }
Пример #13
0
 @PostConstruct
 public void reset() {
   this.smallest = 0;
   this.guess = 0;
   this.remainingGuesses = 10;
   this.biggest = maxNumber;
   this.number = randomNumber.get();
 }
 @Override
 public Relationship findById(Long id) {
   return queryBuilder
       .get()
       .select(RelationshipBean.class)
       .where()
       .equal(RelationshipBean_.id, id)
       .find();
 }
Пример #15
0
 @Override
 protected Object createTest() throws Exception {
   Instance<?> select = CDI.current().select(getTestClass().getJavaClass());
   if (select.isUnsatisfied()) {
     return getTestClass().getJavaClass().newInstance();
   } else {
     return select.get();
   }
 }
 @Test
 // WELD-556
 public void testDecoratedSFSBsAreRemoved() {
   StandardChickenHutch.reset();
   AlarmedChickenHutch.reset();
   chickenHutchInstance.get();
   assert StandardChickenHutch.isPing();
   assert AlarmedChickenHutch.isPing();
   assert StandardChickenHutch.isPredestroy();
 }
  @AroundInvoke
  public Object manage(InvocationContext ic) throws Exception {

    if (!currentPlayer.get().isShot()) {
      // I'am doing science and I'am still alive!
      return ic.proceed();
    }

    return null;
  }
  @Override
  public Set<MavenRepositoryMetadata> getRepositoriesResolvingArtifact(
      final GAV gav, final Project project, final MavenRepositoryMetadata... filter) {
    GAVPreferences gavPreferences = gavPreferencesProvider.get();
    final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo =
        scopeResolutionStrategies.getUserInfoFor(
            GuvnorPreferenceScopes.PROJECT, project.getEncodedIdentifier());
    gavPreferences.load(scopeResolutionStrategyInfo);
    if (gavPreferences.isConflictingGAVCheckDisabled()) {
      return Collections.EMPTY_SET;
    }

    final Set<MavenRepositoryMetadata> repositoriesResolvingArtifact =
        new HashSet<MavenRepositoryMetadata>();

    try {
      // Load Project's pom.xml
      final Path pomXMLPath = project.getPomXMLPath();
      final org.uberfire.java.nio.file.Path nioPomXMLPath = Paths.convert(pomXMLPath);
      final String pomXML = ioService.readAllString(nioPomXMLPath);

      final InputStream pomStream =
          new ByteArrayInputStream(pomXML.getBytes(StandardCharsets.UTF_8));
      final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);
      repositoriesResolvingArtifact.addAll(getRepositoriesResolvingArtifact(gav, mavenProject));

      // Filter results if necessary
      if (filter != null && filter.length > 0) {
        repositoriesResolvingArtifact.retainAll(Arrays.asList(filter));
      }

    } catch (IllegalArgumentException iae) {
      log.error(
          "Unable to get Remote Repositories for Project '"
              + project.getProjectName()
              + "'. Returning empty Collection. ",
          iae);

    } catch (NoSuchFileException nsfe) {
      log.error(
          "Unable to get Remote Repositories for Project '"
              + project.getProjectName()
              + "'. Returning empty Collection. ",
          nsfe);

    } catch (org.uberfire.java.nio.IOException ioe) {
      log.error(
          "Unable to get Remote Repositories for Project '"
              + project.getProjectName()
              + "'. Returning empty Collection. ",
          ioe);
    }

    return repositoriesResolvingArtifact;
  }
  @Test
  public void test() {
    WeldContainer weld = new Weld().initialize();
    Instance<CalculatorService> instance = weld.instance().select(CalculatorService.class);
    CalculatorService service = instance.get();

    assertEquals(21, service.sum(Arrays.asList(1, 2, 3, 4, 5, 6)));

    double resultDiv = service.div(42.0, 2.0);
    assertEquals(21.0, resultDiv, 0.0001);
  }
Пример #20
0
 @Timeout
 public void timeout(Timer timer) {
   if (beanManager.getContext(ApplicationScoped.class).isActive()) {
     applicationScopeActive = true;
     if (beanId > 0.0) {
       if (beanId == simpleApplicationBeanInstance.get().getId()) {
         sameBean = true;
       }
     } else {
       beanId = simpleApplicationBeanInstance.get().getId();
     }
   }
   // CDITCK-221 - applicationScopeActive, beanId and sameBean have been set and are testable
   if (timer.getInfo().equals(CLIMB_COMMAND)) {
     climbed = true;
   }
   if (timer.getInfo().equals(DESCEND_COMMAND)) {
     descended = true;
   }
 }
Пример #21
0
 public void pullStateItem() {
   FacesContext facesContext = context.get();
   if (facesContext != null
       && !facesContext.isPostback()
       && facesContext.getExternalContext().getRequestParameterMap().get("itemIndex") != null) {
     Integer itemIndex =
         Integer.valueOf(
             facesContext.getExternalContext().getRequestParameterMap().get("itemIndex"));
     this.pullStateItem(itemIndex);
   }
 }
 private void removeSessions(SamlNameId nameId, String idpEntityId, List<String> sessionIndexes) {
   for (SamlSpSessionImpl session : samlSpSessions.getSessions()) {
     if (session.getPrincipal().getNameId().equals(nameId)
         && session.getIdentityProvider().getEntityId().equals(idpEntityId)) {
       if (sessionIndexes.size() == 0 || sessionIndexes.contains(session.getSessionIndex())) {
         samlSpSessions.removeSession((SamlSpSessionImpl) session);
         samlServiceProviderSpi.get().loggedOut(session);
       }
     }
   }
 }
Пример #23
0
  @Override
  public void execute(FacesContext context) throws FacesException {
    /*
     * 1. Find the bean + method that matches the correct @RequestMapping.
     */
    Set<Bean<?>> beans = getBeanManager().getBeans(Object.class, new AnnotationLiteral<Any>() {});
    Iterator<Bean<?>> beanIterator = beans.iterator();
    RequestMappingInfo current = null;

    while (beanIterator.hasNext()) {
      Bean<?> bean = beanIterator.next();
      RequestMappingInfo info = findMethodRequestMapping(context, bean);

      if (current == null) {
        current = info;
      } else if (info != null && info.getLength() > current.getLength()) {
        current = info;
      }
    }

    String viewId = null;

    if (current != null) {
      /*
       * 2. Get an instance of that bean.
       */
      Instance instance =
          CDI.current().select(current.getBean().getBeanClass(), new AnnotationLiteral<Any>() {});

      try {
        /*
         * 3. Call the required method and capture its result.
         *
         * Currently assuming String invoke() signature, but that obviously
         * needs to be expanded.
         */
        viewId = (String) current.getMethod().invoke(instance.get(), new Object[0]);
      } catch (Throwable throwable) {
        throw new FacesException(throwable);
      }
      if (context.getViewRoot() == null) {
        UIViewRoot viewRoot = new UIViewRoot();
        viewRoot.setRenderKitId("HTML_BASIC");
        /*
         * 4. Set the resulting view id on the viewroot.
         */
        viewRoot.setViewId(viewId);
        context.setViewRoot(viewRoot);
      }
    }
  }
Пример #24
0
  private void configure() {
    String repositoryAlias = "";
    String branchName = "";
    if (!this.configured) {

      String uuid = Utils.getUUID(httpRequest.get());
      if (uuid == null) {
        uuid = httpRequest.get().getParameter("assetId");
      }
      if (uuid == null && path != null) {
        uuid = path;
      }
      if (uuid != null) {

        if (uuid.indexOf("@") == -1) {
          // simple fs pattern
          Pattern pattern = Pattern.compile(SEP + "(.*?)" + SEP);
          Matcher matcher = pattern.matcher(uuid);
          if (matcher.find()) {
            repositoryAlias = matcher.group(1);
          }
        } else {
          // git based pattern
          Pattern pattern = Pattern.compile("(://)(.*?)@(.*?)/");
          Matcher matcher = pattern.matcher(uuid);
          if (matcher.find()) {
            branchName = matcher.group(2);
            repositoryAlias = matcher.group(3);
          }
        }
      }

      RepositoryDescriptor found = provider.getRepositoryDescriptor(repositoryAlias, branchName);
      this.fileSystem = found.getFileSystem();
      this.repositoryRoot = found.getRepositoryRoot();
      this.repositoryRootPath = found.getRepositoryRootPath();
    }
  }
Пример #25
0
  public String update() {
    Login login = loginUser.get();
    this.conversation.end();

    try {
      if (this.id == null) {
        this.profiloUsoConsumo.setOwnerid(
            new OwnerId(login.getCurrentUser(), login.getCurrentDomain()));
        PermissionProp pp = new PermissionProp();
        pp.setSUBSETDOMAIN(SecAttrib.CONTROL);
        pp.setIDENTITYDOMAIN(SecAttrib.CONTROL);
        pp.setINTERSECTIONDOMAIN(SecAttrib.READ);
        pp.setOTHER(SecAttrib.NONE);

        this.profiloUsoConsumo.setPermissionprop(pp);

        ComposizioneEdifici comp =
            this.entityManager.merge(this.profiloUsoConsumo.getComposizioneEdificio());
        this.profiloUsoConsumo.setComposizioneEdificio(comp);
        this.entityManager.persist(this.profiloUsoConsumo);
        /*
        	ComposizioneEdifici comp=this.profiloUsoConsumo.getComposizioneEdificio();
        if (comp!=null) {
         comp=this.entityManager.find(ComposizioneEdifici.class, comp.getId());
          comp.addProfilo(this.profiloUsoConsumo);
           this.entityManager.merge(comp);
         }
        	 */

        return "search?faces-redirect=true";
      } else {
        // salvo dall'altro lato della relazione
        ComposizioneEdifici comp = this.profiloUsoConsumo.getComposizioneEdificio();
        /*
         	 if (comp!=null)
          {
        comp=this.entityManager.find(ComposizioneEdifici.class, comp.getId());
          comp.addProfilo(this.profiloUsoConsumo);
           this.entityManager.merge(comp);
            }
         	*/
        this.entityManager.merge(this.profiloUsoConsumo);
        return "view?faces-redirect=true&id=" + this.profiloUsoConsumo.getId();
      }

    } catch (Exception e) {
      FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(e.getMessage()));
      return null;
    }
  }
 @Produces
 public ServletDescriptor jerseyServlet() {
   String urlPattern = restServerConfiguration.getRestServletMapping();
   if (!applicationInstance.isUnsatisfied() && !applicationInstance.isAmbiguous()) {
     ApplicationPath annotation =
         ClassUtils.getAnnotation(applicationInstance.get().getClass(), ApplicationPath.class);
     if (annotation != null) {
       String path = annotation.value();
       urlPattern = path.endsWith("/") ? path + "*" : path + "/*";
     }
   }
   return new ServletDescriptor(
       SERVLET_NAME, null, new String[] {urlPattern}, 1, null, true, ServletContainer.class);
 }
Пример #27
0
 private void stopGlusterServices(VDS vds) {
   if (vds.getVdsGroupSupportsGlusterService()) {
     // Stop glusterd service first
     boolean succeeded =
         resourceManagerProvider
             .get()
             .runVdsCommand(
                 VDSCommandType.ManageGlusterService,
                 new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "stop"))
             .getSucceeded();
     if (succeeded) {
       // Stop other gluster related processes on the node
       succeeded =
           resourceManagerProvider
               .get()
               .runVdsCommand(
                   VDSCommandType.StopGlusterProcesses,
                   new VdsIdVDSCommandParametersBase(vds.getId()))
               .getSucceeded();
       // Mark the bricks as DOWN on this node
       if (succeeded) {
         List<GlusterBrickEntity> bricks =
             glusterBrickDao.getGlusterVolumeBricksByServerId(vds.getId());
         for (GlusterBrickEntity brick : bricks) {
           brick.setStatus(GlusterStatus.DOWN);
         }
         glusterBrickDao.updateBrickStatuses(bricks);
       }
     }
     if (!succeeded) {
       log.error(
           "Failed to stop gluster services while moving the host '{}' to maintenance",
           vds.getName());
     }
   }
 }
  @Before
  public void setup() {
    filterConfig = new MockFilterConfig(new MockServletContext());
    filterConfig.setContextPath(contextPath);

    // useful minimum configuration. tests may overwrite these values before calling filter.init().
    filterConfig.initParams.put(HOST_PAGE_INIT_PARAM, "/dont/care/host");
    filterConfig.initParams.put(LOGIN_PAGE_INIT_PARAM, "/dont/care/login");
    filterConfig.initParams.put(FORCE_REAUTHENTICATION_INIT_PARAM, "true");

    mockHttpSession = new MockHttpSession();

    request =
        new MockHttpServletRequest(
            mockHttpSession, "POST", "/some/servlet/path", "/dont/care/login");

    identity.setCredentials(credentials);

    when(identityInstance.get()).thenReturn(identity);

    when(credentialsInstance.get()).thenReturn(credentials);

    when(preferredAuthFilterInstance.get()).thenReturn(formAuthenticationScheme);
  }
 public void processIDPResponse(
     HttpServletRequest httpRequest,
     HttpServletResponse httpResponse,
     StatusResponseType statusResponse) {
   StatusType status = statusResponse.getStatus();
   if (status.getStatusCode().getValue().equals(SamlConstants.STATUS_SUCCESS)) {
     samlServiceProviderSpi
         .get()
         .globalLogoutSucceeded(responseHandler.createResponseHolder(httpResponse));
   } else {
     String statusCodeLevel1 = status.getStatusCode().getValue();
     String statusCodeLevel2 = null;
     if (status.getStatusCode().getStatusCode() != null) {
       statusCodeLevel2 = status.getStatusCode().getStatusCode().getValue();
     }
     samlServiceProviderSpi
         .get()
         .globalLogoutFailed(
             statusCodeLevel1,
             statusCodeLevel2,
             responseHandler.createResponseHolder(httpResponse));
   }
   dialogue.setFinished(true);
 }
Пример #30
0
  @Override
  public void authenticate() {
    if (credentials.getCredential() == null) {
      return;
    }

    Credentials creds;

    if (isUsernamePasswordCredential()) {
      creds =
          new UsernamePasswordCredentials(
              credentials.getUserId(), (Password) credentials.getCredential());
    } else if (isDigestCredential()) {
      creds = new DigestCredentials((Digest) credentials.getCredential());
    } else if (isCustomCredential()) {
      creds = (Credentials) credentials.getCredential();
    } else {
      throw new UnexpectedCredentialException(
          "Unsupported credential type [" + credentials.getCredential() + "].");
    }

    if (AUTHENTICATION_LOGGER.isDebugEnabled()) {
      AUTHENTICATION_LOGGER.debugf("Validating credentials [%s] using PicketLink IDM.", creds);
    }

    identityManager.get().validateCredentials(creds);

    this.credentials.setStatus(creds.getStatus());
    this.credentials.setValidatedAccount(creds.getValidatedAccount());

    if (AUTHENTICATION_LOGGER.isDebugEnabled()) {
      AUTHENTICATION_LOGGER.debugf(
          "Credential status is [%s] and validated account [%s]",
          this.credentials.getStatus(), this.credentials.getValidatedAccount());
    }

    if (Credentials.Status.VALID.equals(creds.getStatus())) {
      setStatus(AuthenticationStatus.SUCCESS);
      setAccount(creds.getValidatedAccount());
    } else if (Credentials.Status.ACCOUNT_DISABLED.equals(creds.getStatus())) {
      throw new LockedAccountException(
          "Account [" + this.credentials.getUserId() + "] is disabled.");
    } else if (Credentials.Status.EXPIRED.equals(creds.getStatus())) {
      throw new CredentialExpiredException(
          "Credential is expired for Account [" + this.credentials.getUserId() + "].");
    }
  }