I got it I should use the following
<sec:authentication var="currentUsername" property="name"/>
Question
I need to copy the username of current user into a variable to be able to compare it with another variable.
I retrieve the username using
<sec:authentication property="name"/>
Now need to copy it into a variable to be tested in following if condition
<c:if test="${(name eq myuser.username)}">
.........
Solution
I got it I should use the following
<sec:authentication var="currentUsername" property="name"/>