private static AuthorizationDataSource getAuthorizationDataSource(
      String snaaName, Properties props)
      throws ClassNotFoundException, IllegalAccessException, InstantiationException {
    for (Object o : props.keySet()) {
      String dataSourceName = snaaName + authorizationAtt + authorizationDataSource;
      if (o.equals(dataSourceName)) {
        AuthorizationDataSource dataSource =
            (AuthorizationDataSource) Class.forName(props.getProperty((String) o)).newInstance();

        String dataSourceUsername =
            props.getProperty(dataSourceName + authorizationDataSourceUsername);
        String dataSourcePassword =
            props.getProperty(dataSourceName + authorizationDataSourcePassword);
        String dataSourceUrl = props.getProperty(dataSourceName + authorizationDataSourceUrl);

        if (dataSourceUsername != null) {
          dataSource.setUsername(dataSourceUsername);
        }
        if (dataSourcePassword != null) {
          dataSource.setPassword(dataSourcePassword);
        }
        if (dataSourceUrl != null) {
          dataSource.setUrl(dataSourceUrl);
        }

        return dataSource;
      }
    }
    // set default
    return new ShibbolethDataSource();
  }
  @Override
  public boolean isAuthorized(Action action, UserDetails details) throws SNAAExceptionException {
    String puid = null;
    // check if user is authorised in datasource
    try {
      // get uid

      List<Object> uidList = details.getUserDetails().get("personUniqueID");
      if (uidList == null) return false;

      puid = (String) uidList.get(0);

      // check authorization for attribute-Map
      for (Object key : details.getUserDetails().keySet()) {
        String regex = getRegex(key);
        if (regex != null) {
          if (!compareValues(regex, details.getUserDetails().get(key))) throw new Exception();
        }
      }

      // check datasource
      return dataSource.isAuthorized(puid, action.getAction());
    } catch (Exception e) {
      log.warn(e.getMessage());
      return false;
    }
  }