public final boolean commit()
        throws LoginException
    {
        final boolean ret;

        // If authentication was not successful, just return false
        if (this.principal == null) {
            ret = false;
        } else {
            ret = true;

            // Add our Principal and Related Roles to the Subject if needed
            if (!this.subject.getPrincipals().contains(this.principal)) {
                this.subject.getPrincipals().add(this.principal);

                try {
                    final JAASSystem jaasSystem = JAASSystem.getJAASSystem(this.jaasSystemName);
                    final Person person = Person.getWithJAASKey(jaasSystem, this.principal.getName());
                    if (person != null) {
                        final Set<Role> roles = person.getRolesFromDB(jaasSystem);
                        for (final Role role : roles) {
                            this.subject.getPrincipals().add(new RolePrincipal(role.getName()));
                        }
                        final Set<Group> groups = person.getGroupsFromDB(jaasSystem);
                        for (final Group group : groups) {
                            this.subject.getPrincipals().add(new GroupPrincipal(group.getName()));
                        }
                    }
                } catch (final EFapsException e) {
                    UserLoginModule.LOG.error("assign of roles to user '"
                            + this.principal.getName() + "' not possible", e);
                    throw new LoginException(e.toString());
                }
            }
        }

        this.committed = true;
        return ret;
    }
public final boolean commit ( ) throws LoginException { final boolean ret ; if ( this . principal == null ) { ret = false ; } else { ret = true ; if ( ! this . subject . getPrincipals ( ) . contains ( this . principal ) ) { this . subject . getPrincipals ( ) . add ( this . principal ) ; try { final JAASSystem jaasSystem = JAASSystem . getJAASSystem ( this . jaasSystemName ) ; final Person person = Person . getWithJAASKey ( jaasSystem , this . principal . getName ( ) ) ; if ( person != null ) { final Set < Role > roles = person . getRolesFromDB ( jaasSystem ) ; for ( final Role role : roles ) { this . subject . getPrincipals ( ) . add ( new RolePrincipal ( role . getName ( ) ) ) ; } final Set < Group > groups = person . getGroupsFromDB ( jaasSystem ) ; for ( final Group group : groups ) { this . subject . getPrincipals ( ) . add ( new GroupPrincipal ( group . getName ( ) ) ) ; } } } catch ( final EFapsException e ) { UserLoginModule . LOG . error ( "assign of roles to user '" + this . principal . getName ( ) + "' not possible" , e ) ; throw new LoginException ( e . toString ( ) ) ; } } } this . committed = true ; return ret ; }
Adds the principal person and all found roles for the given JAAS system
{@link #jaasSystemName} related to the person.

@return <i>true</i> if authentification was successful, otherwise
<i>false</i>
@throws LoginException on error