private IIDPStorage createStorage(IConfigurationManager oConfigurationManager, Element config) throws OAException { IIDPStorage storage = null; try { String sClass = oConfigurationManager.getParam(config, "class"); if (sClass == null) { _logger.error("No 'class' item found in 'storage' section in configuration"); throw new OAException(SystemErrors.ERROR_CONFIG_READ); } Class oClass = null; try { oClass = Class.forName(sClass); } catch (Exception e) { _logger.error("No 'class' found with name: " + sClass, e); throw new OAException(SystemErrors.ERROR_INIT); } try { storage = (IIDPStorage) oClass.newInstance(); } catch (Exception e) { _logger.error( "Could not create an 'IIDPStorage' instance of the configured 'class' found with name: " + sClass, e); throw new OAException(SystemErrors.ERROR_INIT); } } catch (OAException e) { throw e; } catch (Exception e) { _logger.fatal("Internal error during creation of storage object", e); throw new OAException(SystemErrors.ERROR_INTERNAL); } return storage; }
/** * @see * com.alfaariss.oa.api.IComponent#start(com.alfaariss.oa.api.configuration.IConfigurationManager, * org.w3c.dom.Element) */ public void start(IConfigurationManager oConfigurationManager, Element eConfig) throws OAException { try { // read organizations config Element eOrganizations = oConfigurationManager.getSection(eConfig, "idps"); if (eOrganizations == null) { _logger.error( "No 'idps' section found in 'method' section in configuration from SAML authentication method"); throw new OAException(SystemErrors.ERROR_CONFIG_READ); } IIDPStorage idpStorage = createStorage(oConfigurationManager, eOrganizations); idpStorage.start(oConfigurationManager, eOrganizations); IDPStorageManager idpStorageManager = Engine.getInstance().getIDPStorageManager(); if (idpStorageManager.existStorage(idpStorage.getID())) { _logger.error("Storage not unique: " + idpStorage.getID()); throw new OAException(SystemErrors.ERROR_INIT); } idpStorageManager.addStorage(idpStorage); // to start the super class, first an organization storage must be created super.start(oConfigurationManager, eConfig, idpStorage); if (_bIsEnabled) { String sFallback = _configurationManager.getParam(eOrganizations, "fallback"); if (sFallback != null) { if (sFallback.equalsIgnoreCase("TRUE")) _bEnableFallback = true; else if (!sFallback.equalsIgnoreCase("FALSE")) { _logger.error( "Unknown value in 'fallback' configuration item (in organizations): " + sFallback); throw new OAException(SystemErrors.ERROR_CONFIG_READ); } _logger.debug("Optional organization fallback set to " + _bEnableFallback); } _profileWebBrowserSSO = new WebBrowserSSOProfile(); _profileWebBrowserSSO.init( _configurationManager, eConfig, SAML2Exchange.getEntityDescriptor(_sLinkedIDPProfile), _idMapper, _organizationStorage, _sMethodId, _sLinkedIDPProfile, _conditionsWindow, _oAuthnInstantWindow, _oRemoteSAMLUserProvisioningProfile); } } catch (OAException e) { throw e; } catch (Exception e) { _logger.fatal("Internal error during start", e); throw new OAException(SystemErrors.ERROR_INTERNAL); } }