![[16.0.0.3 and later]](../ng_v16003plus.gif)
Developing a custom user repository for Liberty
You can develop a custom user repository as a user feature by implementing the com.ibm.wsspi.security.wim.CustomRepository interface in the Liberty server. The custom repository interface enables support for most types of account repository.
Procedure
Repository interface example
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
}
}