密碼驗證器¶
Presto 支援透過自訂密碼驗證器,使用使用者名稱和密碼進行驗證,該驗證器會驗證憑證並建立主體。
實作¶
PasswordAuthenticatorFactory
負責建立 PasswordAuthenticator
實例。它也會定義此驗證器的名稱,管理員會在 Presto 設定中使用此名稱。
PasswordAuthenticator
包含單一方法 createAuthenticatedPrincipal()
,該方法會驗證憑證並傳回 Principal
,然後由 系統存取控制 授權。
PasswordAuthenticatorFactory
的實作必須包裝為外掛程式並安裝在 Presto 叢集上。
設定¶
在實作 PasswordAuthenticatorFactory
的外掛程式安裝在協調器上之後,可以使用 etc/password-authenticator.properties
檔案進行設定。除了 access-control.name
之外的所有屬性,都是特定於 PasswordAuthenticatorFactory
實作的。
Presto 會使用 password-authenticator.name
屬性,根據 PasswordAuthenticatorFactory.getName()
傳回的名稱,尋找已註冊的 PasswordAuthenticatorFactory
。剩餘的屬性會以對應方式傳遞至 PasswordAuthenticatorFactory.create()
。
設定檔範例
password-authenticator.name=custom-access-control
custom-property1=custom-value1
custom-property2=custom-value2
此外,必須將協調器設定為使用密碼驗證,並啟用 HTTPS。