Example usage for org.apache.shiro.config ConfigurationException ConfigurationException

List of usage examples for org.apache.shiro.config ConfigurationException ConfigurationException

Introduction

In this page you can find the example usage for org.apache.shiro.config ConfigurationException ConfigurationException.

Prototype

public ConfigurationException(String message, Throwable cause) 

Source Link

Document

Constructs a new ConfigurationException.

Usage

From source file:com.caricah.iotracah.bootstrap.security.realm.impl.IOTTextConfiguredRealm.java

License:Apache License

protected void processDefinitions() {
    try {/* ww w .  ja v  a2 s .  c o m*/
        processRoleDefinitions();
        processUserDefinitions();
    } catch (ParseException e) {
        String msg = "Unable to parse user and/or role definitions.";
        throw new ConfigurationException(msg, e);
    }
}

From source file:com.github.zbiljic.shiro.cache.infinispan.InfinispanCacheManager.java

License:Open Source License

/**
 * Acquires the InputStream for the Infinispan configuration file using {@link
 * ResourceUtils#getInputStreamForPath(String) ResourceUtils.getInputStreamForPath} with the
 * path returned from {@link #getCacheManagerConfigFile() getCacheManagerConfigFile()}.
 *
 * @return the InputStream for the Infinispan configuration file.
 *///from www  .  j a  v a 2s .  co m
protected InputStream getCacheManagerConfigFileInputStream() {
    String configFile = getCacheManagerConfigFile();
    try {
        return ResourceUtils.getInputStreamForPath(configFile);
    } catch (IOException e) {
        throw new ConfigurationException(
                "Unable to obtain input stream for cacheManagerConfigFile [" + configFile + "]", e);
    }
}

From source file:com.stormpath.shiro.servlet.env.StormpathShiroIniEnvironment.java

License:Apache License

@Override
protected void configure() {

    // create the config object
    Config stormpathConfig = configureStormpathEnvironment();

    // Chicken or egg problem. At this point we do NOT have a Stormpath Client, so we cannot use the
    // ApplicationResolver because that will force the client to be created, and would load before the
    // ReflectionBuilder had a chance to customize the client.
    // To keep things simple for now: if the app href is set, we just pass it on to the realm.
    ApplicationRealm realm = new PassthroughApplicationRealm();
    if (stormpathConfig.containsKey(STORMPATH_APPLICATION_HREF_PROPERTY)) {
        String appHref = stormpathConfig.get(STORMPATH_APPLICATION_HREF_PROPERTY);
        realm.setApplicationRestUrl(appHref);
    }//from ww w .ja v  a2s. c  o  m
    defaultEnvironmentObjects.put(DEFAULTS_STORMPATH_CLIENT_PROPERTY,
            new StormpathWebClientFactory(getServletContext()));
    defaultEnvironmentObjects.put(DEFAULTS_STORMPATH_REALM_PROPERTY, realm);
    try {
        RequestEventListener requestEventListener = stormpathConfig
                .getInstance(EventPublisherFactory.REQUEST_EVENT_LISTENER);
        defaultEnvironmentObjects.put("stormpathRequestEventListener", requestEventListener);
        defaultEnvironmentObjects.put("stormpathLogoutListener", new LogoutEventListener());
    } catch (ServletException e) {
        throw new ConfigurationException("Could not get instance of Stormpath event listener. ", e);
    }

    this.objects.clear();

    WebSecurityManager securityManager = createWebSecurityManager();
    setWebSecurityManager(securityManager);

    Factory clientFactory = getObject(DEFAULTS_STORMPATH_CLIENT_PROPERTY, Factory.class);
    log.debug("Updating Client in ServletContext, with instance configured via shiro.ini");
    getServletContext().setAttribute(Client.class.getName(), clientFactory.getInstance());

    FilterChainResolver resolver = createFilterChainResolver();
    if (resolver != null) {
        setFilterChainResolver(resolver);
    }

}

From source file:com.stormpath.shiro.servlet.filter.StormpathShiroFilterChainResolverFactory.java

License:Apache License

@Override
protected FilterChainResolver createInstance() {

    List<Filter> priorityFilters = new ArrayList<>();

    String priorityFilterClassNames = servletContext.getInitParameter(PRIORITY_FILTER_CLASSES_PARAMETER);
    if (Strings.hasText(priorityFilterClassNames)) {
        for (String className : Strings.commaDelimitedListToStringArray(priorityFilterClassNames)) {
            Filter filter = Classes.newInstance(className);
            priorityFilters.add(filter);
        }/*from  w  w  w .  ja v  a2  s .co m*/
    } else {
        priorityFilters.addAll(getDefaultFilters());
    }

    // init each filter
    for (Filter filter : priorityFilters) {
        String filterName = Strings.uncapitalize(filter.getClass().getSimpleName());
        try {
            filter.init(new DefaultFilterConfig(servletContext, filterName,
                    Collections.<String, String>emptyMap()));
        } catch (ServletException e) {
            throw new ConfigurationException(
                    "Could not configure filter: [" + filter.getClass().getName() + "]", e);
        }
    }

    return new ShiroPrioritizedFilterChainResolver(delegateFilterChainResolver, priorityFilters);
}

