ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » set userid in MQClient connecting to os/390

Post new topic  Reply to topic
 set userid in MQClient connecting to os/390 « View previous topic :: View next topic » 
Author Message
jigjim
PostPosted: Thu Sep 23, 2004 7:30 am    Post subject: set userid in MQClient connecting to os/390 Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Hi,

I am using MQ Client running in WebSphere to connect to MQ queues on OS/390.

I am having some security problems and would like to know at what places I can set the user id.

For the msg I can set the user id
Code:
msg.userId = "abcdefgh";
but that didnt work.

There is mgr.alternateUserId but i dont know how to use that.

Can somebody pls tell me where I might be getting security violations and where the places I should try to set the userId. I have the Id with me but I just dont knwo how to set it using MQClient on WebSphere.

Thanks

Jigs
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Sep 23, 2004 8:17 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Are you using JMS? Are you storing QCFS in JNDI?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jigjim
PostPosted: Thu Sep 23, 2004 9:23 am    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

No,

I am using MA88 files. Here is a snapshot of the code.

Code:
MQEnvironment.disableTracing ();
MQException.log = null;
MQEnvironment.hostname = sys;
String channel = "SYSTEM.DEF.SVRCONN";
MQEnvironment.channel  = channel;
MQEnvironment.port     = Integer.parseInt (port);
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);      

try   {      
mgr = new MQQueueManager(sys);
int openOptions = MQC.MQOO_OUTPUT;
q = mgr.accessQueue(sendQ,openOptions,null,null,null);
msg = new MQMessage();
msg.format = MQC.MQFMT_IMS_VAR_STRING;
String id = String.valueOf(Math.random());
msg.messageId = id.getBytes();
msg.replyToQueueName = replyQ;

MQPutMessageOptions pmo = new MQPutMessageOptions();
String data = "CMDMASK DIS A";
short LL = (short)(data.length() + 4);
short ZZ =0;
   
msg.writeShort(LL);
msg.writeShort(ZZ);
msg.writeString(data);
   
q.put(msg, pmo);
q.close();
         
openOptions = MQC.MQOO_INPUT_AS_Q_DEF;

q = mgr.accessQueue(replyQ, openOptions, null, null, null);

MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_FAIL_IF_QUIESCING;
gmo.waitInterval = 1000;
qmsg = new MQMessage();
qmsg.correlationId = id.getBytes();

q.get(qmsg, gmo);
retMsg = qmsg.readString(qmsg.getMessageLength());
mgr.disconnect();
}
catch(MQException e) {
}
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Sep 23, 2004 9:38 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

jigjim wrote:
I am using MA88 files.


Don't.

They're out of date. Download the free 5.3 client and use the java libraries from there.

As to the other, I don't think you can set this on an individual level this way. WAS can't run a generic piece of code as a separate user, and the plain Java MQ apis can't set the user either.

You can, of course, change the user that WAS is running as.

But you're much better off setting up either a security exit pair, which you can use from Java, or configuring SSL and creating a channel for this client connection on your z/os machine that has an MCAUser set.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jigjim
PostPosted: Thu Sep 23, 2004 10:27 am    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Thanks for the information.
I will upgrade to 5.3 ASAP.

As per your other suggestion, I have a specific channel setup for the client connection. Can you please provide more details on what MACUSer is and how to set it ?

The objective of my code is to make sure that user ids dont fail wehn we switch from test to prod. For that reason i am trying to create a "2035" scenario with sample messages.

Is that possible ?

Thanks

Jigs
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Thu Sep 23, 2004 2:26 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Hi,

The UserID field of the MQMD is part of the 'Identity Context' information. Therefore, to set it you need to set the OpenOptions and PMO of either SET_ALL_CONTEXT or SET_IDENTITY_CONTEXT on both calls.

Or if you don't want to be flipping back and forth between UserIDs then just set the MQEnvironment.userID field in the same place as the other MQEnvironment fields. i.e.
Code:
MQEnvironment.userID = "abcdefgh";

Regards,
Roger Lacroix
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » set userid in MQClient connecting to os/390
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.