private static InputStream getResource(String resource) throws IOException { // Try it as a File resource... final File file = new File(resource); if (file.exists() && !file.isDirectory()) { return new FileInputStream(file); } // Try it as a classpath resource ... URL url = SecurityActions.loadResource(STSClientConfig.class, resource); if (url != null) { final InputStream is = url.openStream(); if (is != null) { return is; } } return null; }
private static InputStream getResource(String resource) throws IOException { // Try it as a File resource... final File file = new File(resource); if (file.exists() && !file.isDirectory()) { return new FileInputStream(file); } // Try it as a classpath resource ... URL url = SecurityActions.loadResource(STSClientConfig.class, resource); if (url != null) { final InputStream is = url.openStream(); if (is != null) { return is; } } return null; }
private static InputStream getResource(String resource) throws IOException { // Try it as a File resource... final File file = new File(resource); if (file.exists() && !file.isDirectory()) { return new FileInputStream(file); } // Try it as a classpath resource ... URL url = SecurityActions.loadResource(STSClientConfig.class, resource); if (url != null) { final InputStream is = url.openStream(); if (is != null) { return is; } } return null; } }
private static InputStream getResource(String resource) throws IOException { // Try it as a File resource... final File file = new File(resource); if (file.exists() && !file.isDirectory()) { return new FileInputStream(file); } // Try it as a classpath resource ... URL url = SecurityActions.loadResource(STSClientConfig.class, resource); if (url != null) { final InputStream is = url.openStream(); if (is != null) { return is; } } return null; } }
private static InputStream getResource(String resource) throws IOException { // Try it as a File resource... final File file = new File(resource); if (file.exists() && !file.isDirectory()) { return new FileInputStream(file); } // Try it as a classpath resource ... URL url = SecurityActions.loadResource(STSClientConfig.class, resource); if (url != null) { final InputStream is = url.openStream(); if (is != null) { return is; } } return null; } }
else configurationFileURL = SecurityActions.loadResource(getClass(), STS_CONFIG_FILE);
else configurationFileURL = SecurityActions.loadResource(getClass(), STS_CONFIG_FILE);
configurationFileURL = configurationFile.toURI().toURL(); } else { configurationFileURL = SecurityActions.loadResource(getClass(), PICKETLINK_CONFIG_FILE); configurationFileURL = SecurityActions.loadResource(getClass(), STS_CONFIG_FILE);
/** * <p> * Constructs and returns a {@code SecurityTokenProvider} from the specified class name. * </p> * * @param providerClass the FQN of the {@code SecurityTokenProvider} to be instantiated. * @param properties a {@code Map<String, String>} containing the properties that have been configured for the * token provider. * @return a reference to the constructed {@code SecurityTokenProvider} object. */ public SecurityTokenProvider createTokenProvider(String providerClass, Map<String, String> properties) { try { Class<?> clazz = SecurityActions.loadClass(getClass(), providerClass); if (clazz == null) throw new RuntimeException(ErrorCodes.CLASS_NOT_LOADED + providerClass); SecurityTokenProvider tokenProvider = (SecurityTokenProvider) clazz.newInstance(); tokenProvider.initialize(properties); return tokenProvider; } catch (Exception pae) { throw new RuntimeException(ErrorCodes.CANNOT_CREATE_INSTANCE + providerClass, pae); } }
configurationFileURL = configurationFile.toURI().toURL(); } else { configurationFileURL = SecurityActions.loadResource(getClass(), PICKETLINK_CONFIG_FILE); configurationFileURL = SecurityActions.loadResource(getClass(), STS_CONFIG_FILE);
/** * <p> * Constructs and returns a {@code ClaimsProcessor} from the specified class name. The processor is initialized * with the specified properties map. * </p> * * @param processorClass the FQN of the {@code ClaimsProcessor} to be instantiated. * @param properties a {@code Map<String, String>} containing the properties that have been configured for the * claims processor. * @return a reference to the constructed {@code ClaimsProcessor} object. */ public ClaimsProcessor createClaimsProcessor(String processorClass, Map<String, String> properties) { try { Class<?> clazz = SecurityActions.loadClass(getClass(), processorClass); if (clazz == null) throw new RuntimeException(ErrorCodes.CLASS_NOT_LOADED + processorClass); ClaimsProcessor claimsProcessor = (ClaimsProcessor) clazz.newInstance(); claimsProcessor.initialize(properties); return claimsProcessor; } catch (Exception pae) { throw new RuntimeException(ErrorCodes.CANNOT_CREATE_INSTANCE + "claims processor " + processorClass, pae); } } }
configurationFileURL = configurationFile.toURI().toURL(); } else { configurationFileURL = SecurityActions.loadResource(getClass(), PICKETLINK_CONFIG_FILE); configurationFileURL = SecurityActions.loadResource(getClass(), STS_CONFIG_FILE);