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

RELATEED CONSULTING
相關咨詢
選擇下列產品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

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

Authenticator

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

java.lang.Object

|---java.net.Authenticator

public abstract class Authenticator
extends Object

Authenticator 類表示一個知道如何獲得網(wǎng)絡連接身份驗證的對象。 通常,它會通過提示用戶輸入信息來做到這一點。

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

然后通過調用 setDefault(java.net.Authenticator) 向系統(tǒng)注冊這個具體子類的實例。 當需要身份驗證時,系統(tǒng)將調用其中一個 requestPasswordAuthentication() 方法,該方法又將調用注冊對象的 getPasswordAuthentication() 方法。

所有請求身份驗證的方法都有一個失敗的默認實現(xiàn)。

嵌套類摘要

修飾符和類型 描述
static class Authenticator.RequestorType 請求身份驗證的實體的類型。

構造函數(shù)摘要

構造函數(shù) 描述
Authenticator()

方法總結

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

構造函數(shù)詳細信息

Authenticator

public Authenticator()

方法詳情

setDefault

public static void setDefault(Authenticator a)

設置當代理或 HTTP 服務器請求身份驗證時網(wǎng)絡代碼將使用的身份驗證器。

首先,如果有安全管理器,則使用 NetPermission("setDefaultAuthenticator") 權限調用其 checkPermission 方法。 這可能會導致 java.lang.SecurityException。

參數(shù):

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

Throws:

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

requestPasswordAuthentication

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

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

首先,如果存在安全管理器,則使用 NetPermission("requestPasswordAuthentication") 權限調用其 checkPermission 方法。 這可能會導致 java.lang.SecurityException。

參數(shù):

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

返回:

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

Throws:

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

requestPasswordAuthentication

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

向已在系統(tǒng)中注冊的身份驗證器詢問密碼。 這是請求密碼的首選方法,因為在 InetAddress 不可用的情況下可以提供主機名。

首先,如果存在安全管理器,則使用 NetPermission("requestPasswordAuthentication") 權限調用其 checkPermission 方法。 這可能會導致 java.lang.SecurityException。

參數(shù):

參數(shù)名稱 參數(shù)描述
host 請求身份驗證的站點的主機名。
addr 請求身份驗證的站點的 InetAddress,如果未知,則為 null。
port 請求連接的端口。
protocol 請求連接的協(xié)議 (getRequestingProtocol())
prompt 用于標識身份驗證領域的用戶提示字符串。
scheme 認證方案

返回:

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

Throws:

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

requestPasswordAuthentication

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

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

首先,如果存在安全管理器,則使用 NetPermission("requestPasswordAuthentication") 權限調用其 checkPermission 方法。 這可能會導致 java.lang.SecurityException。

參數(shù):

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

返回:

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

Throws:

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

getRequestingHost

protected final String getRequestingHost()

獲取請求身份驗證的站點或代理的主機名,如果不可用,則為 null。

返回:

需要身份驗證的連接的主機名,如果不可用,則為 null。

getRequestingSite

protected final InetAddress getRequestingSite()

獲取請求授權的站點的 InetAddress,如果不可用,則為 null。

返回:

請求授權的站點的 InetAddress,如果不可用,則返回 null。

getRequestingPort

protected final int getRequestingPort()

獲取所請求連接的端口號。

返回:

一個 int 指示所請求連接的端口。

getRequestingProtocol

protected final String getRequestingProtocol()

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

返回:

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

getRequestingPrompt

protected final String getRequestingPrompt()

獲取請求者給出的提示字符串。

返回:

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

getRequestingScheme

protected final String getRequestingScheme()

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

返回:

請求者的計劃

getPasswordAuthentication

protected PasswordAuthentication getPasswordAuthentication()

需要密碼授權時調用。 子類應該覆蓋默認實現(xiàn),它返回 null。

返回:

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

getRequestingURL

protected URL getRequestingURL()

返回導致此身份驗證請求的 URL。

返回:

請求的 URL

getRequestorType

protected Authenticator.RequestorType getRequestorType()

返回請求者是代理還是服務器。

返回:

請求者的身份驗證類型


分享文章:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSAuthenticator
標題URL:http://www.5511xx.com/article/cdheioe.html