docs: private Session createSession(Properties props) throws InvalidPasswordDecodingException, UnsupportedCryptoAlgorithmException
      {
  
          Session session = null;
  
          // Since the password attribute in the server.xml is masked
          // the decryption algorythm is needed to before it can be put
          // it into the props object. 
  
          if (sessionProperties.get(PASSWORD) != null && sessionProperties.get(USER) != null)
          {
  
              SerializableProtectedString password = (SerializableProtectedString) sessionProperties.get(PASSWORD);
              String pwdStr = password == null ? null : String.valueOf(password.getChars());
              pwdStr = PasswordUtil.getCryptoAlgorithm(pwdStr) == null ? pwdStr : PasswordUtil.decode(pwdStr);
              final String pwd = pwdStr;
  
              sessionProperties.put("mail.password", pwdStr);
              session = Session.getInstance(props, new Authenticator() {
                  @Override
                  protected PasswordAuthentication getPasswordAuthentication() {
                      return new PasswordAuthentication((String) sessionProperties.get(USER), pwd);
                  }
              });
  
          }
          else
          {
              session = Session.getInstance(props, null);
          }
  
          return session;
      }