日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSAuthenticator

Authenticator

專注于為中小企業(yè)提供網(wǎng)站設(shè)計(jì)、成都網(wǎng)站設(shè)計(jì)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)漢陰免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了上千多家企業(yè)的穩(wěn)健成長(zhǎng),幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

java.lang.Object

|---java.net.Authenticator

public abstract class Authenticator
extends Object

Authenticator 類表示一個(gè)知道如何獲得網(wǎng)絡(luò)連接身份驗(yàn)證的對(duì)象。 通常,它會(huì)通過提示用戶輸入信息來(lái)做到這一點(diǎn)。

應(yīng)用程序通過覆蓋子類中的 getPasswordAuthentication() 來(lái)使用此類。 此方法通常會(huì)使用各種 getXXX() 訪問器方法來(lái)獲取有關(guān)請(qǐng)求身份驗(yàn)證的實(shí)體的信息。 然后,它必須通過與用戶交互或通過其他一些非交互方式來(lái)獲取用戶名和密碼。 然后將憑據(jù)作為 PasswordAuthentication 返回值返回。

然后通過調(diào)用 setDefault(java.net.Authenticator) 向系統(tǒng)注冊(cè)這個(gè)具體子類的實(shí)例。 當(dāng)需要身份驗(yàn)證時(shí),系統(tǒng)將調(diào)用其中一個(gè) requestPasswordAuthentication() 方法,該方法又將調(diào)用注冊(cè)對(duì)象的 getPasswordAuthentication() 方法。

所有請(qǐng)求身份驗(yàn)證的方法都有一個(gè)失敗的默認(rèn)實(shí)現(xiàn)。

嵌套類摘要

修飾符和類型 描述
static class Authenticator.RequestorType 請(qǐng)求身份驗(yàn)證的實(shí)體的類型。

構(gòu)造函數(shù)摘要

構(gòu)造函數(shù) 描述
Authenticator()

方法總結(jié)

修飾符和類型 方法 描述
protected PasswordAuthentication getPasswordAuthentication() 需要密碼授權(quán)時(shí)調(diào)用。
protected String getRequestingHost() 獲取請(qǐng)求身份驗(yàn)證的站點(diǎn)或代理的主機(jī)名,如果不可用,則為 null。
protected int getRequestingPort() 獲取所請(qǐng)求連接的端口號(hào)。
protected String getRequestingPrompt() 獲取請(qǐng)求者給出的提示字符串。
protected String getRequestingProtocol() 給出請(qǐng)求連接的協(xié)議。
protected String getRequestingScheme() 獲取請(qǐng)求者的方案(例如 HTTP 防火墻的 HTTP 方案)。
protected InetAddress getRequestingSite() 獲取請(qǐng)求授權(quán)的站點(diǎn)的 InetAddress,如果不可用,則為 null。
protected URL getRequestingURL() 返回導(dǎo)致此身份驗(yàn)證請(qǐng)求的 URL。
protected Authenticator.RequestorType getRequestorType() 返回請(qǐng)求者是代理還是服務(wù)器。
static PasswordAuthentication requestPasswordAuthentication(String host, InetAddress addr, int port, String protocol, String prompt, String scheme) 向已在系統(tǒng)中注冊(cè)的身份驗(yàn)證器詢問密碼。
static PasswordAuthentication requestPasswordAuthentication(String host, InetAddress addr, int port, String protocol, String prompt, String scheme, URL url, Authenticator.RequestorType reqType) 向已在系統(tǒng)中注冊(cè)的身份驗(yàn)證器詢問密碼。
static PasswordAuthentication requestPasswordAuthentication(InetAddress addr, int port, String protocol, String prompt, String scheme) 向已在系統(tǒng)中注冊(cè)的身份驗(yàn)證器詢問密碼。
static void setDefault(Authenticator a) 設(shè)置當(dāng)代理或 HTTP 服務(wù)器請(qǐng)求身份驗(yàn)證時(shí)網(wǎng)絡(luò)代碼將使用的身份驗(yàn)證器。
從類 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

構(gòu)造函數(shù)詳細(xì)信息

Authenticator

public Authenticator()

方法詳情

setDefault

public static void setDefault(Authenticator a)

設(shè)置當(dāng)代理或 HTTP 服務(wù)器請(qǐng)求身份驗(yàn)證時(shí)網(wǎng)絡(luò)代碼將使用的身份驗(yàn)證器。

首先,如果有安全管理器,則使用 NetPermission("setDefaultAuthenticator") 權(quán)限調(diào)用其 checkPermission 方法。 這可能會(huì)導(dǎo)致 java.lang.SecurityException。

參數(shù):

參數(shù)名稱 參數(shù)描述
a 要設(shè)置的身份驗(yàn)證器。 如果 a 為 null,則刪除任何先前設(shè)置的身份驗(yàn)證器。

Throws:

Throw名稱 Throw描述
SecurityException 如果存在安全管理器并且其 checkPermission 方法不允許設(shè)置默認(rèn)身份驗(yàn)證器。

requestPasswordAuthentication

public static PasswordAuthentication requestPasswordAuthentication(InetAddress addr, int port, String protocol, String prompt, String scheme)

向已在系統(tǒng)中注冊(cè)的身份驗(yàn)證器詢問密碼。

首先,如果存在安全管理器,則使用 NetPermission("requestPasswordAuthentication") 權(quán)限調(diào)用其 checkPermission 方法。 這可能會(huì)導(dǎo)致 java.lang.SecurityException。

參數(shù):

參數(shù)名稱 參數(shù)描述
addr 請(qǐng)求授權(quán)的站點(diǎn)的 InetAddress,如果未知,則為 null。
port 請(qǐng)求連接的端口
protocol 請(qǐng)求連接的協(xié)議 (getRequestingProtocol())
prompt 用戶的提示字符串
scheme 認(rèn)證方案

