src/main/java/org/efaps/ui/wicket/EFapsSession.java
private boolean checkLogin(final String _name,
                               final String _passwd)
    {

        boolean loginOk = false;
        try {
            if (Context.isTMActive()) {
                Context.getThreadContext();
            } else {
                Context.begin();
            }
            boolean ok = false;

            try {
                // on a new login the cache for Person is reseted
                Person.reset(_name);
                final EFapsApplication app = (EFapsApplication) getApplication();
                final LoginHandler loginHandler = new LoginHandler(app.getApplicationKey());
                final Person person = loginHandler.checkLogin(_name, _passwd);
                if (person != null && !person.getRoles().isEmpty()) {
                    loginOk = true;
                    this.sessionAttributes.put(UserAttributesSet.CONTEXTMAPKEY, new UserAttributesSet(_name));
                }
                ok = true;
            } finally {
                if (ok && Context.isTMActive()) {
                    Context.commit();
                } else {
                    if (Context.isTMMarkedRollback()) {
                        EFapsSession.LOG.error("transaction is marked to roll back");
                    } else {
                        EFapsSession.LOG.error("transaction manager in undefined status");
                    }
                    Context.rollback();
                }
            }
        } catch (final EFapsException e) {
            EFapsSession.LOG.error("could not check name and password", e);
        }
        return loginOk;
    }
private boolean checkLogin(final String _name,
                               final String _passwd)
    {

        boolean loginOk = false;
        try {
            if (Context.isTMActive()) {
                Context.getThreadContext();
            } else {
                Context.begin();
            }
            boolean ok = false;

            try {
                // on a new login the cache for Person is reseted
                Person.reset(_name);
                final EFapsApplication app = (EFapsApplication) getApplication();
                final LoginHandler loginHandler = new LoginHandler(app.getApplicationKey());
                final Person person = loginHandler.checkLogin(_name, _passwd);
                if (person != null && !person.getRoles().isEmpty()) {
                    loginOk = true;
                    this.sessionAttributes.put(UserAttributesSet.CONTEXTMAPKEY, new UserAttributesSet(_name));
                }
                ok = true;
            } finally {
                if (ok && Context.isTMActive()) {
                    Context.commit();
                } else {
                    if (Context.isTMMarkedRollback()) {
                        EFapsSession.LOG.error("transaction is marked to roll back");
                    } else {
                        EFapsSession.LOG.error("transaction manager in undefined status");
                    }
                    Context.rollback();
                }
            }
        } catch (final EFapsException e) {
            EFapsSession.LOG.error("could not check name and password", e);
        }
        return loginOk;
    }
private boolean checkLogin ( final String _name , final String _passwd ) { boolean loginOk = false ; try { if ( Context . isTMActive ( ) ) { Context . getThreadContext ( ) ; } else { Context . begin ( ) ; } boolean ok = false ; try { // on a new login the cache for Person is reseted Person . reset ( _name ) ; final EFapsApplication app = ( EFapsApplication ) getApplication ( ) ; final LoginHandler loginHandler = new LoginHandler ( app . getApplicationKey ( ) ) ; final Person person = loginHandler . checkLogin ( _name , _passwd ) ; if ( person != null && ! person . getRoles ( ) . isEmpty ( ) ) { loginOk = true ; this . sessionAttributes . put ( UserAttributesSet . CONTEXTMAPKEY , new UserAttributesSet ( _name ) ) ; } ok = true ; } finally { if ( ok && Context . isTMActive ( ) ) { Context . commit ( ) ; } else { if ( Context . isTMMarkedRollback ( ) ) { EFapsSession . LOG . error ( "transaction is marked to roll back" ) ; } else { EFapsSession . LOG . error ( "transaction manager in undefined status" ) ; } Context . rollback ( ) ; } } } catch ( final EFapsException e ) { EFapsSession . LOG . error ( "could not check name and password" , e ) ; } return loginOk ; }
method to check the LoginInformation (Name and Password) against the
eFapsDatabase. To check the Information a Context is opened an afterwards
closed. It also puts a new Instance of UserAttributes into the instance
map {@link #sessionAttributes}. The person returned must have at least one
role asigned to be confirmed as value.

@param _name Name of the User to be checked in
@param _passwd Password of the User to be checked in
@return true if LoginInformation was valid, else false
method to check the LoginInformation ( Name and Password ) against the eFapsDatabase . To check the Information a Context is opened an afterwards closed . It also puts a new Instance of UserAttributes into the instance map { @link #sessionAttributes } . The person returned must have at least one role asigned to be confirmed as value .