Example #1
0
  @Test
  public void testInvalidAppRedirectDisplaysError() throws Exception {
    ScimUser user = createUnapprovedUser();

    // given we vist the app (specifying an invalid redirect - incorrect protocol https)
    webDriver.get(appUrl + "?redirect_uri=https://localhost:8080/app/");

    // Sign in to login server
    webDriver.findElement(By.name("username")).sendKeys(user.getUserName());
    webDriver.findElement(By.name("password")).sendKeys(user.getPassword());
    webDriver.findElement(By.xpath("//input[@value='Sign in']")).click();

    // Authorize the app for some scopes
    assertThat(
        webDriver.findElement(By.className("alert-error")).getText(),
        RegexMatcher.matchesRegex(
            "^Invalid redirect (.*) did not match one of the registered values"));
  }
Example #2
0
 /**
  * Finds matching rules by using current regex matching strategy. The rule associated with each
  * path that matches is added to the list of matches. The order of matching rules is the same
  * order that they were added.
  *
  * @param namespaceURI Namespace URI for which to select matching rules, or <code>null</code> to
  *     match regardless of namespace URI
  * @param pattern Nesting pattern to be matched
  * @return a list of matching <code>Rule</code>'s
  */
 public List match(String namespaceURI, String pattern) {
   //
   // not a particularly quick implementation
   // regex is probably going to be slower than string equality
   // so probably should have a set of strings
   // and test each only once
   //
   // XXX FIX ME - Time And Optimize
   //
   ArrayList rules = new ArrayList(registeredRules.size());
   Iterator it = registeredRules.iterator();
   while (it.hasNext()) {
     RegisteredRule next = (RegisteredRule) it.next();
     if (matcher.match(pattern, next.pattern)) {
       rules.add(next.rule);
     }
   }
   return rules;
 }