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 logout()
            throws LoginException {

        final StringBuilder principals = new StringBuilder(":");

        // remove all the principals that we added in the commit() method from the 'subject' object
        // (that's why we stored our principals in the 'committedSubject' object...)
        if (committedSubject != null && committedSubject.getPrincipals() != null) {
            final StringBuilder stringBuilder = new StringBuilder();
            for (final Principal p : committedSubject.getPrincipals()) {
                pSubject.getPrincipals().remove(p);

                // string concatenation is only executed if log level is actually enabled
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Logging out subject: '" + p.getName() + "'");
                }

                principals.append(p.getName()).append(':');

                stringBuilder.delete(0, stringBuilder.length());
                final String baseError = stringBuilder.
                        append("Logout successful for '").
                        append(username).
                        append("@").
                        append(domain).
                        toString();
                AuditHelper.auditEvent(audit, domain, username, Events.AUTHN_LOGOUT,
                        baseError + "', but cannot audit logout attempt");
                MessageHelper.postMessage(messageQ, domain, username, Events.AUTHN_LOGOUT,
                        baseError + "', but cannot post MQ logout attempt event");
            }
        }

        cleanState();

        // string concatenation is only executed if log level is actually enabled
        if (LOG.isInfoEnabled()) {
            LOG.info("Principals logged out: '" + principals + "'");
        }

        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 logout()
            throws LoginException {

        final StringBuilder principals = new StringBuilder(":");

        // remove all the principals that we added in the commit() method from the 'subject' object
        // (that's why we stored our principals in the 'committedSubject' object...)
        if (committedSubject != null && committedSubject.getPrincipals() != null) {
            final StringBuilder stringBuilder = new StringBuilder();
            for (final Principal p : committedSubject.getPrincipals()) {
                pSubject.getPrincipals().remove(p);

                // string concatenation is only executed if log level is actually enabled
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Logging out subject: '" + p.getName() + "'");
                }

                principals.append(p.getName()).append(':');

                stringBuilder.delete(0, stringBuilder.length());
                final String baseError = stringBuilder.
                        append("Logout successful for '").
                        append(username).
                        append("@").
                        append(domain).
                        toString();
                AuditHelper.auditEvent(audit, domain, username, Events.AUTHN_LOGOUT,
                        baseError + "', but cannot audit logout attempt");
                MessageHelper.postMessage(messageQ, domain, username, Events.AUTHN_LOGOUT,
                        baseError + "', but cannot post MQ logout attempt event");
            }
        }

        cleanState();

        // string concatenation is only executed if log level is actually enabled
        if (LOG.isInfoEnabled()) {
            LOG.info("Principals logged out: '" + principals + "'");
        }

        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 logout ( ) throws LoginException { final StringBuilder principals = new StringBuilder ( ":" ) ; // remove all the principals that we added in the commit() method from the 'subject' object // (that's why we stored our principals in the 'committedSubject' object...) if ( committedSubject != null && committedSubject . getPrincipals ( ) != null ) { final StringBuilder stringBuilder = new StringBuilder ( ) ; for ( final Principal p : committedSubject . getPrincipals ( ) ) { pSubject . getPrincipals ( ) . remove ( p ) ; // string concatenation is only executed if log level is actually enabled if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Logging out subject: '" + p . getName ( ) + "'" ) ; } principals . append ( p . getName ( ) ) . append ( ' ' ) ; stringBuilder . delete ( 0 , stringBuilder . length ( ) ) ; final String baseError = stringBuilder . append ( "Logout successful for '" ) . append ( username ) . append ( "@" ) . append ( domain ) . toString ( ) ; AuditHelper . auditEvent ( audit , domain , username , Events . AUTHN_LOGOUT , baseError + "', but cannot audit logout attempt" ) ; MessageHelper . postMessage ( messageQ , domain , username , Events . AUTHN_LOGOUT , baseError + "', but cannot post MQ logout attempt event" ) ; } } cleanState ( ) ; // string concatenation is only executed if log level is actually enabled if ( LOG . isInfoEnabled ( ) ) { LOG . info ( "Principals logged out: '" + principals + "'" ) ; } return true ; }
{@inheritDoc}
{