Package org.apache.shiro.config

Examples of org.apache.shiro.config.ConfigurationException


    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);
        }
    }
View Full Code Here


        try {
            processRoleDefinitions();
            processUserDefinitions();
        } catch (ParseException e) {
            String msg = "Unable to parse user and/or role definitions.";
            throw new ConfigurationException(msg, e);
        }
    }
View Full Code Here

     */
    protected void bindSecurityManager(AnnotatedBindingBuilder<? super SecurityManager> bind) {
        try {
            bind.toConstructor(DefaultSecurityManager.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);
        }
    }
View Full Code Here

            case NO_SALT:
                password = getPasswordForUser(conn, username)[0];
                break;
            case CRYPT:
                // TODO: separate password and hash from getPasswordForUser[0]
                throw new ConfigurationException("Not implemented yet");
                //break;
            case COLUMN:
                String[] queryResults = getPasswordForUser(conn, username);
                password = queryResults[0];
                salt = queryResults[1];
View Full Code Here

    protected AttributeDefinition toDefinition(String name, String config) {

        AttributeProperty prop = AttributeProperty.fromName(name);
        if (prop == null) {
            throw new ConfigurationException("Unable to locate a standard OpenId Attribute property for name '" +
                    name + "'.  Please ensure this name matches one of the constants in the " +
                    AttributeProperty.class.getName() + " enum (name matching is case insensitive).");
        }

        String uri = prop.getUri();
        boolean required = false;
        int count = 0;


        if (config != null) {
            String[] configPairs = StringUtils.split(config);
            for (String pair : configPairs) {
                String nameValue[] = pair.split("\\=", 2);
                if (nameValue.length != 2) {
                    throw new ConfigurationException("OpenId attribute properties with configuration must be " +
                            "comma-delimited name/value pairs.  Each name/value pair must be separated by the " +
                            "equals sign, e.g. nameProp[name1=value1, name2=value2, ...].   The string that " +
                            "caused this error was '" + pair + "'.");
                }
                String pairName = nameValue[0];
                String pairValue = nameValue[1];

                if ("uri".equalsIgnoreCase(pairName)) {
                    uri = pairValue;
                } else if ("required".equalsIgnoreCase(pairName)) {
                    required = Boolean.valueOf(pairValue);
                } else if ("count".equalsIgnoreCase(pairName)) {
                    try {
                        count = Integer.parseInt(pairValue);
                    } catch (NumberFormatException e) {
                        String msg = "Unable to correctly parse 'count' value '" + pairValue + "' for OpenId " +
                                "attribute '" + name + "'";
                        throw new ConfigurationException(msg, e);
                    }
                    if (count < 0) {
                        count = 0;
                    }
                } else {
View Full Code Here

    Iterable<DBModelAuthorizable> authorizables = parseRole(role);
    for(DBModelAuthorizable authorizable : authorizables) {
      if(authorizable instanceof Server &&
          authorizable.getName().equals(Server.ALL.getName())) {
        String msg = "Invalid value for " + authorizable.getAuthzType() + " in " + role;
        throw new ConfigurationException(msg);
      }
    }
  }
View Full Code Here

      Lists.newArrayList(new CollectionRequiredInRole());
    this.providerBackend = providerBackend;
    this.providerBackend.process(validators);

    if (!this.providerBackend.getRoles().getPerDatabaseRoles().isEmpty()) {
      throw new ConfigurationException(
        "SimpleSearchPolicyEngine does not support per-database roles, " +
        "but per-database roles were specified.  Ignoring.");
    }
  }
View Full Code Here

    Iterable<DBModelAuthorizable> authorizables = parseRole(role);
    for(DBModelAuthorizable authorizable : authorizables) {
      if(authorizable instanceof Server && !serverName.equalsIgnoreCase(authorizable.getName())) {
        String msg = "Server name " + authorizable.getName() + " in "
      + role + " is invalid. Expected " + serverName;
        throw new ConfigurationException(msg);
      }
    }
  }
View Full Code Here

        if(authorizable instanceof Database &&
            !database.equalsIgnoreCase(authorizable.getName())) {
          String msg = "Role " + role + " references db " +
              authorizable.getName() + ", but is only allowed to reference "
              + database;
          throw new ConfigurationException(msg);
        }
      }
    }
  }
View Full Code Here

      // XXX this ugly hack is because action is not an authorizeable
      if(!section.toLowerCase().startsWith(PRIVILEGE_PREFIX)) {
        SearchModelAuthorizable authorizable = SearchModelAuthorizables.from(section);
        if(authorizable == null) {
          String msg = "No authorizable found for " + section;
          throw new ConfigurationException(msg);
        }
        result.add(authorizable);
      }
    }
    return result;
View Full Code Here

TOP

Related Classes of org.apache.shiro.config.ConfigurationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.