Class ExchangeCredentials
- java.lang.Object
-
- 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
Constructors Constructor Description ExchangeCredentials()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description URIadjustUrl(URI url)Adjusts the URL endpoint based on the credential.voidemitExtraSoapHeaderNamespaceAliases(XMLStreamWriter writer)Emit any extra necessary namespace aliases for the SOAP:header block.static ExchangeCredentialsgetExchangeCredentialsFromNetworkCredential(String userName, String password, String domain)Performs an implicit conversion toExchangeCredentials.protected static StringgetUriWithoutWSSecurity(URI url)Return the url without ws-security address.booleanisNeedSignature()Gets the flag indicating whether any sign action need taken.voidpreAuthenticate()This method is called to pre-authenticate credential before a service request is made.voidprepareWebRequest(HttpWebRequest client)This method is called to apply credential to a service request before the request is made.voidserializeExtraSoapHeaders(XMLStreamWriter writer, String webMethodName)Serialize any extra necessary SOAP headers.voidserializeWSSecurityHeaders(XMLStreamWriter writer)Serialize SOAP headers used for authentication schemes that rely on WS-Security.voidsign(ByteArrayOutputStream memoryStream)Add the signature element to the memory stream.
-
-
-
Constructor Detail
-
ExchangeCredentials
public ExchangeCredentials()
-
-
Method Detail
-
getExchangeCredentialsFromNetworkCredential
public static ExchangeCredentials getExchangeCredentialsFromNetworkCredential(String userName, String password, String domain)
Performs an implicit conversion toExchangeCredentials. 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 writerwebMethodName- 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
-
-