Package javax.jms

Examples of javax.jms.JMSSecurityException


                }
            });
       }
       catch( PrivilegedActionException pae )
       {
         throw new JMSSecurityException(pae.toString());
       }
   }
View Full Code Here


                   }
                });
       }
       catch( PrivilegedActionException pae )
       {
         throw new JMSSecurityException(pae.toString());
       }
   }
View Full Code Here

         case HornetQException.QUEUE_EXISTS:
            je = new InvalidDestinationException(me.getMessage());
            break;

         case HornetQException.SECURITY_EXCEPTION:
            je = new JMSSecurityException(me.getMessage());
            break;

         case HornetQException.UNSUPPORTED_PACKET:
            je = new javax.jms.IllegalStateException(me.getMessage());
            break;
View Full Code Here

         case QUEUE_EXISTS:
            je = new InvalidDestinationException(me.getMessage());
            break;

         case SECURITY_EXCEPTION:
            je = new JMSSecurityException(me.getMessage());
            break;

         case UNSUPPORTED_PACKET:
            je = new javax.jms.IllegalStateException(me.getMessage());
            break;
View Full Code Here

         case QUEUE_EXISTS:
            je = new InvalidDestinationException(me.getMessage());
            break;

         case SECURITY_EXCEPTION:
            je = new JMSSecurityException(me.getMessage());
            break;

         case UNSUPPORTED_PACKET:
            je = new javax.jms.IllegalStateException(me.getMessage());
            break;
View Full Code Here

      SecurityStore sm = conn.getSecurityManager();
      SecurityMetadata securityMetadata = sm.getSecurityMetadata(isQueue, name);

      if (securityMetadata == null)
      {
         throw new JMSSecurityException("No security configuration avaliable for " + name);
      }

      // Authenticate. Need to save current SecurityContext
      SecurityContext previousSCtx = SecurityActions.getSecurityContext();
     
      sm.authenticate(conn.getUsername(), conn.getPassword());

      // Authorize
      Set principals = checkType == CheckType.READ ? securityMetadata.getReadPrincipals() :
                       checkType == CheckType.WRITE ? securityMetadata.getWritePrincipals() :
                       securityMetadata.getCreatePrincipals();
      try
      {
         if (!sm.authorize(conn.getUsername(), principals, checkType))
         {
            String msg = "User: " + conn.getUsername() +
               " is not authorized to " +
               (checkType == CheckType.READ ? "read from" :
                  checkType == CheckType.WRITE ? "write to" : "create durable sub on") +
               " destination " + name;

            throw new JMSSecurityException(msg);
         }
      }
      finally
      {
         // Restore previous SecurityContext
View Full Code Here

      SecurityStore sm = conn.getSecurityManager();
      SecurityMetadata securityMetadata = sm.getSecurityMetadata(isQueue, name);

      if (securityMetadata == null)
      {
         throw new JMSSecurityException("No security configuration avaliable for " + name);
      }

      // Authenticate. Successful autentication will place a new SubjectContext on thread local,
      // which will be used in the authorization process. However, we need to make sure we clean up
      // thread local immediately after we used the information, otherwise some other people
      // security my be screwed up, on account of thread local security stack being corrupted.
     
      sm.authenticate(conn.getUsername(), conn.getPassword());

      // Authorize
      Set principals = checkType == CheckType.READ ? securityMetadata.getReadPrincipals() :
                       checkType == CheckType.WRITE ? securityMetadata.getWritePrincipals() :
                       securityMetadata.getCreatePrincipals();
      try
      {
         if (!sm.authorize(conn.getUsername(), principals, checkType))
         {
            String msg = "User: " + conn.getUsername() +
               " is not authorized to " +
               (checkType == CheckType.READ ? "read from" :
                  checkType == CheckType.WRITE ? "write to" : "create durable sub on") +
               " destination " + name;

            throw new JMSSecurityException(msg);
         }
      }
      finally
      {
         // pop the Messaging SecurityContext, it did its job
View Full Code Here

         {
            SecurityActions.setSecurityContext(principal, passwordChars, subject, this.getSecurityDomain());
         }
         catch (Exception e)
         {
            throw new JMSSecurityException("Failed to set SecurityContext");
         }
         return subject;
      }
      else
      {
         throw new JMSSecurityException("User " + user + " is NOT authenticated");
      }
   }
View Full Code Here

        if (msg == null || msg.length() == 0) {
            msg = cause.toString();
        }
        JMSException exception;
        if (cause instanceof SecurityException) {
            exception = new JMSSecurityException(msg);
        } else {
            exception = new JMSException(msg);
        }
        exception.initCause(cause);
        return exception;
View Full Code Here

        if (msg == null || msg.length() == 0) {
            msg = cause.toString();
        }
        JMSException exception;
        if (cause instanceof SecurityException) {
            exception = new JMSSecurityException(msg);
        } else {
            exception = new JMSException(msg);
        }
        exception.setLinkedException(cause);
        exception.initCause(cause);
View Full Code Here

TOP

Related Classes of javax.jms.JMSSecurityException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.