microsoft.exchange.webservices.data.credential
Class ExchangeCredentials

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

public abstract class ExchangeCredentials
extends Object

Base class of Exchange credential types.


Constructor Summary
ExchangeCredentials()
           
 
Method Summary
 URI adjustUrl(URI url)
          Adjusts the URL endpoint based on the credential.
 void emitExtraSoapHeaderNamespaceAliases(XMLStreamWriter writer)
          Emit any extra necessary namespace aliases for the SOAP:header block.
static ExchangeCredentials getExchangeCredentialsFromNetworkCredential(String userName, String password, String domain)
          Performs an implicit conversion from to .
protected static String getUriWithoutWSSecurity(URI url)
          Return the url without ws-security address.
 boolean isNeedSignature()
          Gets the flag indicating whether any sign action need taken.
 void preAuthenticate()
          This method is called to pre-authenticate credential before a service request is made.
 void prepareWebRequest(HttpWebRequest client)
          This method is called to apply credential to a service request before the request is made.
 void serializeExtraSoapHeaders(XMLStreamWriter writer, String webMethodName)
          Serialize any extra necessary SOAP headers.
 void serializeWSSecurityHeaders(XMLStreamWriter writer)
          Serialize SOAP headers used for authentication schemes that rely on WS-Security.
 void sign(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(String userName,
                                                                              String password,
                                                                              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 credential on an ExchangeService.

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

getUriWithoutWSSecurity

protected static String getUriWithoutWSSecurity(URI url)
Return the url without ws-security address.

Parameters:
url - The url
Returns:
The absolute uri base.

preAuthenticate

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


prepareWebRequest

public void prepareWebRequest(HttpWebRequest client)
                       throws URISyntaxException
This method is called to apply credential to a service request before the request is made.

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

emitExtraSoapHeaderNamespaceAliases

public void emitExtraSoapHeaderNamespaceAliases(XMLStreamWriter writer)
                                         throws XMLStreamException
Emit any extra necessary namespace aliases for the SOAP:header block.

Parameters:
writer - the writer
Throws:
XMLStreamException - the XML stream exception

serializeExtraSoapHeaders

public void serializeExtraSoapHeaders(XMLStreamWriter writer,
                                      String webMethodName)
                               throws 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:
XMLStreamException - the XML stream exception

adjustUrl

public URI adjustUrl(URI url)
              throws URISyntaxException
Adjusts the URL endpoint based on the credential.

Parameters:
url - The URL.
Returns:
Adjust URL.
Throws:
URISyntaxException

isNeedSignature

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


sign

public void sign(ByteArrayOutputStream memoryStream)
          throws Exception
Add the signature element to the memory stream.

Parameters:
memoryStream - The memory stream.
Throws:
Exception

serializeWSSecurityHeaders

public void serializeWSSecurityHeaders(XMLStreamWriter writer)
                                throws XMLStreamException
Serialize SOAP headers used for authentication schemes that rely on WS-Security.

Parameters:
writer - the writer
Throws:
XMLStreamException - the XML stream exception


Copyright © 2012–2015 Microsoft. All rights reserved.