Search in sources :

Example 1 with AppClientSSL

use of com.sun.enterprise.security.integration.AppClientSSL in project Payara by payara.

the class AppClientSecurityInfoImpl method convert.

private AppClientSSL convert(Ssl ssl) {
    AppClientSSL appSSL = new AppClientSSL();
    appSSL.setCertNickname(ssl.getCertNickname());
    // appSSL.setClientAuthEnabled(ssl.isClientAuthEnabled());
    appSSL.setSsl2Ciphers(ssl.getSsl2Ciphers());
    appSSL.setSsl2Enabled(ssl.isSsl2Enabled());
    appSSL.setSsl3Enabled(ssl.isSsl3Enabled());
    appSSL.setSsl3TlsCiphers(ssl.getSsl3TlsCiphers());
    appSSL.setTlsEnabled(ssl.isTlsEnabled());
    appSSL.setTlsRollbackEnabled(ssl.isTlsRollbackEnabled());
    return appSSL;
}
Also used : AppClientSSL(com.sun.enterprise.security.integration.AppClientSSL)

Example 2 with AppClientSSL

use of com.sun.enterprise.security.integration.AppClientSSL in project Payara by payara.

the class ClientCertificateLoginModule method commit.

/**
 * <p> This method is called if the LoginContext's
 * overall authentication succeeded
 * (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules
 * succeeded).
 *
 * <p> If this LoginModule's own authentication attempt
 * succeeded (checked by retrieving the private state saved by the
 * <code>login</code> method), then this method associates a
 * <code>PrincipalImpl</code>
 * with the <code>Subject</code> located in the
 * <code>LoginModule</code>.  If this LoginModule's own
 * authentication attempted failed, then this method removes
 * any state that was originally saved.
 *
 * <p>
 *
 * @exception LoginException if the commit fails.
 *
 * @return true if this LoginModule's own login and commit
 *		attempts succeeded, or false otherwise.
 */
public boolean commit() throws LoginException {
    if (succeeded == false) {
        return false;
    } else {
        // add a Principal (authenticated identity)
        // to the Subject
        // assume the user we authenticated is the PrincipalImpl
        userPrincipal = new PrincipalImpl(alias);
        if (!subject.getPrincipals().contains(userPrincipal)) {
            subject.getPrincipals().add(userPrincipal);
        }
        if (debug) {
            if (_logger.isLoggable(Level.FINE)) {
                _logger.log(Level.FINE, "\t\t[ClientCertificateLoginModule] " + "added PrincipalImpl to Subject");
            }
        }
        ssl = new AppClientSSL();
        ssl.setCertNickname(this.alias);
        sslUtils.setAppclientSsl(ssl);
        String realm = LoginContextDriver.CERT_REALMNAME;
        X509Certificate[] certChain = new X509Certificate[1];
        certChain[0] = certificate;
        X509CertificateCredential pc = new X509CertificateCredential(certChain, alias, realm);
        if (!subject.getPrivateCredentials().contains(pc)) {
            subject.getPrivateCredentials().add(pc);
        }
        commitSucceeded = true;
        return true;
    }
}
Also used : X509CertificateCredential(com.sun.enterprise.security.auth.login.common.X509CertificateCredential) PrincipalImpl(org.glassfish.security.common.PrincipalImpl) AppClientSSL(com.sun.enterprise.security.integration.AppClientSSL) X509Certificate(java.security.cert.X509Certificate)

Aggregations

AppClientSSL (com.sun.enterprise.security.integration.AppClientSSL)2 X509CertificateCredential (com.sun.enterprise.security.auth.login.common.X509CertificateCredential)1 X509Certificate (java.security.cert.X509Certificate)1 PrincipalImpl (org.glassfish.security.common.PrincipalImpl)1