本文整理汇总了Java中java.security.AuthProvider类的典型用法代码示例。如果您正苦于以下问题:Java AuthProvider类的具体用法?Java AuthProvider怎么用?Java AuthProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthProvider类属于java.security包,在下文中一共展示了AuthProvider类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clear
import java.security.AuthProvider; //导入依赖的package包/类
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();
}
示例2: list
import java.security.AuthProvider; //导入依赖的package包/类
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());
}
}
示例3: doAction
import java.security.AuthProvider; //导入依赖的package包/类
/**
* 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);
}
}
示例4: logoutSmart
import java.security.AuthProvider; //导入依赖的package包/类
/**
* 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;
}
}