|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.mqe.adapters.MQeCommunicationsAdapter | +--com.ibm.mqe.adapters.MQeTcpipAdapter | +--com.ibm.mqe.adapters.MQeWESAuthenticationAdapter
This adapter provides support for tunnelling HTTP requests through Websphere
Everyplace authentication proxies and transparent proxies. This is a communications
adapter that extends MQeTcpipHttpAdapter
and, as such,
can be used as a replacement for this - or any other - communications adapter.
The adapter provides theWebSphere MQ Everyplace application with the static method
setBasicAuthorization() in which the user can include user ID and password
strings. Once set, each subsequent write call causes the class to add an
authorization line to the HTTP header. This authorization line contains the user ID
and password information which the adapter encodes to Base64.
For example: Authorization:Basic QmFzZTY0OmlzTm90RW5jcnlwdGVk
If an HTTP header that is supplied to the adapter write already contains an authorization line, the existing line is used. Note that basic Web authorization requires that the user’s credentials are encoded in Base64 inside the HTTP header. Note that this is not an encrypted format, Base64 is a clear text encoding, the contents of which can be viewed by anyone that has access to the HTTP flows. If you wish to avoid sending Base64 information unencrypted over a network, you need to provide a security solution such asWebSphere MQ Everyplace message level security.
The MQeWESAuthenticationAdapter also intercepts adapter reads, checking for the following invalid responses from the server:
The text of all exceptions is the header line that contains the actual response type, for example "HTTP/1.1 500 Internal Server Error".
After a failure response, the adapter scans the returned response header for any realm information. This information can be obtained later by using the static getRealm() method on the MQeWESAuthenticationAdapter.
This class extends MQeTcpipAdapter
.
Field Summary |
Constructor Summary | |
MQeWESAuthenticationAdapter()
|
Method Summary | |
void |
activate(MQePropertyProvider info)
Initializes the adapter. |
static java.lang.String |
getDeviceName()
Returns the current originating device name. |
static java.lang.String |
getRealm()
Determines the realm information, based on the challenge supplied by the server. |
byte[] |
read()
Reads data coming from Websphere Everyplace. |
static void |
setBasicAuthorization(java.lang.String userid,
java.lang.String password)
The setBasicAuthorization method sets the userid and password that will be encoded in to Base64 and sent across the HTTP flow. |
static void |
setDeviceName(java.lang.String name)
Sets the name of the originating device, as used by the User-Agent field in the HTTP requests. |
void |
writeData(byte[] data)
Writes bytes to the HTTP stream. |
Methods inherited from class com.ibm.mqe.adapters.MQeTcpipAdapter |
close, open, readLength, readln, temporaryClose, waitForContact |
Methods inherited from class com.ibm.mqe.adapters.MQeCommunicationsAdapter |
createNewAdapter, isStopDemanded, isStopRequested, writeResponse |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MQeWESAuthenticationAdapter()
Method Detail |
public static void setBasicAuthorization(java.lang.String userid, java.lang.String password)
The setBasicAuthorization method sets the userid and password that will be encoded in to Base64 and sent across the HTTP flow.
public static void setDeviceName(java.lang.String name)
Sets the name of the originating device, as used by the User-Agent field in the HTTP requests.
name
- String representing the device name.
public static java.lang.String getDeviceName()
Returns the current originating device name.
public static java.lang.String getRealm()
Determines the realm information, based on the challenge supplied by the server.
public void activate(MQePropertyProvider info) throws java.lang.Exception
Initializes the adapter.
When the adapter is being used as a transparent proxy, it also sets up the adapter’s proxy settings.
Otherwise this method behaves like the MQeTcpipAdapter.
activate
in class MQeTcpipAdapter
java.lang.Exception
MQeCommunicationsAdapter.COMMS_ADAPTER_ADDRESS
,
MQeCommunicationsAdapter.COMMS_ADAPTER_PORT
,
MQeCommunicationsAdapter.COMMS_ADAPTER_LISTEN
,
MQeCommunicationsAdapter.COMMS_ADAPTER_TIMEOUT
,
MQeCommunicationsAdapter.COMMS_ADAPTER_PKTSIZE
,
MQeCommunicationsAdapter.COMMS_ADAPTER_RETRIES
,
com.ibm.mqe.adapters.MQeCommunicationsAdapter#COMMS_ADAPTER_THREAD_STOP_CHECK
public byte[] read() throws java.lang.Exception
Reads data coming from Websphere Everyplace.
The authentication server will only ever send a standard HTTP response, so we can use the superclass to do the reading for us. However, this method interprets any failure response codes and converts them into an appropriate MQeException.
read
in class MQeCommunicationsAdapter
MQeException
- java.lang.Exception
public void writeData(byte[] data) throws java.lang.Exception
Writes bytes to the HTTP stream.
Adds the WWW-Authenticate line to the user data before passing it on to the underlying HTTP adapter.
writeData
in class MQeCommunicationsAdapter
data
- byte[] The data to be written.
java.lang.Exception
|
Websphere MQ Everyplace | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |