title: how to exclude special users from security check validation in restful webservice
body: <p>I am using rest web-service to fetch file path. Here i a using security context to provide some extra security. I used validation about logged-in user must be same as user name specified in web service URL (<strong>security check</strong>).</p>
  
  <p>But i have one special case where, i have one user which is used to fetch special files path from server. If i passes this user from web-service URL, it is getting caught in security context validation, because logged-in user and URL specified user is not same.</p>
  
  <p>So there is any other way to exclude special user from security check.
  Can i specify some config in web.xml to solve this problem.</p>
  
  <p>e.g</p>
  
  <pre><code>condition 1 
  
  logged-in user - xyz
  web-service URL - 192.168.0.132/download.ws/xyz/fileid
  
  passed in security checked.
  </code></pre>
  
  <p>and</p>
  
  <pre><code>condition 2 
  
  logged-in user - xyz
  abc is valid and authorized user.
  web-service URL - 192.168.0.132/download.ws/abc/fileid
  
  failed in security checked.
  </code></pre>
  
  <p>i want to make it passed without, doing when user from URL is abc then allow it in security check.</p>
  
  <p>here is web-service code to check for valid user</p>
  
  <pre><code>public String getCallerId(SecurityContext sc) {
  
          // we always create a GenericPrincipal object in AuthService
          GenericPrincipal userPrincipal = (GenericPrincipal) sc.getUserPrincipal();
          String szUserEmailID= userPrincipal.getName();
  
          return szUserEmailID;
      }
  
      public boolean authorizeRequest(SecurityContext osc, String szResourceID,   String reqType) {
              if( getCallerId(osc).equalsIgnoreCase(szResourceID)) // check for logged-in user and user specified in web-service url
                  return true;
              return false; 
          }
  </code></pre>