protected void init(ServletConfig servletConfig, ServiceConfig serviceConfig, SecurityConfig secConfig) { if (serviceConfig.getInstance() instanceof AuthenticationTokenService) { m_authTokenService = (AuthenticationTokenService) serviceConfig.getInstance(); } }
protected ServiceConfig getSecurityServiceConfig() { return m_securityConfig.getServiceConfig(SERVICE_NAME); } }
@Override public PolicyEnforcementServiceImpl locate(String id) { EnforcementPointConfig enforcementPoint = getServiceConfig().getEnforcementPointConfig(id); if (enforcementPoint == null) { return null; } return (PolicyEnforcementServiceImpl) enforcementPoint.getInstance(); }
public void init(ServletConfig config) throws ServletException { super.init(config); m_serviceName = config.getInitParameter(INIT_PARAM_SERVICE_NAME); if (m_serviceName == null || m_serviceName.length() < 0) { m_serviceName = config.getServletName(); } SecurityConfig securityConfig = WebSecurityConfigUtil.getSecurityConfig(getServletContext()); if (securityConfig == null) { throw new IllegalStateException("security config not found in servlet context"); } ServiceConfig serviceConfig = securityConfig.getServiceConfig(m_serviceName); m_facadeService = (FacadeDispatcher) serviceConfig.getInstance(); }
/** * Method gets the XACML1DecisionService from the security configuration in the servlet context. * * @return XACML1DecisionService. * @see XACML1SOAPDecisionServiceAdapter#getXACML1DecisionService() */ protected XACML1DecisionService getXACML1DecisionService() { MessageContext ctx = MessageContext.getCurrentContext(); SecurityConfig securityconfig = Axis1SecurityConfigUtil.getSecurityConfig(ctx); if (securityconfig != null) { ServiceConfig serviceConfig = securityconfig.getServiceConfig(ctx.getService().getName()); if (serviceConfig != null) { if (serviceConfig.getInstance() instanceof XACML1DecisionService) { return (XACML1DecisionService) serviceConfig.getInstance(); } throw new IllegalStateException( "service configured under name <" + ctx.getService().getName() + "> is not a <" + XACML1DecisionService.class.getName() + ">"); } throw new IllegalStateException( "no service with name <" + ctx.getService().getName() + "> configured, please check your <security-config> configuration."); } throw new IllegalStateException( "no <security-config> configuration found in servlet context."); } }
public FacadeDispatcher getFacadeManagerService() { String m_serviceName = getServlet().getInitParameter(INIT_PARAM_SERVICE_NAME); if (m_serviceName == null || m_serviceName.length() < 0) { m_serviceName = getServlet().getServletName(); } SecurityConfig securityConfig = getSecurityConfig(); ServiceConfig serviceConfig = securityConfig.getServiceConfig(m_serviceName); return (FacadeDispatcher) serviceConfig.getInstance(); }
protected void init(final ServletConfig servletConfig, final ServiceConfig serviceConfig, final SecurityConfig secConfig) { if (serviceConfig.getInstance() instanceof PolicyEnforcementServiceLocator) { m_pesLocator = (PolicyEnforcementServiceLocator) serviceConfig.getInstance(); } if (m_pesLocator == null) { m_pesLocator = (PolicyEnforcementServiceLocator) serviceConfig.getProperties().get( "policyEnforcementServiceLocator"); } if (m_pesLocator == null) { // backwards compatibility SecurityConfigPolicyEnforcementServiceLocator securityConfigLocator = new SecurityConfigPolicyEnforcementServiceLocator(); securityConfigLocator.setServiceConfig(serviceConfig); m_pesLocator = securityConfigLocator; } httpClientFactory = (HTTPClientFactory) serviceConfig.getProperties().get(HttpRequestForward.HTTP_CLIENT_FACTORY); if (httpClientFactory == null) { httpClientFactory = new JDKHTTPClientFactory(); } }
private EnforcementFacade getEnforcmentFacade() { EnforcementFacade facade = null; EnforcementPointConfig enforcementPoint = getSecurityServiceConfig() .getEnforcementPointConfig(getEnforcementPointId()); List interceptorList = new ArrayList(); for (Iterator i = enforcementPoint.getInterceptors(); i.hasNext();) { interceptorList.add(i.next()); } String protectedServiceURL = enforcementPoint.getEndpoint(); AuthenticationService authnService = getSecurityServiceConfig() .getAuthenticationService(); try { facade = new EnforcementFacade(protectedServiceURL, authnService, interceptorList); } catch (Exception e) { sLogger.debug("Failed to create EnforcementFacade, e"); } return facade; }
@Override public PolicyEnforcementServiceImpl locate(final String id, final String authenticationScheme) { EnforcementPointConfig enforcementPoint = getServiceConfig().getEnforcementPointConfig(id); if (enforcementPoint == null) { return null; } // special configuration property Set authenticationSchemes = (Set) enforcementPoint.getProperties().get( ENFORCEMENTPOINT_PROPERTY_AUTHENTICATION_SCHEMES); // if no schemes are configured all are allowed! if ((authenticationSchemes == null && "WSS".equals(authenticationScheme)) || authenticationSchemes.contains(authenticationScheme)) { PolicyEnforcementServiceImpl policyEnforcementServiceImpl = (PolicyEnforcementServiceImpl) enforcementPoint .getInstance(); return policyEnforcementServiceImpl; } return null; }
/** * Method init. * * @throws ServletException if error occurs. */ public void init() throws ServletException { super.init(); m_securityConfig = (XmlSecurityConfig) WebSecurityConfigUtil.getSecurityConfig(getServletContext()); if (m_securityConfig == null) { throw new ServletException( "No SecurityConfiguration found in ServletContext, please configure a appropriate listener, like <org.n52.security.service.config.support.SecurityConfigContextListener>."); } m_icInfoProvider = (InterceptorInfoProvider) m_securityConfig.getPreConfiguredInstance("interceptorInfoProvider"); m_interceptorSpecTemplateProvider = (InterceptorSpecTemplateProvider) m_securityConfig.getPreConfiguredInstance("interceptorSpecTemplateProvider"); m_excHandlerInfoProvider = (ExceptionHandlerInfoProvider) m_securityConfig.getPreConfiguredInstance("exceptionHandlerInfoProvider"); m_enfPointSpecTemplateProvider = (DefaultEnfPointSpecTemplateProvider) m_securityConfig.getPreConfiguredInstance("enforcementPointSpecTemplateProvider"); }
public void startUp(ConfigurationContext configCtx, AxisService service) { Parameter fileLocation = service .getParameter(SecurityConfigContextListener.CONTEXT_PARAM_CONFIG_LOCATION); String file = fileLocation.getValue().toString(); file = file != null && file.length() > 0 ? file : DEFAULT_CONFIG_LOCATION; InputStream instream = service.getClassLoader().getResourceAsStream( file); if (instream == null) { throw new ConfigurationException("File at location <" + file + "> not found."); } SecurityConfig config = new XmlSecurityConfig(instream); STSPasswordCallbackHandler stspwch = new STSPasswordCallbackHandler( config); try { service.addParameter(WSHandlerConstants.PW_CALLBACK_CLASS, "org.n52.security.service.sts.STSPasswordCallbackHandler"); service.addParameter(new Parameter( WebSecurityConfigUtil.SECURITYCONFIG_CONTEXT_KEY, config)); } catch (AxisFault e) { LOG.warn("SecurityConfig could not be stored in AxisService", e); } LOG.info("SecurityConfiguration successfull stored in AxisService"); }
protected HTTPClientFactory getHttpClientFactory() { HTTPClientFactory clientFactory = (HTTPClientFactory) getSecurityConfig().getPreConfiguredInstance("httpClientFactory"); if (clientFactory == null) { clientFactory = new JDKHTTPClientFactory(); } return clientFactory; } }
private XmlSecurityConfigDocument init(InputStream configStream) { try { return XmlSecurityConfigDocument.Factory.parse(configStream, new XmlOptions().setLoadStripComments() .setLoadStripProcinsts().setLoadStripWhitespace().setLoadTrimTextBuffer()); } catch (Exception e) { throw new ConfigurationException("input stream can't be parsed to a SecurityConfig document :" + e, e); } }
/** * Stores an assembled (running) endpoint. * * @param id * enforcement point id. * @param assembledEnforcementPoint * the running endpoint. */ private void setAssembledEnforcementPoint(final String id, final AssembledEnforcementPoint assembledEnforcementPoint) { AssembledEnforcementPoint old; synchronized (m_instanceLock) { old = (AssembledEnforcementPoint) m_assembledEnforcementPoints.remove(id); } if (old != null) { old.getCreationContext().release(); } if (assembledEnforcementPoint != null) { synchronized (m_instanceLock) { if (!m_destroyed) { m_assembledEnforcementPoints.put(id, assembledEnforcementPoint); } } } }
protected void init(final ServletConfig servletConfig, final ServiceConfig serviceConfig, final SecurityConfig secConfig) { if (serviceConfig != null) { if (serviceConfig.getInstance() instanceof XACML1DecisionService) { m_decisionService = (XACML1DecisionService) serviceConfig.getInstance(); } else { throw new IllegalStateException("Service configured under name <" + servletConfig.getServletName() + "> is not a <" + XACML1DecisionService.class.getName() + ">"); } } else { throw new IllegalStateException("No service with name <" + servletConfig.getServletName() + "> configured, please check your <security-config> configuration."); } String wsdlPath = servletConfig.getInitParameter("wsdlPath"); if (wsdlPath == null || wsdlPath.length() == 0) { wsdlPath = (String) serviceConfig.getProperties().get("wsdlPath"); } if (wsdlPath != null && wsdlPath.length() > 0) { m_wsdlPath = wsdlPath; } }
@Override protected void init(ServletConfig servletConfig, ServiceConfig serviceConfig, SecurityConfig secConfig) { setServletHandler((ServletHandler)serviceConfig.getInstance()); }
protected ServiceConfig getSecurityServiceConfig() { return getSecurityConfig().getServiceConfig(SERVICE_NAME); }
private boolean isInWhitelist(ReturnUrl returnUrl) { String commaSeparatedHostWhitelist = (String) getSecurityConfig().getPreConfiguredInstance("redirectionHostWhitelist"); String[] hostWhitelist = commaSeparatedHostWhitelist.split(","); Set<String> hosts = new HashSet<String>(); for (String whitelistEntry : hostWhitelist) { hosts.add(whitelistEntry.trim()); } return hosts.contains(returnUrl.getHostName()); }
public void shutDown(ConfigurationContext configCtx, AxisService service) { SecurityConfig config = (SecurityConfig) service.getParameter( WebSecurityConfigUtil.SECURITYCONFIG_CONTEXT_KEY) .getValue(); try { service.removeParameter(new Parameter( WebSecurityConfigUtil.SECURITYCONFIG_CONTEXT_KEY, config)); } catch (AxisFault e) { LOG.warn("SecurityConfig could not be removed from AxisService", e); } if (config != null) { config.release(); } LOG.info("SecurityConfig successfull removed from AxisService"); }
public PolicyEnforcementServiceImpl getPolicyEnforcementService() { return (PolicyEnforcementServiceImpl) getCreationContext().getPreConfiguredInstance( getEnforcementPointSpecification().getId()); }