Class FlowableSwitchUserHandler

  • All Implemented Interfaces:
    org.springframework.beans.factory.InitializingBean, org.springframework.security.access.intercept.RunAsManager, org.springframework.security.web.authentication.AuthenticationFailureHandler, org.springframework.security.web.authentication.AuthenticationSuccessHandler, org.springframework.security.web.authentication.logout.LogoutHandler, org.springframework.security.web.authentication.switchuser.SwitchUserAuthorityChanger

    public class FlowableSwitchUserHandler
    extends java.lang.Object
    implements org.springframework.security.web.authentication.AuthenticationSuccessHandler, org.springframework.security.web.authentication.AuthenticationFailureHandler, org.springframework.security.web.authentication.logout.LogoutHandler, org.springframework.security.access.intercept.RunAsManager, org.springframework.security.web.authentication.switchuser.SwitchUserAuthorityChanger, org.springframework.beans.factory.InitializingBean
    Author:
    Filip Hrisafov
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterPropertiesSet()  
      org.springframework.security.core.Authentication buildRunAs​(org.springframework.security.core.Authentication authentication, java.lang.Object object, java.util.Collection<org.springframework.security.access.ConfigAttribute> attributes)  
      protected void cancelCookie​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
      protected java.lang.String getCookiePath​(javax.servlet.http.HttpServletRequest request)  
      protected boolean isAllowedToImpersonateUser​(org.springframework.security.core.Authentication authentication)  
      void logout​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication authentication)  
      java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> modifyGrantedAuthorities​(org.springframework.security.core.userdetails.UserDetails targetUser, org.springframework.security.core.Authentication currentAuthentication, java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> authoritiesToBeGranted)  
      void onAuthenticationFailure​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.security.core.AuthenticationException exception)  
      void onAuthenticationSuccess​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication authentication)  
      protected void setCookie​(java.lang.String cookieValue, int maxAge, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
      protected void setCookie​(java.lang.String cookieValue, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
      void setCookieDomain​(java.lang.String cookieDomain)  
      void setCookieMaxAge​(java.time.Duration duration)  
      void setCookieName​(java.lang.String cookieName)  
      void setImpersonatePermissionVoters​(java.util.Collection<ImpersonatePermissionVoter> impersonatePermissionVoters)  
      void setKey​(java.lang.String key)  
      void setUserDetailsService​(org.springframework.security.core.userdetails.UserDetailsService userDetailsService)  
      boolean supports​(java.lang.Class<?> clazz)  
      boolean supports​(org.springframework.security.access.ConfigAttribute attribute)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.springframework.security.web.authentication.AuthenticationSuccessHandler

        onAuthenticationSuccess
    • Field Detail

      • key

        protected java.lang.String key
      • cookieName

        protected java.lang.String cookieName
      • cookieMaxAgeInSeconds

        protected int cookieMaxAgeInSeconds
      • cookieDomain

        protected java.lang.String cookieDomain
      • userDetailsService

        protected org.springframework.security.core.userdetails.UserDetailsService userDetailsService
    • Constructor Detail

      • FlowableSwitchUserHandler

        public FlowableSwitchUserHandler()
    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      • onAuthenticationFailure

        public void onAuthenticationFailure​(javax.servlet.http.HttpServletRequest request,
                                            javax.servlet.http.HttpServletResponse response,
                                            org.springframework.security.core.AuthenticationException exception)
        Specified by:
        onAuthenticationFailure in interface org.springframework.security.web.authentication.AuthenticationFailureHandler
      • onAuthenticationSuccess

        public void onAuthenticationSuccess​(javax.servlet.http.HttpServletRequest request,
                                            javax.servlet.http.HttpServletResponse response,
                                            org.springframework.security.core.Authentication authentication)
        Specified by:
        onAuthenticationSuccess in interface org.springframework.security.web.authentication.AuthenticationSuccessHandler
      • logout

        public void logout​(javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response,
                           org.springframework.security.core.Authentication authentication)
        Specified by:
        logout in interface org.springframework.security.web.authentication.logout.LogoutHandler
      • buildRunAs

        public org.springframework.security.core.Authentication buildRunAs​(org.springframework.security.core.Authentication authentication,
                                                                           java.lang.Object object,
                                                                           java.util.Collection<org.springframework.security.access.ConfigAttribute> attributes)
        Specified by:
        buildRunAs in interface org.springframework.security.access.intercept.RunAsManager
      • supports

        public boolean supports​(org.springframework.security.access.ConfigAttribute attribute)
        Specified by:
        supports in interface org.springframework.security.access.intercept.RunAsManager
      • supports

        public boolean supports​(java.lang.Class<?> clazz)
        Specified by:
        supports in interface org.springframework.security.access.intercept.RunAsManager
      • modifyGrantedAuthorities

        public java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> modifyGrantedAuthorities​(org.springframework.security.core.userdetails.UserDetails targetUser,
                                                                                                                           org.springframework.security.core.Authentication currentAuthentication,
                                                                                                                           java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> authoritiesToBeGranted)
        Specified by:
        modifyGrantedAuthorities in interface org.springframework.security.web.authentication.switchuser.SwitchUserAuthorityChanger
      • isAllowedToImpersonateUser

        protected boolean isAllowedToImpersonateUser​(org.springframework.security.core.Authentication authentication)
      • cancelCookie

        protected void cancelCookie​(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response)
      • setCookie

        protected void setCookie​(java.lang.String cookieValue,
                                 javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
      • setCookie

        protected void setCookie​(java.lang.String cookieValue,
                                 int maxAge,
                                 javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
      • getCookiePath

        protected java.lang.String getCookiePath​(javax.servlet.http.HttpServletRequest request)
      • setKey

        public void setKey​(java.lang.String key)
      • setCookieName

        public void setCookieName​(java.lang.String cookieName)
      • setCookieMaxAge

        public void setCookieMaxAge​(java.time.Duration duration)
      • setCookieDomain

        public void setCookieDomain​(java.lang.String cookieDomain)
      • setUserDetailsService

        public void setUserDetailsService​(org.springframework.security.core.userdetails.UserDetailsService userDetailsService)
      • setImpersonatePermissionVoters

        public void setImpersonatePermissionVoters​(java.util.Collection<ImpersonatePermissionVoter> impersonatePermissionVoters)