Interface Authorizer

  • All Known Implementing Classes:
    AuthorizerNoop, CAMSAuthorizer, TomcatAuthorizer

    public interface Authorizer
    An implementation must have a no-arg constructor, so it can be created through reflection. This design allows for third party plug-ins.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean authorize​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, String role)
      Decide is this request is authorized in the named role.
      void doGet​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
      Process this request.
      void setRoleSource​(RoleSource roleSource)
      Set the role source, if there is one.
    • Method Detail

      • setRoleSource

        void setRoleSource​(RoleSource roleSource)
        Set the role source, if there is one. If not, assume no role authentication is needed. use RoleSource.hasRole() to test for role.
        Parameters:
        roleSource - tells whether a user has the named role.
      • authorize

        boolean authorize​(javax.servlet.http.HttpServletRequest req,
                          javax.servlet.http.HttpServletResponse res,
                          String role)
                   throws IOException,
                          javax.servlet.ServletException
        Decide is this request is authorized in the named role. This method must be thread-safe.
        Parameters:
        req - the request
        res - the response
        role - need this role
        Returns:
        true if user is authenticated. if false, must set res.setStatus().
        Throws:
        IOException - I/O error, eg network
        javax.servlet.ServletException - other errors
      • doGet

        void doGet​(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse res)
            throws javax.servlet.ServletException,
                   IOException
        Process this request. May be a no-op.
        Parameters:
        req - the request
        res - the response
        Throws:
        IOException - I/O error, eg network
        javax.servlet.ServletException - other errors