Java 类java.security.AuthProvider 实例源码

项目:cn1    文件:KeyStoreLoginModule.java   
private void clear() throws LoginException {
    LoginModuleUtils.clearPassword(keyStorePassword);
    keyStorePassword = null;
    LoginModuleUtils.clearPassword(privateKeyPassword);
    privateKeyPassword = null;

    if (keyStoreProvider instanceof AuthProvider) {
        ((AuthProvider) (keyStoreProvider)).logout();
    }

    if (principal != null) {
        subject.getPrincipals().remove(principal);
        principal = null;
    }
    if (certPath != null) {
        subject.getPublicCredentials().remove(certPath);
        certPath = null;
    }
    if (privateCredential != null) {
        subject.getPrivateCredentials().remove(privateCredential);
        privateCredential.destroy();
        privateCredential = null;
    }
    status.logouted();
}
项目:freeVM    文件:KeyStoreLoginModule.java   
private void clear() throws LoginException {
    LoginModuleUtils.clearPassword(keyStorePassword);
    keyStorePassword = null;
    LoginModuleUtils.clearPassword(privateKeyPassword);
    privateKeyPassword = null;

    if (keyStoreProvider instanceof AuthProvider) {
        ((AuthProvider) (keyStoreProvider)).logout();
    }

    if (principal != null) {
        subject.getPrincipals().remove(principal);
        principal = null;
    }
    if (certPath != null) {
        subject.getPublicCredentials().remove(certPath);
        certPath = null;
    }
    if (privateCredential != null) {
        subject.getPrivateCredentials().remove(privateCredential);
        privateCredential.destroy();
        privateCredential = null;
    }
    status.logouted();
}
项目:jdk8u-jdk    文件:Basic.java   
private static void list() throws Exception {
    int testnum = 1;

    ks = KeyStore.getInstance(KS_TYPE, provider);

    // check instance
    if (ks.getProvider() instanceof java.security.AuthProvider) {
        System.out.println("keystore provider instance of AuthProvider");
        System.out.println("test " + testnum++ + " passed");
    } else {
        throw new SecurityException("did not get AuthProvider KeyStore");
    }

    // load
    ks.load(null, tokenPwd);
    System.out.println("test " + testnum++ + " passed");

    // aliases
    Enumeration enu = ks.aliases();
    int count = 0;
    while (enu.hasMoreElements()) {
        count++;
        System.out.println("alias " +
                            count +
                            " = " +
                            (String)enu.nextElement());
    }
}
项目:openjdk-jdk10    文件:Basic.java   
private static void list() throws Exception {
    int testnum = 1;

    ks = KeyStore.getInstance(KS_TYPE, provider);

    // check instance
    if (ks.getProvider() instanceof java.security.AuthProvider) {
        System.out.println("keystore provider instance of AuthProvider");
        System.out.println("test " + testnum++ + " passed");
    } else {
        throw new SecurityException("did not get AuthProvider KeyStore");
    }

    // load
    ks.load(null, tokenPwd);
    System.out.println("test " + testnum++ + " passed");

    // aliases
    Enumeration enu = ks.aliases();
    int count = 0;
    while (enu.hasMoreElements()) {
        count++;
        System.out.println("alias " +
                            count +
                            " = " +
                            (String)enu.nextElement());
    }
}
项目:openjdk9    文件:Basic.java   
private static void list() throws Exception {
    int testnum = 1;

    ks = KeyStore.getInstance(KS_TYPE, provider);

    // check instance
    if (ks.getProvider() instanceof java.security.AuthProvider) {
        System.out.println("keystore provider instance of AuthProvider");
        System.out.println("test " + testnum++ + " passed");
    } else {
        throw new SecurityException("did not get AuthProvider KeyStore");
    }

    // load
    ks.load(null, tokenPwd);
    System.out.println("test " + testnum++ + " passed");

    // aliases
    Enumeration enu = ks.aliases();
    int count = 0;
    while (enu.hasMoreElements()) {
        count++;
        System.out.println("alias " +
                            count +
                            " = " +
                            (String)enu.nextElement());
    }
}
项目:jdk8u_jdk    文件:Basic.java   
private static void list() throws Exception {
    int testnum = 1;

    ks = KeyStore.getInstance(KS_TYPE, provider);

    // check instance
    if (ks.getProvider() instanceof java.security.AuthProvider) {
        System.out.println("keystore provider instance of AuthProvider");
        System.out.println("test " + testnum++ + " passed");
    } else {
        throw new SecurityException("did not get AuthProvider KeyStore");
    }

    // load
    ks.load(null, tokenPwd);
    System.out.println("test " + testnum++ + " passed");

    // aliases
    Enumeration enu = ks.aliases();
    int count = 0;
    while (enu.hasMoreElements()) {
        count++;
        System.out.println("alias " +
                            count +
                            " = " +
                            (String)enu.nextElement());
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:Basic.java   
private static void list() throws Exception {
    int testnum = 1;

    ks = KeyStore.getInstance(KS_TYPE, provider);

    // check instance
    if (ks.getProvider() instanceof java.security.AuthProvider) {
        System.out.println("keystore provider instance of AuthProvider");
        System.out.println("test " + testnum++ + " passed");
    } else {
        throw new SecurityException("did not get AuthProvider KeyStore");
    }

    // load
    ks.load(null, tokenPwd);
    System.out.println("test " + testnum++ + " passed");

    // aliases
    Enumeration enu = ks.aliases();
    int count = 0;
    while (enu.hasMoreElements()) {
        count++;
        System.out.println("alias " +
                            count +
                            " = " +
                            (String)enu.nextElement());
    }
}
项目:keystore-explorer    文件:OpenPkcs11Action.java   
/**
 * Do action.
 */
@Override
protected void doAction() {

    try {
        DOpenPkcs11KeyStore dOpenPkcs11KeyStore = new DOpenPkcs11KeyStore(frame);
        dOpenPkcs11KeyStore.setLocationRelativeTo(frame);
        dOpenPkcs11KeyStore.setVisible(true);

        Provider selectedProvider = dOpenPkcs11KeyStore.getSelectedProvider();
        if (selectedProvider == null) {
            return;
        }

        KeyStore keyStore = KeyStore.getInstance(PKCS11.jce(), selectedProvider);

        // register password handler
        AuthProvider authProvider = (AuthProvider) selectedProvider;
        authProvider.setCallbackHandler(new PasswordCallbackHandler(frame));

        keyStore.load(null, null);

        kseFrame.addKeyStore(keyStore, selectedProvider.getName(), null, selectedProvider);

    } catch (Exception ex) {
        DError.displayError(frame, ex);
    }
}
项目:infobip-open-jdk-8    文件:Basic.java   
private static void list() throws Exception {
    int testnum = 1;

    ks = KeyStore.getInstance(KS_TYPE, provider);

    // check instance
    if (ks.getProvider() instanceof java.security.AuthProvider) {
        System.out.println("keystore provider instance of AuthProvider");
        System.out.println("test " + testnum++ + " passed");
    } else {
        throw new SecurityException("did not get AuthProvider KeyStore");
    }

    // load
    ks.load(null, tokenPwd);
    System.out.println("test " + testnum++ + " passed");

    // aliases
    Enumeration enu = ks.aliases();
    int count = 0;
    while (enu.hasMoreElements()) {
        count++;
        System.out.println("alias " +
                            count +
                            " = " +
                            (String)enu.nextElement());
    }
}
项目:jdk8u-dev-jdk    文件:Basic.java   
private static void list() throws Exception {
    int testnum = 1;

    ks = KeyStore.getInstance(KS_TYPE, provider);

    // check instance
    if (ks.getProvider() instanceof java.security.AuthProvider) {
        System.out.println("keystore provider instance of AuthProvider");
        System.out.println("test " + testnum++ + " passed");
    } else {
        throw new SecurityException("did not get AuthProvider KeyStore");
    }

    // load
    ks.load(null, tokenPwd);
    System.out.println("test " + testnum++ + " passed");

    // aliases
    Enumeration enu = ks.aliases();
    int count = 0;
    while (enu.hasMoreElements()) {
        count++;
        System.out.println("alias " +
                            count +
                            " = " +
                            (String)enu.nextElement());
    }
}
项目:jdk7-jdk    文件:Basic.java   
private static void list() throws Exception {
    int testnum = 1;

    ks = KeyStore.getInstance(KS_TYPE, provider);

    // check instance
    if (ks.getProvider() instanceof java.security.AuthProvider) {
        System.out.println("keystore provider instance of AuthProvider");
        System.out.println("test " + testnum++ + " passed");
    } else {
        throw new SecurityException("did not get AuthProvider KeyStore");
    }

    // load
    ks.load(null, tokenPwd);
    System.out.println("test " + testnum++ + " passed");

    // aliases
    Enumeration enu = ks.aliases();
    int count = 0;
    while (enu.hasMoreElements()) {
        count++;
        System.out.println("alias " +
                            count +
                            " = " +
                            (String)enu.nextElement());
    }
}
项目:openjdk-source-code-learn    文件:Basic.java   
private static void list() throws Exception {
    int testnum = 1;

    ks = KeyStore.getInstance(KS_TYPE, provider);

    // check instance
    if (ks.getProvider() instanceof java.security.AuthProvider) {
        System.out.println("keystore provider instance of AuthProvider");
        System.out.println("test " + testnum++ + " passed");
    } else {
        throw new SecurityException("did not get AuthProvider KeyStore");
    }

    // load
    ks.load(null, tokenPwd);
    System.out.println("test " + testnum++ + " passed");

    // aliases
    Enumeration enu = ks.aliases();
    int count = 0;
    while (enu.hasMoreElements()) {
        count++;
        System.out.println("alias " +
                            count +
                            " = " +
                            (String)enu.nextElement());
    }
}
项目:ExemplosDemoiselle    文件:TabeliaoAppletUtil.java   
/**
 * Efetua logout do SmartCard
 * @throws LoginException 
 */
public static void logoutSmart () throws LoginException{
    if (pkcs11Provider != null){
        AuthProvider ap = (AuthProvider) pkcs11Provider;
        ap.logout();
        pkcs11Provider = null;
    }
    if (providerName != null){
        Security.removeProvider(providerName);
        providerName = null;
    }
}
项目:OLD-OpenJDK8    文件:Basic.java   
private static void list() throws Exception {
    int testnum = 1;

    ks = KeyStore.getInstance(KS_TYPE, provider);

    // check instance
    if (ks.getProvider() instanceof java.security.AuthProvider) {
        System.out.println("keystore provider instance of AuthProvider");
        System.out.println("test " + testnum++ + " passed");
    } else {
        throw new SecurityException("did not get AuthProvider KeyStore");
    }

    // load
    ks.load(null, tokenPwd);
    System.out.println("test " + testnum++ + " passed");

    // aliases
    Enumeration enu = ks.aliases();
    int count = 0;
    while (enu.hasMoreElements()) {
        count++;
        System.out.println("alias " +
                            count +
                            " = " +
                            (String)enu.nextElement());
    }
}
项目:JAVA_UNIT    文件:Basic.java   
private static void list() throws Exception {
    int testnum = 1;

    ks = KeyStore.getInstance(KS_TYPE, provider);

    // check instance
    if (ks.getProvider() instanceof java.security.AuthProvider) {
        System.out.println("keystore provider instance of AuthProvider");
        System.out.println("test " + testnum++ + " passed");
    } else {
        throw new SecurityException("did not get AuthProvider KeyStore");
    }

    // load
    ks.load(null, tokenPwd);
    System.out.println("test " + testnum++ + " passed");

    // aliases
    Enumeration enu = ks.aliases();
    int count = 0;
    while (enu.hasMoreElements()) {
        count++;
        System.out.println("alias " +
                            count +
                            " = " +
                            (String)enu.nextElement());
    }
}
项目:openjdk-jdk7u-jdk    文件:Basic.java   
private static void list() throws Exception {
    int testnum = 1;

    ks = KeyStore.getInstance(KS_TYPE, provider);

    // check instance
    if (ks.getProvider() instanceof java.security.AuthProvider) {
        System.out.println("keystore provider instance of AuthProvider");
        System.out.println("test " + testnum++ + " passed");
    } else {
        throw new SecurityException("did not get AuthProvider KeyStore");
    }

    // load
    ks.load(null, tokenPwd);
    System.out.println("test " + testnum++ + " passed");

    // aliases
    Enumeration enu = ks.aliases();
    int count = 0;
    while (enu.hasMoreElements()) {
        count++;
        System.out.println("alias " +
                            count +
                            " = " +
                            (String)enu.nextElement());
    }
}
项目:openjdk-icedtea7    文件:Basic.java   
private static void list() throws Exception {
    int testnum = 1;

    ks = KeyStore.getInstance(KS_TYPE, provider);

    // check instance
    if (ks.getProvider() instanceof java.security.AuthProvider) {
        System.out.println("keystore provider instance of AuthProvider");
        System.out.println("test " + testnum++ + " passed");
    } else {
        throw new SecurityException("did not get AuthProvider KeyStore");
    }

    // load
    ks.load(null, tokenPwd);
    System.out.println("test " + testnum++ + " passed");

    // aliases
    Enumeration enu = ks.aliases();
    int count = 0;
    while (enu.hasMoreElements()) {
        count++;
        System.out.println("alias " +
                            count +
                            " = " +
                            (String)enu.nextElement());
    }
}