@Override
    public boolean checkTopicAccess(Subject authenticatedSubject, String topicSpace, String topicName, String operationType) throws MessagingAuthorizationException {
        String busName = null;
        String messagingEngine = null;
        String[] roles = null;
        String resource = null;
        
        if (auditManager != null) {
            if (auditManager.getJMSBusName() != null)
                busName = auditManager.getJMSBusName();
            if (auditManager.getJMSMessagingEngine() != null)
                messagingEngine = auditManager.getJMSMessagingEngine();
        }

        String destinationName = topicSpace;
        resource = "topicSpace";
        if (topicName != null) {
            destinationName = topicSpace + MessagingSecurityConstants.TOPIC_DELIMITER + topicName;
            resource = "topic";
        }
        
        SibTr.entry(tc, CLASS_NAME + "checkTopicAccess", new Object[] { authenticatedSubject, destinationName, operationType });
        checkIfUserIsAuthenticated(authenticatedSubject);
        String userName = null;
        String user = authenticatedSubject.getPrincipals().iterator().next().getName();
        
        Map<String, TopicPermission> mq = messagingSecurityService.getTopicPermissions();
        roles = messagingSecurityService.getDestinationRoles(mq, destinationName, user);
        SibTr.debug(tc, "checkTopicAccess, roles: " + Arrays.toString(roles));
        
        try {
            userName = MessagingSecurityUtility.getUniqueUserName(authenticatedSubject);
        } catch (MessagingSecurityException e) {
            if (auditManager != null && auditManager.getJMSConversationMetaData() != null) {
                ConversationMetaData cmd = (ConversationMetaData) auditManager.getJMSConversationMetaData();

                Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01, user, cmd.getRemoteAddress().getHostAddress(), new Integer(cmd.getRemotePort()).toString(),
                            cmd.getChainName(), busName, messagingEngine, destinationName, operationType, roles, resource,
                            Integer.valueOf("201"));
            } else {
                Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01, user, null, null, null, busName, messagingEngine, destinationName, operationType, 
                            roles, resource, Integer.valueOf("201"));
            }

            throw new MessagingAuthorizationException(Tr.formatMessage(tc, "USER_NOT_AUTHORIZED_MSE1010", userName, operationType, destinationName), e);
        }
        Map<String, TopicPermission> topicPermissions = messagingSecurityService.getTopicPermissions();
        TopicPermission permission = getTopicPermission(topicPermissions, destinationName);
        boolean result = checkPermission(permission, operationType, userName);
        if (!result) {
            if (auditManager != null && auditManager.getJMSConversationMetaData() != null) {
                ConversationMetaData cmd = (ConversationMetaData) auditManager.getJMSConversationMetaData();

                Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01, user, cmd.getRemoteAddress().getHostAddress(), new Integer(cmd.getRemotePort()).toString(),
                            cmd.getChainName(), busName, messagingEngine, destinationName, operationType, roles, resource,
                            Integer.valueOf("201"));
            } else {
                Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01, user, null, null, null, busName, messagingEngine, destinationName, operationType, 
                            roles, resource, Integer.valueOf("201"));
            }

            SibTr.debug(tc, "USER_NOT_AUTHORIZED_MSE1010",
                        new Object[] { userName, operationType, destinationName });
            throw new MessagingAuthorizationException(Tr.formatMessage(tc, "USER_NOT_AUTHORIZED_MSE1010", userName, operationType, destinationName));
        } else {
            if (auditManager != null && auditManager.getJMSConversationMetaData() != null) {
                ConversationMetaData cmd = (ConversationMetaData) auditManager.getJMSConversationMetaData();

                Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01, user, cmd.getRemoteAddress().getHostAddress(), new Integer(cmd.getRemotePort()).toString(),
                            cmd.getChainName(), busName, messagingEngine, destinationName, operationType, roles, resource,
                            Integer.valueOf("200"));
            } else {
                Audit.audit(Audit.EventID.SECURITY_JMS_AUTHZ_01, user, null, null, null, busName, messagingEngine, destinationName, operationType, 
                            roles, resource, Integer.valueOf("200"));
            }
        }

        SibTr.exit(tc, CLASS_NAME + "checkTopicAccess", result);
        return result;
    }
