Liberty 서버에서 제공되는 com.ibm.wsspi.security.jaspi.ProviderService
인터페이스를 사용하여 인바운드 웹 요청을 인증하는 JASPIC
제공자를 개발할 수 있습니다.
이 태스크 정보
Java™ Authentication SPI for Containers 스펙인 JSR
196은 인증 제공자용 인터페이스를 정의합니다. Liberty
서버에서 JASPIC 제공자를 사용자 기능으로 패키지해야 합니다. 사용자 기능은
com.ibm.wsspi.security.jaspi.ProviderService 인터페이스를 구현해야 합니다.
프로시저
- com.ibm.wsspi.security.jaspi.ProviderService 인터페이스를 구현하는 서비스를 제공하는 OSGi 컴포넌트를 작성하십시오.
ProviderService 인터페이스는 Liberty 런타임이
javax.security.auth.message.config.AuthConfigProvider 인터페이스를 구현하는 JASPIC 제공자 클래스의
인스턴스를 검색하기 위해 호출하는 getAuthConfigProvider 메소드를 정의합니다.
다음 예에서는 OSGi 선언 서비스 어노테이션을 사용합니다.
@package com.mycompany.jaspi;
import java.util.Map;
import javax.security.auth.message.config.AuthConfigFactory;
import javax.security.auth.message.config.AuthConfigProvider;
import org.osgi.service.component.ComponentContext;
import com.mycompany.jaspi.SampleAuthConfigProvider;
import com.ibm.wsspi.security.jaspi.ProviderService;
@Component(service = { ProviderService.class },
configurationPolicy = ConfigurationPolicy.IGNORE,
immediate = true,
property = { "myPoviderPoperty1=value1",
"myPoviderPoperty2=value2"})
public class SampleJaspiProviderService implements ProviderService {
Map<String, String> configProps = null;
// This method called by the Liberty runtime
// to get an instance of AuthConfigProvider
@Override
public AuthConfigProvider getAuthConfigProvider(Map<String, String>,
AuthConfigFactory factory)
{
return new SampleAuthConfigProvider(configProps, factory);
}
protected void activate(ComponentContext cc) {
// Read provider config properties here if needed,
// then pass them to the AuthConfigProvider factory.
// This example reads the properties from the OSGi
// component definition.
configProps = (Map<String, String>) cc.getProperties();
}
protected void deactivate(ComponentContext cc) {}
}
- JASPIC 인증 제공자와 함께 컴포넌트를 사용자 기능의 일부인 OSGi 번들에 패키지하십시오.
- 기능이 OSGi 하위 시스템 컨텐츠 com.ibm.websphere.appserver.jaspic-1.1; type="osgi.subsystem.feature"를 포함하는지 확인하십시오.
- 기능이 사용자 제품 확장 위치에 설치된 후, 기능 이름으로 server.xml 파일을 구성하십시오. For example:
<featureManager>
...
<feature>usr:myJaspiProvider</feature>
</featureManager>