microsoft.exchange.webservices.data
Class ExchangeCredentials

java.lang.Object
  extended by microsoft.exchange.webservices.data.ExchangeCredentials
Direct Known Subclasses:
ClientCertificateCredentials, WebCredentials, WSSecurityBasedCredentials

public abstract class ExchangeCredentials
extends java.lang.Object

Base class of Exchange credential types.


Constructor Summary
ExchangeCredentials()
           
 
Method Summary
protected  java.net.URI adjustUrl(java.net.URI url)
          Adjusts the URL endpoint based on the credentials.
protected  void emitExtraSoapHeaderNamespaceAliases(javax.xml.stream.XMLStreamWriter writer)
          * Emit any extra necessary namespace aliases for the SOAP:header block.
static ExchangeCredentials getExchangeCredentialsFromNetworkCredential(java.lang.String userName, java.lang.String password, java.lang.String domain)
          Performs an implicit conversion from to .
protected static java.lang.String getUriWithoutWSSecurity(java.net.URI url)
          Return the url without wssecruity address.
protected  boolean isNeedSignature()
          Gets the flag indicating whether any sign action need taken.
protected  void preAuthenticate()
          This method is called to pre-authenticate credentials before a service request is made.
protected  void prepareWebRequest(microsoft.exchange.webservices.data.HttpWebRequest client)
          * This method is called to apply credentials to a service request before the request is made.
protected  void serializeExtraSoapHeaders(javax.xml.stream.XMLStreamWriter writer, java.lang.String webMethodName)
          * Serialize any extra necessary SOAP headers.
protected  void serializeWSSecurityHeaders(javax.xml.stream.XMLStreamWriter writer)
          * Serialize SOAP headers used for authentication schemes that rely on WS-Security.
protected  void sign(java.io.ByteArrayOutputStream memoryStream)
          Add the signature element to the memory stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExchangeCredentials

public ExchangeCredentials()
Method Detail

getExchangeCredentialsFromNetworkCredential

public static ExchangeCredentials getExchangeCredentialsFromNetworkCredential(java.lang.String userName,
                                                                              java.lang.String password,
                                                                              java.lang.String domain)
Performs an implicit conversion from to . This allows a NetworkCredential object to be implictly converted to an ExchangeCredential which is useful when setting credentials on an ExchangeService.

Parameters:
userName - Account user name.
password - Account password.
domain - Account domain.
Returns:
The result of the conversion.

getUriWithoutWSSecurity

protected static java.lang.String getUriWithoutWSSecurity(java.net.URI url)
Return the url without wssecruity address.

Parameters:
url - The url

preAuthenticate

protected void preAuthenticate()
This method is called to pre-authenticate credentials before a service request is made.


prepareWebRequest

protected void prepareWebRequest(microsoft.exchange.webservices.data.HttpWebRequest client)
                          throws java.net.URISyntaxException
* This method is called to apply credentials to a service request before the request is made.

Parameters:
client - The request.
Throws:
java.net.URISyntaxException - the uRI syntax exception

emitExtraSoapHeaderNamespaceAliases

protected void emitExtraSoapHeaderNamespaceAliases(javax.xml.stream.XMLStreamWriter writer)
                                            throws javax.xml.stream.XMLStreamException
* Emit any extra necessary namespace aliases for the SOAP:header block.

Parameters:
writer - The writer.
Throws:
javax.xml.stream.XMLStreamException - the xML stream exception

serializeExtraSoapHeaders

protected void serializeExtraSoapHeaders(javax.xml.stream.XMLStreamWriter writer,
                                         java.lang.String webMethodName)
                                  throws javax.xml.stream.XMLStreamException
* Serialize any extra necessary SOAP headers. This is used for authentication schemes that rely on WS-Security, or for endpoints requiring WS-Addressing.

Parameters:
writer - The writer.
webMethodName - The Web method being called.
Throws:
javax.xml.stream.XMLStreamException - the xML stream exception

adjustUrl

protected java.net.URI adjustUrl(java.net.URI url)
                          throws java.net.URISyntaxException
Adjusts the URL endpoint based on the credentials.

Parameters:
url - The URL.
Throws:
java.net.URISyntaxException

isNeedSignature

protected boolean isNeedSignature()
Gets the flag indicating whether any sign action need taken.


sign

protected void sign(java.io.ByteArrayOutputStream memoryStream)
             throws java.lang.Exception
Add the signature element to the memory stream.

Parameters:
memoryStream - The memory stream.
Throws:
java.lang.Exception

serializeWSSecurityHeaders

protected void serializeWSSecurityHeaders(javax.xml.stream.XMLStreamWriter writer)
                                   throws javax.xml.stream.XMLStreamException
* Serialize SOAP headers used for authentication schemes that rely on WS-Security.

Parameters:
writer - The writer.
Throws:
javax.xml.stream.XMLStreamException - the xML stream exception