use of org.apereo.portal.security.IAuthorizationServiceFactory in project uPortal by Jasig.
the class AuthorizationTester method initializeAuthorizationService.
/** Create an implementation of IAuthorizationService. */
private void initializeAuthorizationService() throws AuthorizationException {
// Get the security properties file
java.io.InputStream secprops = AuthorizationService.class.getResourceAsStream("/properties/security.properties");
// Get the properties from the security properties file
Properties pr = new Properties();
String s_factoryName = null;
try {
pr.load(secprops);
// Look for our authorization factory and instantiate an instance of it or die trying.
if ((s_factoryName = pr.getProperty("authorizationProvider")) == null) {
print("ERROR: AuthorizationProvider not specified or incorrect in security.properties");
} else {
try {
IAuthorizationServiceFactory factory = (IAuthorizationServiceFactory) Class.forName(s_factoryName).newInstance();
authorizationService = factory.getAuthorization();
} catch (Exception e) {
print("ERROR: Failed to instantiate " + s_factoryName);
}
}
} catch (IOException e) {
print("ERROR: " + e.getMessage());
} finally {
try {
if (secprops != null)
secprops.close();
} catch (IOException ioe) {
print(new PortalSecurityException(ioe.getMessage()).toString());
}
}
}
Aggregations