loginmodules/password/pwcommon/src/main/java/org/beiter/michael/authn/jaas/loginmodules/password/common/PasswordLoginModule.java
@Override
    // Check is broken [LOG.info()]: PMD reports issues although log stmt is guarded. @todo revisit when upgrading PMD.
    @SuppressWarnings("PMD.GuardLogStatementJavaUtil")
    public final boolean abort()
            throws LoginException {

        if (pendingSubject == null) {
            // the login method of this module has failed earlier, hence we do not need to clean up anything
            // return 'false' to indicate that this module's login and/or commit method failed
            // As the login method failed, the state of the module has already been cleared and we do not know
            // the username / domain anymore. Hence no auditing / message queue notification, and not verbose logging.

            LOG.debug("Aborting authentication, as the authentication has failed earlier (login method)");

            return false;
        } else if (committedSubject == null) {
            // the login method of this module succeeded, but the overall authentication failed

            // string concatenation is only executed if log level is actually enabled
            if (LOG.isDebugEnabled()) {
                LOG.debug("Aborting authentication: '" + username + "@" + domain + "'");
            }

            // cache the username and domain, for they will be purged by "cleanState()"
            final String tempUsername = username;
            final String tempDomain = domain;

            cleanState();

            final String baseError = new StringBuilder().
                    append("Login post-processing failed after abort for '").
                    append(tempUsername).
                    append("@").
                    append(tempDomain).
                    toString();
            AuditHelper.auditEvent(audit, tempDomain, tempUsername, Events.AUTHN_ABORT_COMMIT,
                    baseError + "', but cannot audit login attempt");
            MessageHelper.postMessage(messageQ, tempDomain, tempUsername, Events.AUTHN_ABORT_COMMIT,
                    baseError + "', but cannot post MQ login attempt event");

            // string concatenation is only executed if log level is actually enabled
            if (LOG.isInfoEnabled()) {
                LOG.info("Authentication aborted for '" + tempUsername + "@" + tempDomain + "'");
            }
            return true;
        } else {
            // overall authentication succeeded and commit succeeded, but someone else's commit failed

            final String baseError = new StringBuilder().
                    append("Login post-processing failed after abort for '").
                    append(username).
                    append("@").
                    append(domain).
                    toString();
            AuditHelper.auditEvent(audit, domain, username, Events.AUTHN_ABORT_CHAIN,
                    baseError + "', but cannot audit login attempt");
            MessageHelper.postMessage(messageQ, domain, username, Events.AUTHN_ABORT_CHAIN,
                    baseError + "', but cannot post MQ login attempt event");

            // cache the username and domain, for they will be purged by "logout()"
            final String tempUsername = username;
            final String tempDomain = domain;

            logout();

            // string concatenation is only executed if log level is actually enabled
            if (LOG.isInfoEnabled()) {
                LOG.info("Authentication aborted for '" + tempUsername + "@" + tempDomain + "'");
            }
            return true;
        }
    }
