Search in sources :

Example 1 with NamePasswordCallbackHandler

use of org.apache.cxf.interceptor.security.NamePasswordCallbackHandler in project cxf by apache.

the class CallbackHandlerTlsCert method create.

@Override
public CallbackHandler create(Message message) {
    TLSSessionInfo tlsSession = message.get(TLSSessionInfo.class);
    if (tlsSession == null) {
        return null;
    }
    Certificate cert = getCertificate(message);
    String name = certMapper.getUserName(cert);
    String password = nameToPasswordMapper.getPassword(name);
    return new NamePasswordCallbackHandler(name, password);
}
Also used : NamePasswordCallbackHandler(org.apache.cxf.interceptor.security.NamePasswordCallbackHandler) TLSSessionInfo(org.apache.cxf.security.transport.TLSSessionInfo) X509Certificate(java.security.cert.X509Certificate) Certificate(java.security.cert.Certificate)

Example 2 with NamePasswordCallbackHandler

use of org.apache.cxf.interceptor.security.NamePasswordCallbackHandler in project cxf by apache.

the class CallbackHandlerProviderUsernameToken method create.

@Override
public CallbackHandler create(Message message) {
    SecurityToken token = message.get(SecurityToken.class);
    if (!(token instanceof UsernameToken)) {
        return null;
    }
    UsernameToken ut = (UsernameToken) token;
    if (ut.getPasswordType().endsWith("PasswordDigest")) {
        return new NameDigestPasswordCallbackHandler(ut.getName(), ut.getPassword(), ut.getNonce(), ut.getCreatedTime());
    }
    return new NamePasswordCallbackHandler(ut.getName(), ut.getPassword());
}
Also used : SecurityToken(org.apache.cxf.common.security.SecurityToken) NameDigestPasswordCallbackHandler(org.apache.cxf.interceptor.security.NameDigestPasswordCallbackHandler) NamePasswordCallbackHandler(org.apache.cxf.interceptor.security.NamePasswordCallbackHandler) UsernameToken(org.apache.cxf.common.security.UsernameToken)

Aggregations

NamePasswordCallbackHandler (org.apache.cxf.interceptor.security.NamePasswordCallbackHandler)2 Certificate (java.security.cert.Certificate)1 X509Certificate (java.security.cert.X509Certificate)1 SecurityToken (org.apache.cxf.common.security.SecurityToken)1 UsernameToken (org.apache.cxf.common.security.UsernameToken)1 NameDigestPasswordCallbackHandler (org.apache.cxf.interceptor.security.NameDigestPasswordCallbackHandler)1 TLSSessionInfo (org.apache.cxf.security.transport.TLSSessionInfo)1