br.com.topsys.cd.applet.AutenticacaoApplet.java Source code

Java tutorial

Introduction

Here is the source code for br.com.topsys.cd.applet.AutenticacaoApplet.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.topsys.cd.applet;

import br.com.bry.x509.certificado.excecoes.ExcecaoCertificado;
import br.com.topsys.cd.util.CertificadoDigital;
import javax.swing.JOptionPane;
import netscape.javascript.JSObject;
import org.apache.commons.codec.binary.Base64;

/**
 *
 * @author andre
 */
public class AutenticacaoApplet extends PrincipalApplet {

    @Override
    public void complemento(CertificadoDigital certificadoDigital) {
        try {

            JSObject window = JSObject.getWindow(this);
            window.call("setCertificado", new Object[] {
                    Base64.encodeBase64String(certificadoDigital.getX509Certificado().getEncoded()) });
            this.closeSuccess();

        } catch (ExcecaoCertificado ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage(), "Aviso", JOptionPane.ERROR_MESSAGE);
            this.closeError();
        }

    }

}