title: Spring Security - showing content specific to the logged in user
body: <p>Say I have a profile page, which has an 'edit your profile' link. The profile page can be viewed by all the users, but the edit link button should be visible only for a logged in user viewing his profile, not another user's profile.</p>
  
  <p>As of now I have this code, </p>
  
  <pre><code>&lt;sec:authorize access="isAuthenticated()"&gt;
  &lt;sec:authentication property="principal.username" var="principal"/&gt;
  &lt;c:if test="${profile_username eq principal}"&gt;   &lt;!--profile_username is the username of the viewed profile  --&gt;
  &lt;!-- edit your profile link --&gt;
  &lt;/c:if&gt;
  &lt;/sec:authorize&gt;    
  </code></pre>
  
  <p>Is there a cleaner way a doing this?? May be a one liner like </p>
  
  <p><code>&lt;sec:authorize access="isTheSamePerson()"/&gt;</code>.</p>
  
  <p>Thanks in advance. :)</p>