Class SwitchUserGrantedAuthority

  • All Implemented Interfaces:
    java.io.Serializable, org.springframework.security.core.GrantedAuthority

    public final class SwitchUserGrantedAuthority
    extends java.lang.Object
    implements org.springframework.security.core.GrantedAuthority
    Custom GrantedAuthority used by SwitchUserFilter

    Stores the Authentication object of the original user to be used later when 'exiting' from a user switch.

    See Also:
    SwitchUserFilter, Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      SwitchUserGrantedAuthority​(java.lang.String role, org.springframework.security.core.Authentication source)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.String getAuthority()  
      org.springframework.security.core.Authentication getSource()
      Returns the original user associated with a successful user switch.
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SwitchUserGrantedAuthority

        public SwitchUserGrantedAuthority​(java.lang.String role,
                                          org.springframework.security.core.Authentication source)
    • Method Detail

      • getSource

        public org.springframework.security.core.Authentication getSource()
        Returns the original user associated with a successful user switch.
        Returns:
        The original Authentication object of the switched user.
      • getAuthority

        public java.lang.String getAuthority()
        Specified by:
        getAuthority in interface org.springframework.security.core.GrantedAuthority
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object