![[16.0.0.3 以及更新版本]](../ng_v16003plus.gif)
開發 Liberty 的自訂使用者儲存庫
您可以在 Liberty 伺服器中實作 com.ibm.wsspi.security.wim.CustomRepository 介面,將自訂使用者儲存庫開發為一項使用者特性。 自訂儲存庫介面支援大部分類型的帳戶儲存庫。
程序
儲存庫介面範例
package com.myorg;
import java.util.Map;
import com.ibm.wsspi.security.wim.exception.WIMException;
import com.ibm.wsspi.security.wim.model.Root;
import com.ibm.wsspi.security.wim.CustomRepository;
public class MyCustomRepository implements CustomRepository {
public CustomRepository() {
System.out.println(“In my custom repository implementation”);
}
@Override
public Root create(Root arg0) throws WIMException {
System.out.println(“In my create method”);
//Add your code here
}
@Override
public Root delete(Root arg0) throws WIMException {
System.out.println(“In my delete method”);
//Add your code here
}
@Override
public Root get(Root arg0) throws WIMException {
System.out.println(“In my get method”);
//Add your code here
}
@Override
public String getRealm() {
return "customRepository";
}
@Override
public Root login(Root arg0) throws WIMException {
System.out.println(“In my login method”);
//Add your code here
}
@Override
public Root search(Root arg0) throws WIMException {
System.out.println(“In my search method”);
//Add your code here
}
@Override
public Root update(Root arg0) throws WIMException {
System.out.println(“In my update method”);
//Add your code here
}
@Override
public Map<String, String> getRepositoryBaseEntries() {
System.out.println(“In my getRepositoryBaseEntries method”);
//Add your code here
}
@Override
public String[] getRepositoriesForGroups() {
System.out.println(“In my getRepositoriesForGroups method”);
//Add your code here
}
}