/** * Initializes the component for use. */ public void init() { CommonUtils.assertNotNull(this.logoutUri, "logoutUri cannot be null."); CommonUtils.assertTrue(this.logoutUri.startsWith("/"), "logoutUri must start with \"/\""); }
/** {@inheritDoc} */ public String[] getRoles(final Principal p) { CommonUtils.assertTrue(p instanceof AttributePrincipal, "Expected instance of AttributePrincipal but got " + p.getClass()); final Collection<String> roles = getRoleCollection(p); final String[] array = new String[roles.size()]; roles.toArray(array); return array; }
/** {@inheritDoc} */ public String[] getRoles(final Principal p) { CommonUtils.assertTrue(p instanceof AttributePrincipal, "Expected instance of AttributePrincipal but got " + p.getClass()); final Collection<String> roles = getRoleCollection(p); final String[] array = new String[roles.size()]; roles.toArray(array); return array; }
public DelegatingFilter(final String requestParameterName, final Map<String, Filter> delegators, final boolean exactMatch, final Filter defaultFilter) { CommonUtils.assertNotNull(requestParameterName, "requestParameterName cannot be null."); CommonUtils.assertTrue(!delegators.isEmpty(), "delegators cannot be empty."); this.requestParameterName = requestParameterName; this.delegators = delegators; this.defaultFilter = defaultFilter; this.exactMatch = exactMatch; }
/** * Initializes the component for use. */ public void init() { CommonUtils.assertNotNull(this.logoutUri, "logoutUri cannot be null."); CommonUtils.assertTrue(this.logoutUri.startsWith("/"), "logoutUri must start with \"/\""); }
public ProxyList(final List proxyChains) { CommonUtils.assertNotNull(proxyChains, "List of proxy chains cannot be null."); // Assert that all entries in the list are String[] for (final Iterator iter = proxyChains.iterator(); iter.hasNext();) { CommonUtils.assertTrue(iter.next() instanceof String[], "Proxy chains must contain String[] items exclusively."); } this.proxyChains = proxyChains; }
public DelegatingFilter(final String requestParameterName, final Map delegators, final boolean exactMatch, final Filter defaultFilter) { CommonUtils.assertNotNull(requestParameterName, "requestParameterName cannot be null."); CommonUtils.assertTrue(!delegators.isEmpty(), "delegators cannot be empty."); for (final Iterator iter = delegators.keySet().iterator(); iter .hasNext();) { final Object object = delegators.get(iter.next()); if (!Filter.class.isAssignableFrom(object.getClass())) { throw new IllegalArgumentException( "All value objects in the delegators map must be filters."); } } this.requestParameterName = requestParameterName; this.delegators = delegators; this.defaultFilter = defaultFilter; this.exactMatch = exactMatch; }
public void init(final FilterConfig filterConfig, final Class<? extends Filter> filterClazz) { this.simpleFilterName = filterClazz.getSimpleName(); final String fileLocationFromFilterConfig = filterConfig.getInitParameter(CONFIGURATION_FILE_LOCATION); final boolean filterConfigFileLoad = loadPropertiesFromFile(fileLocationFromFilterConfig); if (!filterConfigFileLoad) { final String fileLocationFromServletConfig = filterConfig.getServletContext().getInitParameter(CONFIGURATION_FILE_LOCATION); final boolean servletContextFileLoad = loadPropertiesFromFile(fileLocationFromServletConfig); if (!servletContextFileLoad) { final boolean defaultConfigFileLoaded = loadPropertiesFromFile(DEFAULT_CONFIGURATION_FILE_LOCATION); CommonUtils.assertTrue(defaultConfigFileLoaded, "unable to load properties to configure CAS client"); } } }
/** * Initialization method. Called by Filter's init method or by Spring. Similar in concept to the InitializingBean interface's * afterPropertiesSet(); */ public void init() { CommonUtils.assertTrue(CommonUtils.isNotEmpty(this.serverName) || CommonUtils.isNotEmpty(this.service), "serverName or service must be set."); CommonUtils.assertTrue(CommonUtils.isBlank(this.serverName) || CommonUtils.isBlank(this.service), "serverName and service cannot both be set. You MUST ONLY set one."); }
public void testAssertTrue() { final String CONST_MESSAGE = "test"; CommonUtils.assertTrue(true, CONST_MESSAGE); try { CommonUtils.assertTrue(false, CONST_MESSAGE); } catch (IllegalArgumentException e) { assertEquals(CONST_MESSAGE, e.getMessage()); } }
public void start() throws LifecycleException { super.start(); try { CommonUtils.assertNotNull(this.proxyCallbackUrl, "the proxy callback url cannot be null"); CommonUtils.assertTrue(this.proxyCallbackUrl.startsWith("/"), "proxy callback url must start with \"/\""); PROXY_GRANTING_TICKET_STORAGE = ReflectUtils.newInstance(proxyGrantingTicketStorageClass); } catch (final Exception e) { throw new LifecycleException(e); } logger.info("Startup completed."); }
protected void startInternal() throws LifecycleException { super.startInternal(); try { CommonUtils.assertNotNull(this.proxyCallbackUrl, "the proxy callback url cannot be null"); CommonUtils.assertTrue(this.proxyCallbackUrl.startsWith("/"), "proxy callback url must start with \"/\""); PROXY_GRANTING_TICKET_STORAGE = ReflectUtils.newInstance(proxyGrantingTicketStorageClass); } catch (final Exception e) { throw new LifecycleException(e); } logger.info("Startup completed."); }
protected void startInternal() throws LifecycleException { super.startInternal(); try { CommonUtils.assertNotNull(this.proxyCallbackUrl, "the proxy callback url cannot be null"); CommonUtils.assertTrue(this.proxyCallbackUrl.startsWith("/"), "proxy callback url must start with \"/\""); PROXY_GRANTING_TICKET_STORAGE = ReflectUtils.newInstance(proxyGrantingTicketStorageClass); } catch (final Exception e) { throw new LifecycleException(e); } logger.info("Startup completed."); }
protected void startInternal() throws LifecycleException { super.startInternal(); try { CommonUtils.assertNotNull(this.proxyCallbackUrl, "the proxy callback url cannot be null"); CommonUtils.assertTrue(this.proxyCallbackUrl.startsWith("/"), "proxy callback url must start with \"/\""); PROXY_GRANTING_TICKET_STORAGE = ReflectUtils.newInstance(proxyGrantingTicketStorageClass); } catch (final Exception e) { throw new LifecycleException(e); } logger.info("Startup completed."); }
protected void startInternal() throws LifecycleException { super.startInternal(); try { CommonUtils.assertNotNull(this.proxyCallbackUrl, "the proxy callback url cannot be null"); CommonUtils.assertTrue(this.proxyCallbackUrl.startsWith("/"), "proxy callback url must start with \"/\""); PROXY_GRANTING_TICKET_STORAGE = ReflectUtils.newInstance(proxyGrantingTicketStorageClass); } catch (final Exception e) { throw new LifecycleException(e); } logger.info("Startup completed."); }
/** * Initialization method. Called by Filter's init method or by Spring. Similar in concept to the InitializingBean interface's * afterPropertiesSet(); */ public void init() { CommonUtils.assertNotNull(this.artifactParameterName, "artifactParameterName cannot be null."); CommonUtils.assertNotNull(this.serviceParameterName, "serviceParameterName cannot be null."); CommonUtils.assertTrue(CommonUtils.isNotEmpty(this.serverName) || CommonUtils.isNotEmpty(this.service), "serverName or service must be set."); }
protected void startInternal() throws LifecycleException { super.startInternal(); logger.debug("{} starting.", getName()); final Realm realm = this.context.getRealm(); try { CommonUtils.assertTrue(realm instanceof CasRealm, "Expected CasRealm but got " + realm.getClass()); CommonUtils.assertNotNull(this.casServerUrlPrefix, "casServerUrlPrefix cannot be null."); CommonUtils.assertNotNull(this.delegate.getCasServerLoginUrl(), "casServerLoginUrl cannot be null."); CommonUtils.assertTrue(this.delegate.getServerName() != null || this.delegate.getServiceUrl() != null, "either serverName or serviceUrl must be set."); this.delegate.setRealm((CasRealm) realm); } catch (final Exception e) { throw new LifecycleException(e); } // Complete delegate initialization after the component is started. // See #lifecycleEvent() method. addLifecycleListener(this); }
protected void startInternal() throws LifecycleException { super.startInternal(); logger.debug("{} starting.", getName()); final Realm realm = this.context.getRealm(); try { CommonUtils.assertTrue(realm instanceof CasRealm, "Expected CasRealm but got " + realm.getClass()); CommonUtils.assertNotNull(this.casServerUrlPrefix, "casServerUrlPrefix cannot be null."); CommonUtils.assertNotNull(this.delegate.getCasServerLoginUrl(), "casServerLoginUrl cannot be null."); CommonUtils.assertTrue(this.delegate.getServerName() != null || this.delegate.getServiceUrl() != null, "either serverName or serviceUrl must be set."); this.delegate.setRealm((CasRealm) realm); } catch (final Exception e) { throw new LifecycleException(e); } // Complete delegate initialization after the component is started. // See #lifecycleEvent() method. addLifecycleListener(this); }
public void start() throws LifecycleException { super.start(); logger.debug("{} starting.", getName()); final Realm realm = this.context.getRealm(); try { CommonUtils.assertTrue(realm instanceof CasRealm, "Expected CasRealm but got " + realm.getInfo()); CommonUtils.assertNotNull(this.casServerUrlPrefix, "casServerUrlPrefix cannot be null."); CommonUtils.assertNotNull(this.delegate.getCasServerLoginUrl(), "casServerLoginUrl cannot be null."); CommonUtils.assertTrue(this.delegate.getServerName() != null || this.delegate.getServiceUrl() != null, "either serverName or serviceUrl must be set."); this.delegate.setRealm((CasRealm) realm); } catch (final Exception e) { throw new LifecycleException(e); } // Complete delegate initialization after the component is started. // See #lifecycleEvent() method. addLifecycleListener(this); }
protected void startInternal() throws LifecycleException { super.startInternal(); logger.debug("{} starting.", getName()); final Realm realm = this.context.getRealm(); try { CommonUtils.assertTrue(realm instanceof CasRealm, "Expected CasRealm but got " + realm.getInfo()); CommonUtils.assertNotNull(this.casServerUrlPrefix, "casServerUrlPrefix cannot be null."); CommonUtils.assertNotNull(this.delegate.getCasServerLoginUrl(), "casServerLoginUrl cannot be null."); CommonUtils.assertTrue(this.delegate.getServerName() != null || this.delegate.getServiceUrl() != null, "either serverName or serviceUrl must be set."); this.delegate.setRealm((CasRealm) realm); } catch (final Exception e) { throw new LifecycleException(e); } // Complete delegate initialization after the component is started. // See #lifecycleEvent() method. addLifecycleListener(this); }