|
SupportsSession 參數會支援請求之間的工作階段,並且依預設會設定為 true。如果您不想支援請求之間的工作階段,請設定為 false。
|
方法
|
描述
|
---|---|
public boolean matchesAuthRequest(HttpServletRequest httpRequest)
throws AuthenticatorException, |
允許您從作為 httpRequest 參數提供的傳入驗證請求取得資訊。欲指定可處理請求,請傳回 true,否則傳回 false。若傳回值為 true,ThingWorx 執行時間會呼叫驗證方法 (如下所示)。
|
//… make SSO call or other algorithm to determine userName public void authenticate(HttpServletRequest httpRequest, HttpServletResponse httpResponse) { // use validateThingworxUser to make sure the user is enabled and a Thingworx user AuthenticationUtilities.validateThingworxUser(userName); // Call setCredentials, so the Thingworx platform can provide the correct permissions and access to allowed content this.setCredentials(userName); } // … or if not using SSO, but providing username and password public void authenticate(HttpServletRequest httpRequest, HttpServletResponse httpResponse) { AuthenticationUtilities.validateCredentials(user, password); this.setCredentials(user, password); } |
如果驗證策略僅提供使用者名稱 (例如,SSO,透過此方式會在單獨的應用程式中完成使用者驗證),請使用第一組 "validate" 與 "setCredentials",如左欄所示。
如果驗證策略提供使用者名稱與密碼,請使用第二組 "validate" 與 "setCredentials",如左欄所示。
|
public void issueAuthenticationChallenge(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
擲回 AuthenticatorException
|
不一定總是要用這個方法。但是,如果從驗證方法擲回例外,或如果您將 RequiresChallenge 旗標設定為 true,則將會呼叫 issueAuthenticationchallenge 方法。
|
|
此驗證器預定用於未來的發行版本,目前禁用。
|
|
此驗證器預定用於未來的發行版本,目前禁用。
|
|
依預設會禁用所有驗證器。
|