| 1 | 
    
            
    
     | 
    
      package net.sourceforge.pebble.web.tagext;     | 
  
            
  
    | 2 | 
    
            
    
     | 
    
           | 
  
            
  
    | 3 | 
    
            
    
     | 
    
      import net.sourceforge.pebble.web.controller.HttpController;     | 
  
            
  
    | 4 | 
    
            
    
     | 
    
           | 
  
            
  
    | 5 | 
    
            
    
     | 
    
      import javax.servlet.http.Cookie;     | 
  
            
  
    | 6 | 
    
            
    
     | 
    
      import javax.servlet.http.HttpServletRequest;     | 
  
            
  
    | 7 | 
    
            
    
     | 
    
      import javax.servlet.http.HttpServletResponse;     | 
  
            
  
    | 8 | 
    
            
    
     | 
    
      import javax.servlet.http.HttpSession;     | 
  
            
  
    | 9 | 
    
            
    
     | 
    
      import javax.servlet.jsp.JspException;     | 
  
            
  
    | 10 | 
    
            
    
     | 
    
      import javax.servlet.jsp.JspWriter;     | 
  
            
  
    | 11 | 
    
            
    
     | 
    
      import javax.servlet.jsp.tagext.TagSupport;     | 
  
            
  
    | 12 | 
    
            
    
     | 
    
      import java.io.IOException;     | 
  
            
  
    | 13 | 
    
            
    
     | 
    
      import java.security.SecureRandom;     | 
  
            
  
    | 14 | 
    
            
    
     | 
    
           | 
  
            
  
    | 15 | 
    
            
    
     | 
    
           | 
  
            
  
    | 16 | 
    
            
    
     | 
    
           | 
  
            
  
    | 17 | 
    
            
    
     | 
    
      @author     | 
  
            
  
    | 18 | 
    
            
    
     | 
    
           | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 11 (11) | 
           Complexity: 3 | 
           Complexity Density: 0,38 | 
                        
            
        | 
    
  
  
    | 19 | 
    
            
    
     | 
    
      public class SecurityTokenTag extends TagSupport {     | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 10 (10) | 
           Complexity: 3 | 
           Complexity Density: 0,38 | 
                        
            
        | 
    
  
  
    | 20 | 
    
           0
    
     | 
    
         @Override...     | 
  
            
  
    | 21 | 
    
            
    
     | 
    
        public int doStartTag() throws JspException {     | 
  
            
  
    | 22 | 
    
           0
    
     | 
    
          JspWriter out = pageContext.getOut();     | 
  
            
  
    | 23 | 
    
           0
    
     | 
    
          String token = (String) pageContext.getRequest().getAttribute(HttpController.PEBBLE_SECURITY_TOKEN_PARAMETER);     | 
  
            
  
    | 24 | 
    
           0
    
     | 
    
          if (token != null) {     | 
  
            
  
    | 25 | 
    
           0
    
     | 
    
            try {     | 
  
            
  
    | 26 | 
    
           0
    
     | 
    
              out.append("<input type=\"hidden\" name=\"").append(HttpController.PEBBLE_SECURITY_TOKEN_PARAMETER);     | 
  
            
  
    | 27 | 
    
           0
    
     | 
    
              out.append("\" value=\"").append(token).append("\"/>");     | 
  
            
  
    | 28 | 
    
            
    
     | 
    
            } catch (IOException ioe) {     | 
  
            
  
    | 29 | 
    
           0
    
     | 
    
              throw new JspException(ioe);     | 
  
            
  
    | 30 | 
    
            
    
     | 
    
            }     | 
  
            
  
    | 31 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 32 | 
    
           0
    
     | 
    
          return SKIP_BODY;     | 
  
            
  
    | 33 | 
    
            
    
     | 
    
        }     | 
  
            
  
    | 34 | 
    
            
    
     | 
    
      }     |