private void check(Invocation inv, Destination dest, CheckType checkType, ServerConnectionEndpoint conn)
private void check(Destination dest, CheckType checkType, ServerConnectionEndpoint conn)
   private void check(Invocation inv, Destination dest, CheckType checkType,                      ServerConnectionEndpoint conn)      throws JMSSecurityException   {      JBossDestination jbDest = (JBossDestination)dest;                 SecurityManager securityManager = conn.getServerPeer().getSecurityManager();            SecurityMetadata securityMetadata = securityManager.getSecurityMetadata(jbDest.getName());      if (securityMetadata == null)      {         throw new JMSSecurityException("No security configuration avaliable for " + jbDest.getName());               }      // Authenticate      securityManager.authenticate(conn.getUsername(), conn.getPassword());      // Authorize      Set principals = checkType == CheckType.READ ? securityMetadata.getReadPrincipals() :                       checkType == CheckType.WRITE ? securityMetadata.getWritePrincipals() :                       securityMetadata.getCreatePrincipals();                             if (!securityManager.authorize(conn.getUsername(), principals))      {         String msg = "User: " + conn.getUsername() +             " is not authorized to " +            (checkType == CheckType.READ ? "read from" :              checkType == CheckType.WRITE ? "write to" : "create durable sub on") +            " destination " + jbDest.getName();                      throw new JMSSecurityException(msg);                              }   }