我有一個接口錯誤傳遞變量參數
import javax.naming.AuthenticationException;
import com.unboundid.ldap.sdk.LDAPException;
public interface AuthenticationServiceManager {
/**
* Creates the Connection for the specific user logging in, and binds the
* user's credentials to object.
*
* @param userName
* The user name to authenticate .
* @param password
* The user's password to check .
* @param args
* is an object that holds variable arguments which can be used
* to authenticate using both LDAP and OpenId
* @return boolean The connection status showing whether the user has been
* successfully authenticated or not.
* @throws AuthenticationException
* If there is an error authenticating with the passed
* parameters
**/
boolean authenticate(String username, String password, Object... args)
throws AuthenticationException, LDAPException;
/**
* Disconnects the connection.
*/
void disconnect();
}
實現此接口
package com.cerner.jira.plugins.esig.servicemanagerimpl;
import javax.naming.AuthenticationException;
import com.cerner.jira.plugins.esig.servicemanager.AuthenticationServiceManager;
import com.unboundid.ldap.sdk.LDAPException;
public class AuthenticationManagerImpl implements AuthenticationServiceManager {
@Override
public boolean authenticate(String username, String password)
throws AuthenticationException, LDAPException {
return false;
}
@Override
public boolean authenticate(String username, String password, String url)
{
return false;
}
@Override
public void disconnect() {
// TODO Auto-generated method stub
}
}
我試圖創建一個接口的類可用於實現連接類。我應該能夠使用這個不同的認證,如LDAP,OpenId等;所以我想通過用戶名,密碼(如果它的LDAP)和可變數量的參數(如果OpenId)。我怎麼做?我試過這個。這是拋出錯誤。我如何初始化對象以保存可變參數?
錯誤:該方法的authenticate類型AuthenticationManagerImpl的(字符串,字符串)必須重寫或實現的超類型方法
*「這是拋出錯誤。」* ***什麼***錯誤?總是,總是*包含這樣的基本信息。你爲什麼認爲這是可選的? –
我認爲你在這裏重新發明了一下輪子。你有沒有檢查過呢? http://docs.spring.io/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#ns-openid – Jackie
我很抱歉,這是錯誤「The method authenticate(String ,字符串)的類型AuthenticationManagerImpl必須重寫或實現一個超類型方法「 – user3438489