你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

IotHubAuthenticationProvider Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.device.auth.IotHubAuthenticationProvider

public abstract class IotHubAuthenticationProvider

Base class for providing authentication for a Device Client or Module Client, including x509 and SAS based authentication.

Field Summary

Modifier and Type Field and Description
protected java.lang.String deviceId
protected java.lang.String gatewayHostname
protected java.lang.String hostname
protected IotHubSSLContext iotHubSSLContext
protected java.lang.String iotHubTrustedCert
protected java.lang.String moduleId
protected java.lang.String pathToIotHubTrustedCert
protected boolean sslContextNeedsUpdate

Constructor Summary

Constructor Description
IotHubAuthenticationProvider(String hostname, String gatewayHostname, String deviceId, String moduleId)
IotHubAuthenticationProvider(String hostname, String gatewayHostname, String deviceId, String moduleId, SSLContext sslContext)

Method Summary

Modifier and Type Method and Description
java.lang.String getDeviceId()

Get the deviceId

java.lang.String getGatewayHostname()

Get the gatewayHostname

java.lang.String getHostname()

Get the hostname

java.lang.String getIotHubTrustedCert()
java.lang.String getModuleId()

Get the module id

java.lang.String getPathToIotHubTrustedCert()
javax.net.ssl.SSLContext getSSLContext()
void setIotHubTrustedCert(String certificate)

Setter for the user trusted certificate

void setPathToIotHubTrustedCert(String pathToCertificate)

Setter for the providing trusted certificate.

void setSSLContext(SSLContext sslContext)

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Field Details

deviceId

protected String deviceId

gatewayHostname

protected String gatewayHostname

hostname

protected String hostname

iotHubSSLContext

protected IotHubSSLContext iotHubSSLContext

iotHubTrustedCert

protected String iotHubTrustedCert

moduleId

protected String moduleId

pathToIotHubTrustedCert

protected String pathToIotHubTrustedCert

sslContextNeedsUpdate

protected boolean sslContextNeedsUpdate

Constructor Details

IotHubAuthenticationProvider

public IotHubAuthenticationProvider(String hostname, String gatewayHostname, String deviceId, String moduleId)

Parameters:

hostname
gatewayHostname
deviceId
moduleId

IotHubAuthenticationProvider

public IotHubAuthenticationProvider(String hostname, String gatewayHostname, String deviceId, String moduleId, SSLContext sslContext)

Parameters:

hostname
gatewayHostname
deviceId
moduleId
sslContext

Method Details

getDeviceId

public String getDeviceId()

Get the deviceId

Returns:

the saved deviceId

getGatewayHostname

public String getGatewayHostname()

Get the gatewayHostname

Returns:

the saved gatewayHostname

getHostname

public String getHostname()

Get the hostname

Returns:

the saved hostname

getIotHubTrustedCert

public String getIotHubTrustedCert()

getModuleId

public String getModuleId()

Get the module id

Returns:

the saved module id

getPathToIotHubTrustedCert

public String getPathToIotHubTrustedCert()

getSSLContext

public SSLContext getSSLContext()

Throws:

java.io.IOException

setIotHubTrustedCert

public void setIotHubTrustedCert(String certificate)

Setter for the user trusted certificate

Parameters:

certificate - valid user trusted certificate string

setPathToIotHubTrustedCert

public void setPathToIotHubTrustedCert(String pathToCertificate)

Setter for the providing trusted certificate.

Parameters:

pathToCertificate - path to the certificate for one way authentication.

setSSLContext

public void setSSLContext(SSLContext sslContext)

Parameters:

sslContext

Applies to