Search in sources :

Example 1 with CertKeyToUserNameMapper

use of org.apache.cxf.interceptor.security.callback.CertKeyToUserNameMapper in project cxf by apache.

the class JAASLoginInterceptorTest method testLoginWithTlsHandler.

@Test
public void testLoginWithTlsHandler() {
    JAASLoginInterceptor jaasInt = createTestJaasLoginInterceptor();
    CallbackHandlerTlsCert tlsHandler = new CallbackHandlerTlsCert();
    tlsHandler.setFixedPassword(TestUserPasswordLoginModule.TESTPASS);
    CertKeyToUserNameMapper certMapper = new CertKeyToUserNameMapper();
    certMapper.setKey("CN");
    tlsHandler.setCertMapper(certMapper);
    jaasInt.setCallbackHandlerProviders(Collections.singletonList((CallbackHandlerProvider) tlsHandler));
    Message message = new MessageImpl();
    TLSSessionInfo sessionInfo = new TLSSessionInfo("", null, new Certificate[] { createTestCert(TEST_SUBJECT_DN) });
    message.put(TLSSessionInfo.class, sessionInfo);
    jaasInt.handleMessage(message);
}
Also used : CallbackHandlerTlsCert(org.apache.cxf.interceptor.security.callback.CallbackHandlerTlsCert) Message(org.apache.cxf.message.Message) CertKeyToUserNameMapper(org.apache.cxf.interceptor.security.callback.CertKeyToUserNameMapper) TLSSessionInfo(org.apache.cxf.security.transport.TLSSessionInfo) CallbackHandlerProvider(org.apache.cxf.interceptor.security.callback.CallbackHandlerProvider) MessageImpl(org.apache.cxf.message.MessageImpl) Test(org.junit.Test)

Aggregations

CallbackHandlerProvider (org.apache.cxf.interceptor.security.callback.CallbackHandlerProvider)1 CallbackHandlerTlsCert (org.apache.cxf.interceptor.security.callback.CallbackHandlerTlsCert)1 CertKeyToUserNameMapper (org.apache.cxf.interceptor.security.callback.CertKeyToUserNameMapper)1 Message (org.apache.cxf.message.Message)1 MessageImpl (org.apache.cxf.message.MessageImpl)1 TLSSessionInfo (org.apache.cxf.security.transport.TLSSessionInfo)1 Test (org.junit.Test)1