java.security.AuthProvider Java Examples

The following examples show how to use java.security.AuthProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProviderFactory.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public static AuthProvider getProvider() throws TechnicalConnectorException {
   String providerClassName = config.getProperty("provider.class", DEFAULT_PROVIDER);

   try {
      Class<?> provider = Class.forName(providerClassName);
      Object providerObject = provider.newInstance();
      if (providerObject instanceof ProviderAdaptor) {
         return (AuthProvider)((ProviderAdaptor)providerObject).getProvider();
      } else {
         String msg = "Class with name [" + provider + "] is not an instance of RevocationStatusChecker, but an instance of [" + providerObject.getClass() + "]";
         LOG.debug(msg);
         throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.PROVIDER_INSTANCIATION, new Object[]{msg});
      }
   } catch (Exception var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.PROVIDER_INSTANCIATION, var4, new Object[]{providerClassName, var4.getMessage()});
   }
}
 
Example #2
Source File: ProviderFactory.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public static AuthProvider getProvider() throws TechnicalConnectorException {
   String providerClassName = config.getProperty("provider.class", DEFAULT_PROVIDER);

   try {
      Class<?> provider = Class.forName(providerClassName);
      Object providerObject = provider.newInstance();
      if (providerObject instanceof ProviderAdaptor) {
         return (AuthProvider)((ProviderAdaptor)providerObject).getProvider();
      } else {
         String msg = "Class with name [" + provider + "] is not an instance of RevocationStatusChecker, but an instance of [" + providerObject.getClass() + "]";
         LOG.debug(msg);
         throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.PROVIDER_INSTANCIATION, new Object[]{msg});
      }
   } catch (Exception var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.PROVIDER_INSTANCIATION, var4, new Object[]{providerClassName, var4.getMessage()});
   }
}
 
Example #3
Source File: ProviderFactory.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public static AuthProvider getProvider() throws TechnicalConnectorException {
   String providerClassName = config.getProperty("provider.class", DEFAULT_PROVIDER);

   try {
      Class<?> provider = Class.forName(providerClassName);
      Object providerObject = provider.newInstance();
      if (providerObject instanceof ProviderAdaptor) {
         return (AuthProvider)((ProviderAdaptor)providerObject).getProvider();
      } else {
         String msg = "Class with name [" + provider + "] is not an instance of RevocationStatusChecker, but an instance of [" + providerObject.getClass() + "]";
         LOG.debug(msg);
         throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.PROVIDER_INSTANCIATION, new Object[]{msg});
      }
   } catch (Exception var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.PROVIDER_INSTANCIATION, var4, new Object[]{providerClassName, var4.getMessage()});
   }
}
 
Example #4
Source File: ProviderFactory.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public static AuthProvider getProvider() throws TechnicalConnectorException {
   String providerClassName = config.getProperty("provider.class", DEFAULT_PROVIDER);

   try {
      Class<?> provider = Class.forName(providerClassName);
      Object providerObject = provider.newInstance();
      if (providerObject instanceof ProviderAdaptor) {
         return (AuthProvider)((ProviderAdaptor)providerObject).getProvider();
      } else {
         String msg = "Class with name [" + provider + "] is not an instance of RevocationStatusChecker, but an instance of [" + providerObject.getClass() + "]";
         LOG.debug(msg);
         throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.PROVIDER_INSTANCIATION, new Object[]{msg});
      }
   } catch (Exception var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.PROVIDER_INSTANCIATION, var4, new Object[]{providerClassName, var4.getMessage()});
   }
}
 
Example #5
Source File: ProviderFactory.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public static AuthProvider getProvider() throws TechnicalConnectorException {
   String providerClassName = config.getProperty("provider.class", DEFAULT_PROVIDER);

   try {
      Class<?> provider = Class.forName(providerClassName);
      Object providerObject = provider.newInstance();
      if (providerObject instanceof ProviderAdaptor) {
         return (AuthProvider)((ProviderAdaptor)providerObject).getProvider();
      } else {
         String msg = "Class with name [" + provider + "] is not an instance of RevocationStatusChecker, but an instance of [" + providerObject.getClass() + "]";
         LOG.debug(msg);
         throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.PROVIDER_INSTANCIATION, new Object[]{msg});
      }
   } catch (Exception var4) {
      LOG.error(var4.getClass().getSimpleName() + ": " + var4.getMessage());
      throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.PROVIDER_INSTANCIATION, var4, new Object[]{providerClassName, var4.getMessage()});
   }
}
 
Example #6
Source File: Basic.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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());
    }
}
 
Example #7
Source File: Basic.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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());
    }
}
 
Example #8
Source File: Basic.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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());
    }
}
 
Example #9
Source File: OpenPkcs11Action.java    From keystore-explorer with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
	}
}
 
Example #10
Source File: Basic.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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());
    }
}
 
Example #11
Source File: Basic.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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());
    }
}
 
Example #12
Source File: Basic.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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());
    }
}
 
Example #13
Source File: Basic.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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());
    }
}
 
Example #14
Source File: Basic.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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());
    }
}
 
Example #15
Source File: Basic.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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());
    }
}
 
Example #16
Source File: Basic.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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());
    }
}
 
Example #17
Source File: Basic.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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());
    }
}
 
Example #18
Source File: Basic.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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());
    }
}
 
Example #19
Source File: Basic.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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());
    }
}