Class TransitionVoter<S,E>

java.lang.Object
org.springframework.statemachine.security.TransitionVoter<S,E>
Type Parameters:
S - the type of state
E - the type of event
All Implemented Interfaces:
org.springframework.security.access.AccessDecisionVoter<Transition<S,E>>

public class TransitionVoter<S,E> extends Object implements org.springframework.security.access.AccessDecisionVoter<Transition<S,E>>
Votes if any ConfigAttribute.getAttribute() starts with a prefix indicating that it is a transition source or target. The default prefixes strings are TRANSITION_SOURCE and TRANSITION_TARGET, but those may be overridden to any value. It may also be set to empty, which means that essentially any attribute will be voted on. As described further below, the effect of an empty prefix may not be quite desirable.

All comparisons and prefixes are case sensitive.

  • Constructor Details

    • TransitionVoter

      public TransitionVoter()
  • Method Details

    • supports

      public boolean supports(org.springframework.security.access.ConfigAttribute attribute)
      Specified by:
      supports in interface org.springframework.security.access.AccessDecisionVoter<S>
    • supports

      public boolean supports(Class<?> clazz)
      Specified by:
      supports in interface org.springframework.security.access.AccessDecisionVoter<S>
    • vote

      public int vote(org.springframework.security.core.Authentication authentication, Transition<S,E> transition, Collection<org.springframework.security.access.ConfigAttribute> attributes)
      Specified by:
      vote in interface org.springframework.security.access.AccessDecisionVoter<S>
    • getTransitionSourcePrefix

      public String getTransitionSourcePrefix()
      Gets the transition source prefix.
      Returns:
      the transition source prefix
    • setTransitionSourcePrefix

      public void setTransitionSourcePrefix(String transitionSourcePrefix)
      Allows the default transition source prefix of TRANSITION_SOURCE_ to be overridden. May be set to an empty value, although this is usually not desirable.
      Parameters:
      transitionSourcePrefix - the new transition source prefix
    • getTransitionTargetPrefix

      public String getTransitionTargetPrefix()
      Gets the transition target prefix.
      Returns:
      the transition target prefix
    • setTransitionTargetPrefix

      public void setTransitionTargetPrefix(String transitionTargetPrefix)
      Allows the default transition target prefix of TRANSITION_TARGET_ to be overridden. May be set to an empty value, although this is usually not desirable.
      Parameters:
      transitionTargetPrefix - the new transition source prefix