@ Override public boolean checkTopicAccess ( Subject authenticatedSubject , String topicSpace , String topicName , String operationType ) throws MessagingAuthorizationException { String busName = null ; String messagingEngine = null ; String [ ] roles = null ; String resource = null ; if ( auditManager != null ) { if ( auditManager . getJMSBusName ( ) != null ) busName = auditManager . getJMSBusName ( ) ; if ( auditManager . getJMSMessagingEngine ( ) != null ) messagingEngine = auditManager . getJMSMessagingEngine ( ) ; } String destinationName = topicSpace ; resource = "topicSpace" ; if ( topicName != null ) { destinationName = topicSpace + MessagingSecurityConstants . TOPIC_DELIMITER + topicName ; resource = "topic" ; } SibTr . entry ( tc , CLASS_NAME + "checkTopicAccess" , new Object [ ] { authenticatedSubject , destinationName , operationType } ) ; checkIfUserIsAuthenticated ( authenticatedSubject ) ; String userName = null ; String user = authenticatedSubject . getPrincipals ( ) . iterator ( ) . next ( ) . getName ( ) ; Map < String , TopicPermission > mq = messagingSecurityService . getTopicPermissions ( ) ; roles = messagingSecurityService . getDestinationRoles ( mq , destinationName , user ) ; SibTr . debug ( tc , "checkTopicAccess, roles: " + Arrays . toString ( roles ) ) ; try { userName = MessagingSecurityUtility . getUniqueUserName ( authenticatedSubject ) ; } catch ( MessagingSecurityException e ) { if ( auditManager != null && auditManager . getJMSConversationMetaData ( ) != null ) { ConversationMetaData cmd = ( ConversationMetaData ) auditManager . getJMSConversationMetaData ( ) ; Audit . audit ( Audit . EventID . SECURITY_JMS_AUTHZ_01 , user , cmd . getRemoteAddress ( ) . getHostAddress ( ) , new Integer ( cmd . getRemotePort ( ) ) . toString ( ) , cmd . getChainName ( ) , busName , messagingEngine , destinationName , operationType , roles , resource , Integer . valueOf ( "201" ) ) ; } else { Audit . audit ( Audit . EventID . SECURITY_JMS_AUTHZ_01 , user , null , null , null , busName , messagingEngine , destinationName , operationType , roles , resource , Integer . valueOf ( "201" ) ) ; } throw new MessagingAuthorizationException ( Tr . formatMessage ( tc , "USER_NOT_AUTHORIZED_MSE1010" , userName , operationType , destinationName ) , e ) ; } Map < String , TopicPermission > topicPermissions = messagingSecurityService . getTopicPermissions ( ) ; TopicPermission permission = getTopicPermission ( topicPermissions , destinationName ) ; boolean result = checkPermission ( permission , operationType , userName ) ; if ( ! result ) { if ( auditManager != null && auditManager . getJMSConversationMetaData ( ) != null ) { ConversationMetaData cmd = ( ConversationMetaData ) auditManager . getJMSConversationMetaData ( ) ; Audit . audit ( Audit . EventID . SECURITY_JMS_AUTHZ_01 , user , cmd . getRemoteAddress ( ) . getHostAddress ( ) , new Integer ( cmd . getRemotePort ( ) ) . toString ( ) , cmd . getChainName ( ) , busName , messagingEngine , destinationName , operationType , roles , resource , Integer . valueOf ( "201" ) ) ; } else { Audit . audit ( Audit . EventID . SECURITY_JMS_AUTHZ_01 , user , null , null , null , busName , messagingEngine , destinationName , operationType , roles , resource , Integer . valueOf ( "201" ) ) ; } SibTr . debug ( tc , "USER_NOT_AUTHORIZED_MSE1010" , new Object [ ] { userName , operationType , destinationName } ) ; throw new MessagingAuthorizationException ( Tr . formatMessage ( tc , "USER_NOT_AUTHORIZED_MSE1010" , userName , operationType , destinationName ) ) ; } else { if ( auditManager != null && auditManager . getJMSConversationMetaData ( ) != null ) { ConversationMetaData cmd = ( ConversationMetaData ) auditManager . getJMSConversationMetaData ( ) ; Audit . audit ( Audit . EventID . SECURITY_JMS_AUTHZ_01 , user , cmd . getRemoteAddress ( ) . getHostAddress ( ) , new Integer ( cmd . getRemotePort ( ) ) . toString ( ) , cmd . getChainName ( ) , busName , messagingEngine , destinationName , operationType , roles , resource , Integer . valueOf ( "200" ) ) ; } else { Audit . audit ( Audit . EventID . SECURITY_JMS_AUTHZ_01 , user , null , null , null , busName , messagingEngine , destinationName , operationType , roles , resource , Integer . valueOf ( "200" ) ) ; } } SibTr . exit ( tc , CLASS_NAME + "checkTopicAccess" , result ) ; return result ; }
/*
(non-Javadoc)

@see com.ibm.ws.messaging.security.authorization.MessagingAuthorizationService#checkTopicAccess(javax.security.auth.Subject, java.lang.String, java.lang.String,
java.lang.String)