Package javax.jms

Examples of javax.jms.JMSSecurityException


      SecurityMetadata securityMetadata = SecurityActions.getSecurityMetadata(sm, isQueue, name);

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

      // Authenticate. Need to save current SecurityContext
      SecurityContext previousSCtx = SecurityActions.getSecurityContext();
     
      final String username = conn.getUsername();
      final String password = conn.getPassword();

      SecurityActions.authenticate(sm, username, password);

      // Authorize
      final Set principals = checkType == CheckType.READ ? securityMetadata.getReadPrincipals() :
                       checkType == CheckType.WRITE ? securityMetadata.getWritePrincipals() :
                       securityMetadata.getCreatePrincipals();
      try
      {
        final CheckType tmpCheckType = checkType;
       
         if (!SecurityActions.authorize(sm, 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


/* 283 */     SecurityStore sm = conn.getSecurityManager();
/* 284 */     SecurityMetadata securityMetadata = sm.getSecurityMetadata(isQueue, name);
/*     */
/* 286 */     if (securityMetadata == null)
/*     */     {
/* 288 */       throw new JMSSecurityException("No security configuration avaliable for " + name);
/*     */     }
/*     */
/* 296 */     sm.authenticate(conn.getUsername(), conn.getPassword());
/*     */
/* 299 */     Set principals = checkType == CheckType.WRITE ? securityMetadata.getWritePrincipals() : checkType == CheckType.READ ? securityMetadata.getReadPrincipals() : securityMetadata.getCreatePrincipals();
/*     */     try
/*     */     {
/* 304 */       if (!sm.authorize(conn.getUsername(), principals, checkType))
/*     */       {
/* 306 */         String msg = "User: " + conn.getUsername() + " is not authorized to " + (checkType == CheckType.WRITE ? "write to" : checkType == CheckType.READ ? "read from" : "create durable sub on") + " destination " + name;
/*     */
/* 312 */         throw new JMSSecurityException(msg);
/*     */       }
/*     */
/*     */     }
/*     */     finally
/*     */     {
View Full Code Here

/*     */     {
/* 197 */       SecurityActions.pushSubjectContext(principal, passwordChars, subject);
/* 198 */       return subject;
/*     */     }
/*     */
/* 202 */     throw new JMSSecurityException("User " + user + " is NOT authenticated");
/*     */   }
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

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.