From source file:com.stormpath.shiro.servlet.mvc.ShiroIDSiteResultController.java

License:Apache License

@Override
protected ViewModel onAuthentication(HttpServletRequest request, HttpServletResponse response,
        AuthenticationResult result) {/*from w  w  w  .  java  2s.  c o  m*/
    ViewModel vm = super.onAuthentication(request, response, result);

    AuthenticationToken token = new PassthroughApplicationRealm.AccountAuthenticationToken(result.getAccount());

    try {
        SecurityUtils.getSubject().login(token);
    } catch (AuthenticationException e) {
        String msg = "Stormpath Shiro realm is not configured correctly, see documentation for: "
                + PassthroughApplicationRealm.class.getName();
        throw new ConfigurationException(msg, e);
    }

    return vm;
}

From source file:com.stormpath.shiro.servlet.mvc.ShiroLoginHandler.java

License:Apache License

@Override
public boolean handle(HttpServletRequest request, HttpServletResponse response, Account account) {

    AuthenticationToken token = new PassthroughApplicationRealm.AccountAuthenticationToken(account);

    try {/*w w  w. j av  a  2  s  .c om*/
        SecurityUtils.getSubject().login(token);
    } catch (AuthenticationException e) {
        String msg = "Unable to pass on authentication info.";
        throw new ConfigurationException(msg, e);
    }

    return true;
}

From source file:com.thjug.bgile.module.ShiroWebModuleImpl.java

License:Creative Commons License

@Override
protected void bindWebSecurityManager(final AnnotatedBindingBuilder<? super WebSecurityManager> bind) {
    try {//from   ww  w  .j a  va2 s  .  co  m
        bind.toConstructor(ShiroWebSecurityManager.class.getConstructor(Collection.class, Collection.class))
                .asEagerSingleton();
    } catch (final NoSuchMethodException e) {
        throw new ConfigurationException(
                "This really shouldn't happen. Either something has changed in Shiro, or there's a bug in ShiroModule.",
                e);
    }
}

From source file:org.seedstack.seed.web.internal.security.shiro.ShiroWebModule.java

License:Mozilla Public License

/**
 * Binds the security manager.  Override this method in order to provide your own security manager binding.
 *
 * By default, a {@link org.apache.shiro.web.mgt.DefaultWebSecurityManager} is bound as an eager singleton.
 *
 * @param bind the binding builder/* w w w  .  jav  a2s.c  om*/
 */
protected void bindWebSecurityManager(AnnotatedBindingBuilder<? super WebSecurityManager> bind) {
    try {
        bind.toConstructor(DefaultWebSecurityManager.class.getConstructor(Collection.class)).asEagerSingleton();
    } catch (NoSuchMethodException e) {
        throw new ConfigurationException(
                "This really shouldn't happen.  Either something has changed in Shiro, or there's a bug in ShiroModule.",
                e);
    }
}

From source file:uk.co.q3c.v7.base.shiro.DefaultShiroModule.java

License:Apache License

@Override
public void bindSecurityManager(AnnotatedBindingBuilder<? super SecurityManager> bind) {
    try {//from w w  w  . j  a  va2  s. c om
        bind.toConstructor(V7SecurityManager.class.getConstructor(Collection.class)).asEagerSingleton();
    } catch (NoSuchMethodException e) {
        throw new ConfigurationException(
                "This really shouldn't happen.  Either something has changed in Shiro, or there's a bug in "
                        + ShiroModule.class.getSimpleName(),
                e);
    }
}

From source file:uk.q3c.krail.core.shiro.DefaultShiroModule.java

License:Apache License

@Override
protected void bindSecurityManager(AnnotatedBindingBuilder<? super SecurityManager> bind) {
    try {/*from   ww w  .  j  a v a 2s. c  o m*/
        bind.toConstructor(KrailSecurityManager.class.getConstructor(Collection.class, Optional.class))
                .asEagerSingleton();
    } catch (NoSuchMethodException e) {
        throw new ConfigurationException(
                "This really shouldn't happen.  Either something has changed in Shiro, " + ""
                        + "or there's a bug in ShiroModule.",
                e);
    }
}