Java Code Examples for javax.security.auth.login.Configuration#getInstance()
The following examples show how to use
javax.security.auth.login.Configuration#getInstance() .
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: GetInstance.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private int testDefault(int testnum) throws Exception { // get an instance of the default ConfigSpiFile Configuration c = Configuration.getInstance(JAVA_CONFIG, null); doTest(c, testnum++); // get an instance of FooConfig try { c = Configuration.getInstance("FooConfig", null); throw new SecurityException("test " + testnum++ + " failed"); } catch (NoSuchAlgorithmException nsae) { // good System.out.println("test " + testnum++ + " passed"); } return testnum; }
Example 2
Source File: GetInstance.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private int testStringProvider(int testnum) throws Exception { // get an instance of JavaLoginConfig from SUN Configuration c = Configuration.getInstance(JAVA_CONFIG, null, "SUN"); doTest(c, testnum++); // get an instance of JavaLoginConfig from SunRsaSign try { c = Configuration.getInstance(JAVA_CONFIG, null, "SunRsaSign"); throw new SecurityException("test " + testnum++ + " failed"); } catch (NoSuchAlgorithmException nsae) { // good System.out.println("test " + testnum++ + " passed"); } // get an instance of JavaLoginConfig from FOO try { c = Configuration.getInstance(JAVA_CONFIG, null, "FOO"); throw new SecurityException("test " + testnum++ + " failed"); } catch (NoSuchProviderException nspe) { // good System.out.println("test " + testnum++ + " passed"); } return testnum; }
Example 3
Source File: GetInstance.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private int testProvider(int testnum) throws Exception { // get an instance of JavaLoginConfig from SUN Configuration c = Configuration.getInstance(JAVA_CONFIG, null, Security.getProvider("SUN")); doTest(c, testnum++); // get an instance of JavaLoginConfig from SunRsaSign try { c = Configuration.getInstance(JAVA_CONFIG, null, Security.getProvider("SunRsaSign")); throw new SecurityException("test " + testnum++ + " failed"); } catch (NoSuchAlgorithmException nsae) { // good System.out.println("test " + testnum++ + " passed"); } return testnum; }
Example 4
Source File: AuthUtils.java From jstorm with Apache License 2.0 | 6 votes |
/** * Construct a JAAS configuration object per storm configuration file * * @param storm_conf Storm configuration * @return JAAS configuration object */ public static Configuration GetConfiguration(Map storm_conf) { Configuration login_conf = null; // find login file configuration from Storm configuration String loginConfigurationFile = (String) storm_conf.get("java.security.auth.login.config"); if ((loginConfigurationFile != null) && (loginConfigurationFile.length() > 0)) { File config_file = new File(loginConfigurationFile); if (!config_file.canRead()) { throw new RuntimeException("File " + loginConfigurationFile + " cannot be read."); } try { URI config_uri = config_file.toURI(); login_conf = Configuration.getInstance("JavaLoginConfig", new URIParameter(config_uri)); } catch (Exception ex) { throw new RuntimeException(ex); } } return login_conf; }
Example 5
Source File: GetInstance.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private int testCustomImpl(int testnum) throws Exception { Provider customProvider = new GetInstanceProvider(); Configuration c = Configuration.getInstance("GetInstanceConfigSpi", null, customProvider); doCustomTest(c, testnum++, customProvider); return testnum; }
Example 6
Source File: GetInstance.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private int testURIParam(int testnum) throws Exception { // get an instance of JavaLoginConfig // from SUN and have it read from the URI File file = new File(System.getProperty("test.src", "."), "GetInstance.configURI"); URI uri = file.toURI(); URIParameter uriParam = new URIParameter(uri); Configuration c = Configuration.getInstance(JAVA_CONFIG, uriParam); doTestURI(c, uriParam, testnum++); return testnum; }