Liberty でのカスタム・ユーザー・リポジトリーの開発
Liberty サーバーで提供されている com.ibm.ws.security.wim.RepositoryFactory インターフェースと com.ibm.ws.security.wim.Repository インターフェースを実装することにより、カスタム・ユーザー・リポジトリー・クラスを開発することができます。
このタスクについて
リポジトリー・インターフェースを使用すると、ほぼすべてのタイプのアカウント・リポジトリーへのサポートが使用可能になります。
手順
例
リポジトリー・ファクトリー・インターフェース
package com.myorg;
import java.util.Map;
import org.osgi.service.component.ComponentContext;
import com.ibm.websphere.security.wim.exception.WIMException;
import com.ibm.ws.security.wim.Repository;
import com.ibm.ws.security.wim.RepositoryFactory;
public class CustomRepositoryFactory implements RepositoryFactory {
@Override
public Repository getRepository(Map<String, Object> properties) throws WIMException {
System.out.println("getRepository " + properties);
return new CustomRepository(properties);
}
public void activate(ComponentContext cc, Map<String, Object> properties) {
System.out.println("In activate");
}
public void deactivate(ComponentContext cc) {
System.out.println("In deactivate");
}
}
リポジトリー・インターフェース
package com.myorg;
import java.util.Map;
import com.ibm.websphere.security.wim.exception.WIMException;
import com.ibm.websphere.security.wim.model.Root;
import com.ibm.ws.security.wim.Repository;
import com.ibm.ws.security.wim.RepositoryConfiguration;
public class CustomRepository extends RepositoryConfiguration implements Repository {
public CustomRepository(Map<String, Object> properties) {
System.out.println("Constructor with " + properties);
}
@Override
public Root create(Root arg0) throws WIMException {
throw new WIMException("Method not supported");
}
@Override
public Root delete(Root arg0) throws WIMException {
throw new WIMException("Method not supported");
}
@Override
public Root get(Root arg0) throws WIMException {
throw new WIMException("Method not supported");
}
@Override
public String getRealm() {
return "customRepository";
}
@Override
public Root login(Root arg0) throws WIMException {
throw new WIMException("Method not supported");
}
@Override
public Root search(Root arg0) throws WIMException {
throw new WIMException("Method not supported");
}
@Override
public Root update(Root arg0) throws WIMException {
throw new WIMException("Method not supported");
}
}
タスク・トピック