Strange problem with authentication on IBMMQ, it takes the running user ID

本秂侑毒 提交于 2019-12-04 05:18:17

问题


I've got a strange problem when I perform a push of a message in a queue. I've configured my application to read userid/password from app.config. when the message is put on the queue I got the username of the user that has run the application and it's the one of the .config file.

The code I use to create the MQQueueManager is

  private static readonly Lazy<MQQueueManager> lazy =
        new Lazy<MQQueueManager>(() =>
        {
            var properties = new Hashtable();

            var container = ContainerWrapper.Container;

            IConfiguration configuration = container.GetInstance<IConfiguration>();

            properties.Add(MQC.HOST_NAME_PROPERTY, configuration.GetValue<string>("HOST_NAME_PROPERTY"));
            properties.Add(MQC.PORT_PROPERTY, configuration.GetValue<int>("PORT_PROPERTY"));
            properties.Add(MQC.USER_ID_PROPERTY, configuration.GetValue<string>("USER_ID_PROPERTY"));
            properties.Add(MQC.PASSWORD_PROPERTY, configuration.GetValue<string>("PASSWORD_PROPERTY"));
            properties.Add(MQC.CHANNEL_PROPERTY, configuration.GetValue<string>("CHANNEL_PROPERTY"));


            MQQueueManager queueManager = new MQQueueManager(configuration.GetValue<string>("QUEUE_MANAGER_NAME"), properties);


            return queueManager;
        });

Am I missing something? Thanks in advance


回答1:


In order for your connection to run as the user ID and password provided on the connect, you must configure the queue manager to check the user ID and password and also you must configure the queue manager to adopt the validated user ID.

DISPLAY QMGR CONNAUTH

The value in the CONNAUTH field is the name of an AUTHINFO object. If it is blank, user ID and password checking is not enabled. Set it to an appropriate object name.

ALTER QMGR CONNAUTH(SYSTEM.DEFAULT.AUTHINFO.IDPWOS)

Now look at the attributes of it.

DISPLAY AUTHINFO(name-from-connauth) ALL

If ADOPTCTK is set to NO, the the user ID will not be adopted as the connection's user ID, and so will not be seen in the message context.

ALTER AUTHINFO(name-from-connauth) AUTHTYPE(IDPWOS) ADOPTCTX(YES)

If you had to make any alterations, you must now issue this command.

REFRESH SECURITY TYPE(CONNAUTH)



回答2:


You probably need to add another line to your properties.

Try (from memory so you will need to find the correct constant) USE_MQCSP_USERNAME_PASSWORD This should be a boolean and should be set to yes....

Add this to your properties, then create the queue manager with those properties.



来源:https://stackoverflow.com/questions/52924929/strange-problem-with-authentication-on-ibmmq-it-takes-the-running-user-id

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!