Package org.springframework.webflow.engine.model

Examples of org.springframework.webflow.engine.model.SecuredModel


  private SecuredModel parseSecured(Element element) {
    element = DomUtils.getChildElementByTagName(element, "secured");
    if (element == null) {
      return null;
    } else {
      SecuredModel secured = new SecuredModel(element.getAttribute("attributes"));
      secured.setMatch(element.getAttribute("match"));
      return secured;
    }
  }
View Full Code Here


    assertEquals("a literal", outcome.getOutput().get("literal"));
    assertNull(outcome.getOutput().get("notReached"));
  }

  public void testFlowSecured() {
    model.setSecured(new SecuredModel("ROLE_USER"));
    model.setStates(singleList(new EndStateModel("end")));
    Flow flow = getFlow(model);
    SecurityRule rule = (SecurityRule) flow.getAttributes().get(SecurityRule.SECURITY_ATTRIBUTE_NAME);
    assertNotNull(rule);
    assertEquals(SecurityRule.COMPARISON_ANY, rule.getComparisonType());
View Full Code Here

    assertTrue(rule.getAttributes().contains("ROLE_USER"));
  }

  public void testFlowSecuredState() {
    EndStateModel end = new EndStateModel("end");
    end.setSecured(new SecuredModel("ROLE_USER"));
    model.setStates(singleList(end));
    Flow flow = getFlow(model);
    SecurityRule rule = (SecurityRule) flow.getState("end").getAttributes().get(
        SecurityRule.SECURITY_ATTRIBUTE_NAME);
    assertNotNull(rule);
View Full Code Here

  public void testFlowSecuredTransition() {
    model.setStates(singleList(new EndStateModel("end")));
    TransitionModel transition = new TransitionModel();
    transition.setTo("end");
    transition.setSecured(new SecuredModel("ROLE_USER"));
    model.setGlobalTransitions(singleList(transition));
    Flow flow = getFlow(model);
    SecurityRule rule = (SecurityRule) flow.getGlobalTransitionSet().toArray()[0].getAttributes().get(
        SecurityRule.SECURITY_ATTRIBUTE_NAME);
    assertNotNull(rule);
View Full Code Here

    ClassPathResource resource = new ClassPathResource("flow-secured.xml", getClass());
    FlowModelBuilder builder = new XmlFlowModelBuilder(resource, registry);
    builder.init();
    builder.build();
    FlowModel flow = builder.getFlowModel();
    SecuredModel secured = flow.getSecured();
    assertNotNull(secured);
    assertEquals("ROLE_USER", secured.getAttributes());
  }
View Full Code Here

    ClassPathResource resource = new ClassPathResource("flow-secured-state.xml", getClass());
    FlowModelBuilder builder = new XmlFlowModelBuilder(resource, registry);
    builder.init();
    builder.build();
    FlowModel flow = builder.getFlowModel();
    SecuredModel secured = ((AbstractStateModel) flow.getStates().get(0)).getSecured();
    assertNotNull(secured);
    assertEquals("ROLE_USER", secured.getAttributes());
  }
View Full Code Here

    ClassPathResource resource = new ClassPathResource("flow-secured-transition.xml", getClass());
    FlowModelBuilder builder = new XmlFlowModelBuilder(resource, registry);
    builder.init();
    builder.build();
    FlowModel flow = builder.getFlowModel();
    SecuredModel secured = ((TransitionModel) flow.getGlobalTransitions().get(0)).getSecured();
    assertNotNull(secured);
    assertEquals("ROLE_USER", secured.getAttributes());
  }
View Full Code Here

    assertEquals("a literal", outcome.getOutput().get("literal"));
    assertNull(outcome.getOutput().get("notReached"));
  }

  public void testFlowSecured() {
    model.setSecured(new SecuredModel("ROLE_USER"));
    model.setStates(asList(AbstractStateModel.class, new EndStateModel("end")));
    Flow flow = getFlow(model);
    SecurityRule rule = (SecurityRule) flow.getAttributes().get(SecurityRule.SECURITY_ATTRIBUTE_NAME);
    assertNotNull(rule);
    assertEquals(SecurityRule.COMPARISON_ANY, rule.getComparisonType());
View Full Code Here

    assertTrue(rule.getAttributes().contains("ROLE_USER"));
  }

  public void testFlowSecuredState() {
    EndStateModel end = new EndStateModel("end");
    end.setSecured(new SecuredModel("ROLE_USER"));
    model.setStates(asList(AbstractStateModel.class, end));
    Flow flow = getFlow(model);
    SecurityRule rule = (SecurityRule) flow.getState("end").getAttributes()
        .get(SecurityRule.SECURITY_ATTRIBUTE_NAME);
    assertNotNull(rule);
View Full Code Here

  public void testFlowSecuredTransition() {
    model.setStates(asList(AbstractStateModel.class, new EndStateModel("end")));
    TransitionModel transition = new TransitionModel();
    transition.setTo("end");
    transition.setSecured(new SecuredModel("ROLE_USER"));
    model.setGlobalTransitions(asList(TransitionModel.class, transition));
    Flow flow = getFlow(model);
    SecurityRule rule = (SecurityRule) flow.getGlobalTransitionSet().toArray()[0].getAttributes().get(
        SecurityRule.SECURITY_ATTRIBUTE_NAME);
    assertNotNull(rule);
View Full Code Here

TOP

Related Classes of org.springframework.webflow.engine.model.SecuredModel

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.