code: public final boolean commit()
          throws LoginException
      {
          boolean ret = false;
  
          if (this.mode == ActionCallback.Mode.ALL_PERSONS)  {
              for (final XMLPersonPrincipal personTmp : this.allPersons.values())  {
                  if (!this.subject.getPrincipals().contains(personTmp))  {
                      if (XMLUserLoginModule.LOG.isDebugEnabled())  {
                          XMLUserLoginModule.LOG.debug("commit person '" + personTmp + "'");
                      }
                      this.subject.getPrincipals().add(personTmp);
                  }
              }
              ret = true;
          } else if (this.person != null)  {
              if (XMLUserLoginModule.LOG.isDebugEnabled())  {
                  XMLUserLoginModule.LOG.debug("commit of '" + this.person + "'");
              }
              if (!this.subject.getPrincipals().contains(this.person))  {
                  this.subject.getPrincipals().add(this.person);
                  for (final XMLRolePrincipal principal : this.person.getRoles())  {
                      this.subject.getPrincipals().add(principal);
                  }
                  for (final XMLGroupPrincipal principal : this.person.getGroups())  {
                      this.subject.getPrincipals().add(principal);
                  }
              }
              ret = true;
          }
  
          return ret;
      }
docs: Method to commit the authentication process (phase 2).
  
  <p> This method is called if the LoginContext's
  overall authentication succeeded
  (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules
  succeeded).
  
  <p> If this LoginModule's own authentication attempt
  succeeded (checked by retrieving the private state saved by the
  <code>login</code> method), then this method associates relevant
  Principals and Credentials with the <code>Subject</code> located in the
  <code>LoginModule</code>.  If this LoginModule's own
  authentication attempted failed, then this method removes/destroys
  any state that was originally saved.
  
  <p>
  
  @exception LoginException if the commit fails
  
  @return true if this method succeeded, or false if this
  <code>LoginModule</code> should be ignored.