返回:

用戶名/密碼,如果無(wú)法獲取,則返回 null。

Throws:

Throw名稱 Throw描述
SecurityException 如果存在安全管理器并且其 checkPermission 方法不允許密碼身份驗(yàn)證請(qǐng)求。

requestPasswordAuthentication

public static PasswordAuthentication requestPasswordAuthentication(String host, InetAddress addr, int port, String protocol, String prompt, String scheme)

向已在系統(tǒng)中注冊(cè)的身份驗(yàn)證器詢問密碼。 這是請(qǐng)求密碼的首選方法,因?yàn)樵?InetAddress 不可用的情況下可以提供主機(jī)名。

首先,如果存在安全管理器,則使用 NetPermission("requestPasswordAuthentication") 權(quán)限調(diào)用其 checkPermission 方法。 這可能會(huì)導(dǎo)致 java.lang.SecurityException。

參數(shù):

參數(shù)名稱 參數(shù)描述
host 請(qǐng)求身份驗(yàn)證的站點(diǎn)的主機(jī)名。
addr 請(qǐng)求身份驗(yàn)證的站點(diǎn)的 InetAddress,如果未知,則為 null。
port 請(qǐng)求連接的端口。
protocol 請(qǐng)求連接的協(xié)議 (getRequestingProtocol())
prompt 用于標(biāo)識(shí)身份驗(yàn)證領(lǐng)域的用戶提示字符串。
scheme 認(rèn)證方案

返回:

用戶名/密碼,如果無(wú)法獲取,則返回 null。

Throws:

Throw名稱 Throw描述
SecurityException 如果存在安全管理器并且其 checkPermission 方法不允許密碼身份驗(yàn)證請(qǐng)求。

requestPasswordAuthentication

public static PasswordAuthentication requestPasswordAuthentication(String host, InetAddress addr, int port, String protocol, String prompt, String scheme, URL url, Authenticator.RequestorType reqType)

向已在系統(tǒng)中注冊(cè)的身份驗(yàn)證器詢問密碼。

首先,如果存在安全管理器,則使用 NetPermission("requestPasswordAuthentication") 權(quán)限調(diào)用其 checkPermission 方法。 這可能會(huì)導(dǎo)致 java.lang.SecurityException。

參數(shù):

參數(shù)名稱 參數(shù)描述
host 請(qǐng)求身份驗(yàn)證的站點(diǎn)的主機(jī)名。
addr 請(qǐng)求授權(quán)的站點(diǎn)的 InetAddress,如果未知,則為 null。
port 請(qǐng)求連接的端口
protocol 請(qǐng)求連接的協(xié)議 (getRequestingProtocol())
prompt 用戶的提示字符串
scheme 認(rèn)證方案
url 導(dǎo)致身份驗(yàn)證的請(qǐng)求 URL
reqType 請(qǐng)求身份驗(yàn)證的實(shí)體的類型(服務(wù)器或代理)。

返回:

用戶名/密碼,如果無(wú)法獲取,則返回 null。

Throws:

Throw名稱 Throw描述
SecurityException 如果存在安全管理器并且其 checkPermission 方法不允許密碼身份驗(yàn)證請(qǐng)求。

getRequestingHost

protected final String getRequestingHost()

獲取請(qǐng)求身份驗(yàn)證的站點(diǎn)或代理的主機(jī)名,如果不可用,則為 null。

返回:

需要身份驗(yàn)證的連接的主機(jī)名,如果不可用,則為 null。

getRequestingSite

protected final InetAddress getRequestingSite()

獲取請(qǐng)求授權(quán)的站點(diǎn)的 InetAddress,如果不可用,則為 null。

返回:

請(qǐng)求授權(quán)的站點(diǎn)的 InetAddress,如果不可用,則返回 null。

getRequestingPort

protected final int getRequestingPort()

獲取所請(qǐng)求連接的端口號(hào)。

返回:

一個(gè) int 指示所請(qǐng)求連接的端口。

getRequestingProtocol

protected final String getRequestingProtocol()

給出請(qǐng)求連接的協(xié)議。 通常這將基于 URL,但在未來(lái)的 JDK 中,它可能是例如“SOCKS”,用于受密碼保護(hù)的 SOCKS5 防火墻。

返回:

協(xié)議,可選擇后跟“/version”,其中 version 是版本號(hào)。

getRequestingPrompt

protected final String getRequestingPrompt()

獲取請(qǐng)求者給出的提示字符串。

返回:

請(qǐng)求者給出的提示字符串(http請(qǐng)求的領(lǐng)域)

getRequestingScheme

protected final String getRequestingScheme()

獲取請(qǐng)求者的方案(例如 HTTP 防火墻的 HTTP 方案)。

返回:

請(qǐng)求者的計(jì)劃

getPasswordAuthentication

protected PasswordAuthentication getPasswordAuthentication()

需要密碼授權(quán)時(shí)調(diào)用。 子類應(yīng)該覆蓋默認(rèn)實(shí)現(xiàn),它返回 null。

返回:

從用戶收集的 PasswordAuthentication,如果沒有提供,則返回 null。

getRequestingURL

protected URL getRequestingURL()

返回導(dǎo)致此身份驗(yàn)證請(qǐng)求的 URL。

返回:

請(qǐng)求的 URL

getRequestorType

protected Authenticator.RequestorType getRequestorType()

返回請(qǐng)求者是代理還是服務(wù)器。

返回:

請(qǐng)求者的身份驗(yàn)證類型


當(dāng)前題目:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSAuthenticator
瀏覽路徑:http://m.5511xx.com/article/cdheioe.html