class DefaultAuthorizationMapping implements AuthorizationMapping {

    private static final Logger Log = LoggerFactory.getLogger(DefaultAuthorizationMapping.class);

    /**
     * Returns the default authorization identity (the identity to act as) for a provided authentication identity
     * (or 'principal' - whose password is used).
     *
     * @param authcid authentication identity (or 'principal' whose password is used)
     * @return The name of the default authorization identity to use.
     */
    @Override
    public String map(String authcid) {<FILL_FUNCTION_BODY>}

    /**
     * Returns the short name of the Policy
     *
     * @return The short name of the Policy
     */
    @Override
    public String name() {
        return "Default Mapping";
    }

    /**
     * Returns a description of the Policy
     *
     * @return The description of the Policy.
     */
    @Override
    public String description() {
        return "Simply removes the realm of the requesting authentication identity ('principal') if and only if "+
               "the realm matches the server's realm, the server's XMPP domain name, or any of the pre-approved "+
               "realm names. Otherwise the input value (authentication identity) is returned as-is, causing it to " +
               "be used as the authorization identity (the identity to act as).";
    }
}

        if(authcid.contains("@")) {
            String realm = authcid.substring(authcid.lastIndexOf('@')+1);
            String authzid = authcid.substring(0,authcid.lastIndexOf('@'));

            if(realm.length() > 0) {
                if(realm.equals(XMPPServerInfo.XMPP_DOMAIN.getValue())) {
                    Log.debug("DefaultAuthorizationMapping: realm = " + XMPPServerInfo.XMPP_DOMAIN.getKey());
                    return authzid;
                } else if(realm.equals(SASLAuthentication.REALM.getValue())) {
                    Log.debug("DefaultAuthorizationMapping: ream = sasl.realm");
                    return authzid;
                } else {
                    for(String approvedRealm : SASLAuthentication.APPROVED_REALMS.getValue()) {
                        if(realm.equals(approvedRealm)) {
                            Log.debug("DefaultAuthorizationMapping: realm ("+realm+") = "+approvedRealm+" which is approved");
                            return authzid;
                        } else {
                            Log.debug("DefaultAuthorizationPolicy: realm ("+realm+") != "+approvedRealm+" which is approved");
                        }
                    }
                }
                Log.debug("DefaultAuthorizationMapping: No approved mappings found.");
                return authcid;
            } else {
                Log.debug("DefaultAuthorizationMapping: Realm has no length");
            }
        } else {
            Log.debug("DefaultAuthorizationMapping: No realm found");
        }
        return authcid;
    
<no_super_class>