![[16.0.0.3 及更高版本]](../ng_v16003.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
}
}