@Override
    // Check is broken [LOG.info()]: PMD reports issues although log stmt is guarded. @todo revisit when upgrading PMD.
    @SuppressWarnings("PMD.GuardLogStatementJavaUtil")
    public final boolean abort()
            throws LoginException {

        if (pendingSubject == null) {
            // the login method of this module has failed earlier, hence we do not need to clean up anything
            // return 'false' to indicate that this module's login and/or commit method failed
            // As the login method failed, the state of the module has already been cleared and we do not know
            // the username / domain anymore. Hence no auditing / message queue notification, and not verbose logging.

            LOG.debug("Aborting authentication, as the authentication has failed earlier (login method)");

            return false;
        } else if (committedSubject == null) {
            // the login method of this module succeeded, but the overall authentication failed

            // string concatenation is only executed if log level is actually enabled
            if (LOG.isDebugEnabled()) {
                LOG.debug("Aborting authentication: '" + username + "@" + domain + "'");
            }

            // cache the username and domain, for they will be purged by "cleanState()"
            final String tempUsername = username;
            final String tempDomain = domain;

            cleanState();

            final String baseError = new StringBuilder().
                    append("Login post-processing failed after abort for '").
                    append(tempUsername).
                    append("@").
                    append(tempDomain).
                    toString();
            AuditHelper.auditEvent(audit, tempDomain, tempUsername, Events.AUTHN_ABORT_COMMIT,
                    baseError + "', but cannot audit login attempt");
            MessageHelper.postMessage(messageQ, tempDomain, tempUsername, Events.AUTHN_ABORT_COMMIT,
                    baseError + "', but cannot post MQ login attempt event");

            // string concatenation is only executed if log level is actually enabled
            if (LOG.isInfoEnabled()) {
                LOG.info("Authentication aborted for '" + tempUsername + "@" + tempDomain + "'");
            }
            return true;
        } else {
            // overall authentication succeeded and commit succeeded, but someone else's commit failed

            final String baseError = new StringBuilder().
                    append("Login post-processing failed after abort for '").
                    append(username).
                    append("@").
                    append(domain).
                    toString();
            AuditHelper.auditEvent(audit, domain, username, Events.AUTHN_ABORT_CHAIN,
                    baseError + "', but cannot audit login attempt");
            MessageHelper.postMessage(messageQ, domain, username, Events.AUTHN_ABORT_CHAIN,
                    baseError + "', but cannot post MQ login attempt event");

            // cache the username and domain, for they will be purged by "logout()"
            final String tempUsername = username;
            final String tempDomain = domain;

            logout();

            // string concatenation is only executed if log level is actually enabled
            if (LOG.isInfoEnabled()) {
                LOG.info("Authentication aborted for '" + tempUsername + "@" + tempDomain + "'");
            }
            return true;
        }
    }
@ Override // Check is broken [LOG.info()]: PMD reports issues although log stmt is guarded. @todo revisit when upgrading PMD. @ SuppressWarnings ( "PMD.GuardLogStatementJavaUtil" ) public final boolean abort ( ) throws LoginException { if ( pendingSubject == null ) { // the login method of this module has failed earlier, hence we do not need to clean up anything // return 'false' to indicate that this module's login and/or commit method failed // As the login method failed, the state of the module has already been cleared and we do not know // the username / domain anymore. Hence no auditing / message queue notification, and not verbose logging. LOG . debug ( "Aborting authentication, as the authentication has failed earlier (login method)" ) ; return false ; } else if ( committedSubject == null ) { // the login method of this module succeeded, but the overall authentication failed // string concatenation is only executed if log level is actually enabled if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Aborting authentication: '" + username + "@" + domain + "'" ) ; } // cache the username and domain, for they will be purged by "cleanState()" final String tempUsername = username ; final String tempDomain = domain ; cleanState ( ) ; final String baseError = new StringBuilder ( ) . append ( "Login post-processing failed after abort for '" ) . append ( tempUsername ) . append ( "@" ) . append ( tempDomain ) . toString ( ) ; AuditHelper . auditEvent ( audit , tempDomain , tempUsername , Events . AUTHN_ABORT_COMMIT , baseError + "', but cannot audit login attempt" ) ; MessageHelper . postMessage ( messageQ , tempDomain , tempUsername , Events . AUTHN_ABORT_COMMIT , baseError + "', but cannot post MQ login attempt event" ) ; // string concatenation is only executed if log level is actually enabled if ( LOG . isInfoEnabled ( ) ) { LOG . info ( "Authentication aborted for '" + tempUsername + "@" + tempDomain + "'" ) ; } return true ; } else { // overall authentication succeeded and commit succeeded, but someone else's commit failed final String baseError = new StringBuilder ( ) . append ( "Login post-processing failed after abort for '" ) . append ( username ) . append ( "@" ) . append ( domain ) . toString ( ) ; AuditHelper . auditEvent ( audit , domain , username , Events . AUTHN_ABORT_CHAIN , baseError + "', but cannot audit login attempt" ) ; MessageHelper . postMessage ( messageQ , domain , username , Events . AUTHN_ABORT_CHAIN , baseError + "', but cannot post MQ login attempt event" ) ; // cache the username and domain, for they will be purged by "logout()" final String tempUsername = username ; final String tempDomain = domain ; logout ( ) ; // string concatenation is only executed if log level is actually enabled if ( LOG . isInfoEnabled ( ) ) { LOG . info ( "Authentication aborted for '" + tempUsername + "@" + tempDomain + "'" ) ; } return true ; } }
{@inheritDoc}
{